From gvanrossum@users.sourceforge.net Tue May 1 03:04:30 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 19:04:30 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv8447 Modified Files: pep-0234.txt Log Message: Moved all the discussion items together at the end, in two sections "Open Issues" and "Resolved Issues". Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** pep-0234.txt 2001/04/27 15:33:02 1.8 --- pep-0234.txt 2001/05/01 02:04:28 1.9 *************** *** 98,118 **** use an iterator (as opposed to a sequence) in a for loop. - Discussion: should the next() method be renamed to __next__()? - Every other method corresponding to a tp_ slot has a - special name. On the other hand, this would suggest that there - should also be a primitive operation next(x) that would call - x.__next__(), and this just looks like adding complexity without - benefit. So I think it's better to stick with next(). On the - other hand, Marc-Andre Lemburg points out: "Even though .next() - reads better, I think that we should stick to the convention that - interpreter APIs use the __xxx__ naming scheme. Otherwise, people - will have a hard time differentiating between user-level protocols - and interpreter-level ones. AFAIK, .next() would be the first - low-level API not using this convention." My (BDFL's) response: - there are other important protocols with a user-level name - (e.g. keys()), and I don't see the importance of this particular - rule. BDFL pronouncement: this topic is closed. next() it is. - Python API Specification --- 98,102 ---- *************** *** 151,183 **** implement __iter__() returning itself. - Discussion: - - - The name iter() is an abbreviation. Alternatives proposed - include iterate(), harp(), traverse(), narrate(). - - - Using the same name for two different operations (getting an - iterator from an object and making an iterator for a function - with an sentinel value) is somewhat ugly. I haven't seen a - better name for the second operation though. - - - There's a bit of undefined behavior for iterators: once a - particular iterator object has raised StopIteration, will it - also raise StopIteration on all subsequent next() calls? Some - say that it would be useful to require this, others say that it - is useful to leave this open to individual iterators. Note that - this may require an additional state bit for some iterator - implementations (e.g. function-wrapping iterators). - - - Some folks have requested the ability to restart an iterator. I - believe this should be dealt with by calling iter() on a - sequence repeatedly, not by the iterator protocol itself. - - - It was originally proposed that rather than having a next() - method, an iterator object should simply be callable. This was - rejected in favor of an explicit next() method. The reason is - clarity: if you don't know the code very well, "x = s()" does - not give a hint about what it does; but "x = s.next()" is pretty - clear. BDFL pronouncement: this topic is closed. next() it is. - Dictionary Iterators --- 135,138 ---- *************** *** 211,255 **** as long as the restriction on modifications to the dictionary (either by the loop or by another thread) are not violated. - - 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 whether x is present among the values, while - the proposal makes "x in dict" check whether x is present among - the keys. Given that the symmetry between lists and dictionaries - is very weak, this argument does not have much weight. - - The main discussion focuses on whether - - for x in dict: ... - - should assign x the successive keys, values, or items of the - dictionary. The symmetry between "if x in y" and "for x in y" - suggests that it should iterate over keys. This symmetry has been - observed by many independently and has even been used to "explain" - one using the other. This is because for sequences, "if x in y" - iterates over y comparing the iterated values to x. If we adopt - both of the above proposals, this will also hold for - dictionaries. - - The argument against making "for x in dict" iterate over the keys - comes mostly from a practicality point of view: scans of the - standard library show that there are about as many uses of "for x - in dict.items()" as there are of "for x in dict.keys()", with the - items() version having a small majority. Presumably many of the - loops using keys() use the corresponding value anyway, by writing - dict[x], so (the argument goes) by making both the key and value - available, we could support the largest number of cases. While - this is true, I (Guido) find the correspondence between "for x in - dict" and "if x in dict" too compelling to break, and there's not - much overhead in having to write dict[x] to explicitly get the - value. We could also add methods to dictionaries that return - different kinds of iterators, e.g. - - for key, value in dict.iteritems(): ... - - for value in dict.itervalues(): ... ! for key in dict.iterkeys(): ... --- 166,175 ---- as long as the restriction on modifications to the dictionary (either by the loop or by another thread) are not violated. ! 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 ! requirements. *************** *** 310,313 **** --- 230,366 ---- + Open Issues + + The following questions are still open. + + - The name iter() is an abbreviation. Alternatives proposed + include iterate(), harp(), traverse(), narrate(). + + - Using the same name for two different operations (getting an + iterator from an object and making an iterator for a function + with an sentinel value) is somewhat ugly. I haven't seen a + better name for the second operation though. + + - Once a particular iterator object has raised StopIteration, will + it also raise StopIteration on all subsequent next() calls? + Some say that it would be useful to require this, others say + that it is useful to leave this open to individual iterators. + Note that this may require an additional state bit for some + iterator implementations (e.g. function-wrapping iterators). + + - Some folks have requested extensions of the iterator protocol, + e.g. prev() to get the previous item, current() to get the + current item again, finished() to test whether the iterator is + finished, and maybe even others, like rewind(), __len__(), + position(). + + While some of these are useful, many of these cannot easily be + implemented for all iterator types without adding arbitrary + buffering, and sometimes they can't be implemented at all (or + not reasonably). E.g. anything to do with reversing directions + can't be done when iterating over a file or function. Maybe a + separate PEP can be drafted to standardize the names for such + operations when the are implementable. + + - There is still discussion about whether + + for x in dict: ... + + should assign x the successive keys, values, or items of the + dictionary. The symmetry between "if x in y" and "for x in y" + suggests that it should iterate over keys. This symmetry has been + observed by many independently and has even been used to "explain" + one using the other. This is because for sequences, "if x in y" + iterates over y comparing the iterated values to x. If we adopt + both of the above proposals, this will also hold for + dictionaries. + + The argument against making "for x in dict" iterate over the keys + comes mostly from a practicality point of view: scans of the + standard library show that there are about as many uses of "for x + in dict.items()" as there are of "for x in dict.keys()", with the + items() version having a small majority. Presumably many of the + loops using keys() use the corresponding value anyway, by writing + dict[x], so (the argument goes) by making both the key and value + available, we could support the largest number of cases. While + this is true, I (Guido) find the correspondence between "for x in + dict" and "if x in dict" too compelling to break, and there's not + much overhead in having to write dict[x] to explicitly get the + value. We could also add methods to dictionaries that return + different kinds of iterators, e.g. + + for key, value in dict.iteritems(): ... + + for value in dict.itervalues(): ... + + for key in dict.iterkeys(): ... + + + Resolved Issues + + The following topics have been decided by consensus or BDFL + pronouncement. + + - Two alternative spellings for next() have been proposed but + rejected: __next__(), because it corresponds to a type object + slot (tp_iternext); and __call__(), because this is the only + operation. + + Arguments against __next__(): while many iterators are used in + for loops, it is expected that user code will also call next() + directly, so having to write __next__() is ugly; also, a + possible extension of the protocol would be to allow for prev(), + current() and reset() operations; surely we don't want to use + __prev__(), __current__(), __reset__(). + + Arguments against __call__() (the original proposal): taken out + of context, x() is not very readable, while x.next() is clear; + there's a danger that every special-purpose object wants to use + __call__() for its most common operation, causing more confusion + 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 + the iteration isn't too expensive. Several alternatives for the + StopIteration exception have been proposed: a special value End + to signal the end, a function end() to test whether the iterator + is finished, even reusing the IndexError exception. + + - A special value has the problem that if a sequence ever + contains that special value, a loop over that sequence will + end prematurely without any warning. If the experience with + null-terminated C strings hasn't taught us the problems this + can cause, imagine the trouble a Python introspection tool + would have iterating over a list of all built-in names, + assuming that the special End value was a built-in name! + + - Calling an end() function would require two calls per + iteration. Two calls is much more expensive than one call + plus a test for an exception. Especially the time-critical + for loop can test very cheaply for an exception. + + - Reusing IndexError can cause confusion because it can be a + genuine error, which would be masked by ending the loop + prematurely. + + - Some have asked for a standard iterator type. Presumably all + iterators would have to be derived from this type. But this is + not the Python way: dictionaries are mappings because they + support __getitem__() and a handful other operations, not + because they are derived from an abstract mapping type. + + - 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 + whether x is present among the values, while the proposal makes + "x in dict" check whether x is present among the keys. Given + that the symmetry between lists and dictionaries is very weak, + this argument does not have much weight. + + Mailing Lists *************** *** 321,324 **** --- 374,378 ---- http://groups.yahoo.com/group/python-iter + Copyright From gvanrossum@users.sourceforge.net Tue May 1 03:29:06 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 30 Apr 2001 19:29:06 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv14401 Modified Files: pep-0234.txt Log Message: Update post-history; corrected a typo. Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** pep-0234.txt 2001/05/01 02:04:28 1.9 --- pep-0234.txt 2001/05/01 02:29:03 1.10 *************** *** 7,11 **** Python-Version: 2.1 Created: 30-Jan-2001 ! Post-History: Abstract --- 7,11 ---- Python-Version: 2.1 Created: 30-Jan-2001 ! Post-History: 30-Apr-2001 Abstract *************** *** 101,105 **** Python API Specification ! The StopIteration exception is made visiable as one of the standard exceptions. It is derived from Exception. --- 101,105 ---- Python API Specification ! The StopIteration exception is made visible as one of the standard exceptions. It is derived from Exception. From gvanrossum@users.sourceforge.net Tue May 1 12:42:09 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 01 May 2001 04:42:09 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv2159 Modified Files: pep-0234.txt Log Message: Correct typos and add bits of discussion. Also add another "chief virtue". Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** pep-0234.txt 2001/05/01 02:29:03 1.10 --- pep-0234.txt 2001/05/01 11:42:07 1.11 *************** *** 20,24 **** In addition, specific iterators over the keys of a dictionary and over the lines of a file are proposed, and a proposal is made to ! allow spelling dict.kas_key(key) as "key in dict". Note: this is an almost complete rewrite of this PEP by the second --- 20,24 ---- In addition, specific iterators over the keys of a dictionary and over the lines of a file are proposed, and a proposal is made to ! allow spelling dict.has_key(key) as "key in dict". Note: this is an almost complete rewrite of this PEP by the second *************** *** 117,128 **** next value from the iterator. If the callable raises an exception, this is propagated normally; in particular, the ! function is allowed to raise StopError as an alternative way to ! end the iteration. (This functionality is available from the C ! API as PyCallIter_New(callable, sentinel).) Iterator objects returned by either form of iter() have a next() method. This method either returns the next value in the ! iteration, or raises StopError (or a derived exception class) to ! signal the end of the iteration. Any other exception should be considered to signify an error and should be propagated normally, not taken to mean the end of the iteration. --- 117,128 ---- next value from the iterator. If the callable raises an exception, this is propagated normally; in particular, the ! function is allowed to raise StopIteration as an alternative way ! to end the iteration. (This functionality is available from the ! C API as PyCallIter_New(callable, sentinel).) Iterator objects returned by either form of iter() have a next() method. This method either returns the next value in the ! iteration, or raises StopIteration (or a derived exception class) ! to signal the end of the iteration. Any other exception should be considered to signify an error and should be propagated normally, not taken to mean the end of the iteration. *************** *** 213,221 **** If all the parts of the proposal are included, this addresses many concerns in a consistent and flexible fashion. Among its chief ! virtues are the following three -- no, four -- no, five -- points: 1. It provides an extensible iterator interface. ! 1. It allows performance enhancements to list iteration. 3. It allows big performance enhancements to dictionary iteration. --- 213,221 ---- If all the parts of the proposal are included, this addresses many concerns in a consistent and flexible fashion. Among its chief ! virtues are the following four -- no, five -- no, six -- points: 1. It provides an extensible iterator interface. ! 2. It allows performance enhancements to list iteration. 3. It allows big performance enhancements to dictionary iteration. *************** *** 229,233 **** --- 229,236 ---- {__getitem__, keys, values, items}. + 6. It makes code iterating over non-sequence collections more + concise and readable. + Open Issues *************** *** 235,244 **** - The name iter() is an abbreviation. Alternatives proposed ! include iterate(), harp(), traverse(), narrate(). - Using the same name for two different operations (getting an iterator from an object and making an iterator for a function with an sentinel value) is somewhat ugly. I haven't seen a ! better name for the second operation though. - Once a particular iterator object has raised StopIteration, will --- 238,250 ---- - The name iter() is an abbreviation. Alternatives proposed ! include iterate(), traverse(), but these appear too long. ! Python has a history of using abbrs for common builtins, ! e.g. repr(), str(), len(). - Using the same name for two different operations (getting an iterator from an object and making an iterator for a function with an sentinel value) is somewhat ugly. I haven't seen a ! better name for the second operation though, and since they both ! return an iterator, it's easy to remember. - Once a particular iterator object has raised StopIteration, will *************** *** 287,292 **** dict" and "if x in dict" too compelling to break, and there's not much overhead in having to write dict[x] to explicitly get the ! value. We could also add methods to dictionaries that return ! different kinds of iterators, e.g. for key, value in dict.iteritems(): ... --- 293,308 ---- dict" and "if x in dict" too compelling to break, and there's not much overhead in having to write dict[x] to explicitly get the ! value. I've also timed the difference between ! ! for key in dict: dict[key] ! ! and ! ! for key, value in dict[key]: pass ! ! and found that these run at about the same speed. ! ! We could also add methods to dictionaries that return different ! kinds of iterators, e.g. for key, value in dict.iteritems(): ... From gvanrossum@users.sourceforge.net Tue May 1 12:47:31 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 01 May 2001 04:47:31 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv2984 Modified Files: pep-0234.txt Log Message: Add proposal to make files their own iterator. Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** pep-0234.txt 2001/05/01 11:42:07 1.11 --- pep-0234.txt 2001/05/01 11:47:29 1.12 *************** *** 255,258 **** --- 255,265 ---- iterator implementations (e.g. function-wrapping iterators). + - It has been proposed that a file object should be its own + iterator, with a next() method returning the next line. This + has certain advantages, and makes it even clearer that this + iterator is destructive. The disadvantage is that this would + make it even more painful to implement the "sticky + StopIteration" feature proposed in the previous bullet. + - Some folks have requested extensions of the iterator protocol, e.g. prev() to get the previous item, current() to get the From gvanrossum@users.sourceforge.net Tue May 1 13:10:23 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 01 May 2001 05:10:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.80,2.81 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6196 Modified Files: dictobject.c Log Message: Add experimental iterkeys(), itervalues(), iteritems() to dict objects. Tests show that iteritems() is 5-10% faster than iterating over the dict and extracting the value with dict[key]. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.80 retrieving revision 2.81 diff -C2 -r2.80 -r2.81 *** dictobject.c 2001/04/23 14:08:49 2.80 --- dictobject.c 2001/05/01 12:10:21 2.81 *************** *** 1232,1235 **** --- 1232,1290 ---- + staticforward PyObject *dictiter_new(dictobject *, binaryfunc); + + static PyObject * + select_key(PyObject *key, PyObject *value) + { + Py_INCREF(key); + return key; + } + + static PyObject * + select_value(PyObject *key, PyObject *value) + { + Py_INCREF(value); + return value; + } + + static PyObject * + select_item(PyObject *key, PyObject *value) + { + PyObject *res = PyTuple_New(2); + + if (res != NULL) { + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(res, 0, key); + PyTuple_SET_ITEM(res, 1, value); + } + return res; + } + + static PyObject * + dict_iterkeys(dictobject *dict, PyObject *args) + { + if (!PyArg_ParseTuple(args, "")) + return NULL; + return dictiter_new(dict, select_key); + } + + static PyObject * + dict_itervalues(dictobject *dict, PyObject *args) + { + if (!PyArg_ParseTuple(args, "")) + return NULL; + return dictiter_new(dict, select_value); + } + + static PyObject * + dict_iteritems(dictobject *dict, PyObject *args) + { + if (!PyArg_ParseTuple(args, "")) + return NULL; + return dictiter_new(dict, select_item); + } + + static char has_key__doc__[] = "D.has_key(k) -> 1 if D has a key k, else 0"; *************** *** 1263,1266 **** --- 1318,1330 ---- "D.copy() -> a shallow copy of D"; + static char iterkeys__doc__[] = + "D.iterkeys() -> an iterator over the keys of D"; + + static char itervalues__doc__[] = + "D.itervalues() -> an iterator over the values of D"; + + static char iteritems__doc__[] = + "D.iteritems() -> an iterator over the (key, value) items of D"; + static PyMethodDef mapp_methods[] = { {"has_key", (PyCFunction)dict_has_key, METH_VARARGS, *************** *** 1284,1287 **** --- 1348,1357 ---- {"copy", (PyCFunction)dict_copy, METH_OLDARGS, copy__doc__}, + {"iterkeys", (PyCFunction)dict_iterkeys, METH_VARARGS, + iterkeys__doc__}, + {"itervalues", (PyCFunction)dict_itervalues, METH_VARARGS, + itervalues__doc__}, + {"iteritems", (PyCFunction)dict_iteritems, METH_VARARGS, + iteritems__doc__}, {NULL, NULL} /* sentinel */ }; *************** *** 1325,1329 **** }; ! staticforward PyObject *dictiter_new(dictobject *); PyTypeObject PyDict_Type = { --- 1395,1403 ---- }; ! static PyObject * ! dict_iter(dictobject *dict) ! { ! return dictiter_new(dict, select_key); ! } PyTypeObject PyDict_Type = { *************** *** 1354,1358 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)dictiter_new, /* tp_iter */ 0, /* tp_iternext */ }; --- 1428,1432 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)dict_iter, /* tp_iter */ 0, /* tp_iternext */ }; *************** *** 1408,1415 **** int di_size; int di_pos; } dictiterobject; static PyObject * ! dictiter_new(dictobject *dict) { dictiterobject *di; --- 1482,1490 ---- int di_size; int di_pos; + binaryfunc di_select; } dictiterobject; static PyObject * ! dictiter_new(dictobject *dict, binaryfunc select) { dictiterobject *di; *************** *** 1421,1424 **** --- 1496,1500 ---- di->di_size = dict->ma_size; di->di_pos = 0; + di->di_select = select; return (PyObject *)di; } *************** *** 1434,1438 **** dictiter_next(dictiterobject *di, PyObject *args) { ! PyObject *key; if (di->di_size != di->di_dict->ma_size) { --- 1510,1514 ---- dictiter_next(dictiterobject *di, PyObject *args) { ! PyObject *key, *value; if (di->di_size != di->di_dict->ma_size) { *************** *** 1441,1447 **** return NULL; } ! if (PyDict_Next((PyObject *)(di->di_dict), &di->di_pos, &key, NULL)) { ! Py_INCREF(key); ! return key; } PyErr_SetObject(PyExc_StopIteration, Py_None); --- 1517,1522 ---- 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); *************** *** 1470,1474 **** static PyObject *dictiter_iternext(dictiterobject *di) { ! PyObject *key; if (di->di_size != di->di_dict->ma_size) { --- 1545,1549 ---- static PyObject *dictiter_iternext(dictiterobject *di) { ! PyObject *key, *value; if (di->di_size != di->di_dict->ma_size) { *************** *** 1477,1483 **** return NULL; } ! if (PyDict_Next((PyObject *)(di->di_dict), &di->di_pos, &key, NULL)) { ! Py_INCREF(key); ! return key; } return NULL; --- 1552,1557 ---- return NULL; } ! if (PyDict_Next((PyObject *)(di->di_dict), &di->di_pos, &key, &value)) { ! return (*di->di_select)(key, value); } return NULL; From gvanrossum@users.sourceforge.net Tue May 1 13:15:44 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 01 May 2001 05:15:44 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv6868 Modified Files: pep-0234.txt Log Message: I've implemented iterkeys(), itervalues() and iteritems() methods for dictionaries. These do away with the myth that iterating over the keys and extracting the values is as fast as iterating over the items; it is about 7% slower. Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** pep-0234.txt 2001/05/01 11:47:29 1.12 --- pep-0234.txt 2001/05/01 12:15:42 1.13 *************** *** 167,170 **** --- 167,182 ---- (either by the loop or by another thread) are not violated. + - Add methods to dictionaries that return different kinds of + iterators explicitly: + + for key in dict.iterkeys(): ... + + for value in dict.itervalues(): ... + + for key, value in dict.iteritems(): ... + + This means that "for x in dict" is shorthand for "for x in + dict.iterkeys()". + If this proposal is accepted, it makes sense to recommend that other mappings, if they support iterators at all, should also *************** *** 300,321 **** dict" and "if x in dict" too compelling to break, and there's not much overhead in having to write dict[x] to explicitly get the ! value. I've also timed the difference between for key in dict: dict[key] and - - for key, value in dict[key]: pass - - and found that these run at about the same speed. - - We could also add methods to dictionaries that return different - kinds of iterators, e.g. ! for key, value in dict.iteritems(): ... ! ! for value in dict.itervalues(): ... ! for key in dict.iterkeys(): ... --- 312,327 ---- dict" and "if x in dict" too compelling to break, and there's not much overhead in having to write dict[x] to explicitly get the ! value. + For fast iteration over items, use "for key, value in + dict.iteritems()". I've timed the difference between + for key in dict: dict[key] and ! for key, value in dict.iteritems(): pass ! and found that the latter is only about 7% faster. From gvanrossum@users.sourceforge.net Tue May 1 17:51:55 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 01 May 2001 09:51:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.104,2.105 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv29881 Modified Files: stringobject.c Log Message: Add a proper implementation for the tp_str slot (returning self, of course), so I can get rid of the special case for strings in PyObject_Str(). Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.104 retrieving revision 2.105 diff -C2 -r2.104 -r2.105 *** stringobject.c 2001/04/28 05:38:26 2.104 --- stringobject.c 2001/05/01 16:51:53 2.105 *************** *** 402,405 **** --- 402,412 ---- } + static PyObject * + string_str(PyObject *s) + { + Py_INCREF(s); + return s; + } + static int string_length(PyStringObject *a) *************** *** 2375,2379 **** (hashfunc)string_hash, /*tp_hash*/ 0, /*tp_call*/ ! 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ --- 2382,2386 ---- (hashfunc)string_hash, /*tp_hash*/ 0, /*tp_call*/ ! (reprfunc)string_str, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ From gvanrossum@users.sourceforge.net Tue May 1 17:53:39 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 01 May 2001 09:53:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.125,2.126 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30308 Modified Files: object.c Log Message: Printing objects to a real file still wasn't done right: if the object's type didn't define tp_print, there were still cases where the full "print uses str() which falls back to repr()" semantics weren't honored. This resulted in >>> print None >>> print type(u'') Fixed this by always using the appropriate PyObject_Repr() or PyObject_Str() call, rather than trying to emulate what they would do. Also simplified PyObject_Str() to always fall back on PyObject_Repr() when tp_str is not defined (rather than making an extra check for instances with a __str__ method). And got rid of the special case for strings. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.125 retrieving revision 2.126 diff -C2 -r2.125 -r2.126 *** object.c 2001/04/27 21:35:01 2.125 --- object.c 2001/05/01 16:53:37 2.126 *************** *** 197,221 **** op->ob_refcnt, op); else if (op->ob_type->tp_print == NULL) { ! if ((flags & Py_PRINT_RAW) ! ? (op->ob_type->tp_str == NULL) ! : (op->ob_type->tp_repr == NULL)) ! { ! fprintf(fp, "<%s object at %p>", ! op->ob_type->tp_name, op); ! } else { ! PyObject *s; ! if (flags & Py_PRINT_RAW) ! s = PyObject_Str(op); ! else ! s = PyObject_Repr(op); ! if (s == NULL) ! ret = -1; ! else { ! ret = PyObject_Print(s, fp, ! Py_PRINT_RAW); ! } ! Py_XDECREF(s); } } else --- 197,211 ---- op->ob_refcnt, op); else if (op->ob_type->tp_print == NULL) { ! PyObject *s; ! if (flags & Py_PRINT_RAW) ! s = PyObject_Str(op); ! else ! s = PyObject_Repr(op); ! if (s == NULL) ! ret = -1; else { ! ret = PyObject_Print(s, fp, Py_PRINT_RAW); } + Py_XDECREF(s); } else *************** *** 302,321 **** if (v == NULL) return PyString_FromString(""); ! else if (PyString_Check(v)) { Py_INCREF(v); return v; - } - else if (v->ob_type->tp_str != NULL) - res = (*v->ob_type->tp_str)(v); - else { - PyObject *func; - if (!PyInstance_Check(v) || - (func = PyObject_GetAttrString(v, "__str__")) == NULL) { - PyErr_Clear(); - return PyObject_Repr(v); - } - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); } if (res == NULL) return NULL; --- 292,303 ---- if (v == NULL) return PyString_FromString(""); ! if (PyString_Check(v)) { Py_INCREF(v); return v; } + if (v->ob_type->tp_str == NULL) + return PyObject_Repr(v); + + res = (*v->ob_type->tp_str)(v); if (res == NULL) return NULL; From gvanrossum@users.sourceforge.net Tue May 1 18:01:27 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 01 May 2001 10:01:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects iterobject.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv32032 Modified Files: iterobject.c Log Message: Discard a misleading comment about iter_iternext(). Index: iterobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/iterobject.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** iterobject.c 2001/04/23 14:08:49 1.3 --- iterobject.c 2001/05/01 17:01:25 1.4 *************** *** 46,50 **** } - /* Return (value, 0) if OK; (NULL, 0) at end; (NULL, -1) if exception */ static PyObject * iter_iternext(PyObject *iterator) --- 46,49 ---- From bwarsaw@users.sourceforge.net Tue May 1 18:52:08 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 01 May 2001 10:52:08 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv9330 Modified Files: pep-0234.txt Log Message: Fixed one small typo Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** pep-0234.txt 2001/05/01 12:15:42 1.13 --- pep-0234.txt 2001/05/01 17:52:06 1.14 *************** *** 15,19 **** customized by providing a method that produces an iterator object. The iterator provides a 'get next value' operation that produces ! the nxet item in the sequence each time it is called, raising an exception when no more items are available. --- 15,19 ---- customized by providing a method that produces an iterator object. The iterator provides a 'get next value' operation that produces ! the next item in the sequence each time it is called, raising an exception when no more items are available. From bwarsaw@users.sourceforge.net Tue May 1 18:53:54 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 01 May 2001 10:53:54 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep2html.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv9557 Modified Files: pep2html.py Log Message: The home directory for the python project has moved (and the symlink removed). Index: pep2html.py =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** pep2html.py 2001/03/21 18:59:03 1.23 --- pep2html.py 2001/05/01 17:53:52 1.24 *************** *** 39,43 **** HOST = "shell.sourceforge.net" # host for update ! HDIR = "/home/groups/python/htdocs/peps" # target host directory LOCALVARS = "Local Variables:" --- 39,43 ---- HOST = "shell.sourceforge.net" # host for update ! HDIR = "/home/groups/p/py/python/htdocs/peps" # target host directory LOCALVARS = "Local Variables:" From tim_one@users.sourceforge.net Tue May 1 21:45:32 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 01 May 2001 13:45:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv9210/python/dist/src/Lib/test Modified Files: test_iter.py Log Message: Generalize list(seq) to work with iterators. This also generalizes list() to no longer insist that len(seq) be defined. NEEDS DOC CHANGES. This is meant to be a model for how other functions of this ilk (max, filter, etc) can be generalized similarly. Feel encouraged to grab your favorite and convert it! Note some cute consequences: list(file) == file.readlines() == list(file.xreadlines()) list(dict) == dict.keys() list(dict.iteritems()) = dict.items() list(xrange(i, j, k)) == range(i, j, k) Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_iter.py 2001/04/21 13:33:54 1.2 --- test_iter.py 2001/05/01 20:45:30 1.3 *************** *** 244,246 **** --- 244,278 ---- pass + # Test list()'s use of iterators. + def test_builtin_list(self): + self.assertEqual(list(SequenceClass(5)), range(5)) + self.assertEqual(list(SequenceClass(0)), []) + self.assertEqual(list(()), []) + self.assertEqual(list(range(10, -1, -1)), range(10, -1, -1)) + + d = {"one": 1, "two": 2, "three": 3} + self.assertEqual(list(d), d.keys()) + + self.assertRaises(TypeError, list, list) + self.assertRaises(TypeError, list, 42) + + f = open(TESTFN, "w") + try: + for i in range(5): + f.write("%d\n" % i) + finally: + f.close() + f = open(TESTFN, "r") + try: + self.assertEqual(list(f), ["0\n", "1\n", "2\n", "3\n", "4\n"]) + f.seek(0, 0) + self.assertEqual(list(f.xreadlines()), + ["0\n", "1\n", "2\n", "3\n", "4\n"]) + finally: + f.close() + try: + unlink(TESTFN) + except OSError: + pass + run_unittest(TestCase) From tim_one@users.sourceforge.net Tue May 1 21:45:33 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 01 May 2001 13:45:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.60,2.61 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9210/python/dist/src/Objects Modified Files: abstract.c Log Message: Generalize list(seq) to work with iterators. This also generalizes list() to no longer insist that len(seq) be defined. NEEDS DOC CHANGES. This is meant to be a model for how other functions of this ilk (max, filter, etc) can be generalized similarly. Feel encouraged to grab your favorite and convert it! Note some cute consequences: list(file) == file.readlines() == list(file.xreadlines()) list(dict) == dict.keys() list(dict.iteritems()) = dict.items() list(xrange(i, j, k)) == range(i, j, k) Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.60 retrieving revision 2.61 diff -C2 -r2.60 -r2.61 *** abstract.c 2001/04/23 14:08:49 2.60 --- abstract.c 2001/05/01 20:45:31 2.61 *************** *** 1237,1286 **** PySequence_List(PyObject *v) { ! PySequenceMethods *m; if (v == NULL) return null_error(); if (PyList_Check(v)) return PyList_GetSlice(v, 0, PyList_GET_SIZE(v)); ! m = v->ob_type->tp_as_sequence; ! if (m && m->sq_item) { ! int i; ! PyObject *l; ! int n = PySequence_Size(v); if (n < 0) ! return NULL; ! l = PyList_New(n); ! if (l == NULL) ! return NULL; ! for (i = 0; ; i++) { ! PyObject *item = (*m->sq_item)(v, i); ! if (item == NULL) { ! if (PyErr_ExceptionMatches(PyExc_IndexError)) PyErr_Clear(); else { ! Py_DECREF(l); ! l = NULL; } - break; - } - if (i < n) - PyList_SET_ITEM(l, i, item); - else if (PyList_Append(l, item) < 0) { - Py_DECREF(l); - l = NULL; - break; } } ! if (i < n && l != NULL) { ! if (PyList_SetSlice(l, i, n, (PyObject *)NULL) != 0) { ! Py_DECREF(l); ! l = NULL; ! } } - return l; } ! return type_error("list() argument must be a sequence"); } --- 1237,1312 ---- PySequence_List(PyObject *v) { ! PyObject *it; /* iter(v) */ ! PyObject *result; /* result list */ ! int n; /* guess for result list size */ ! int i; if (v == NULL) return null_error(); + /* Special-case list(a_list), for speed. */ if (PyList_Check(v)) return PyList_GetSlice(v, 0, PyList_GET_SIZE(v)); ! /* Get iterator. There may be some low-level efficiency to be gained ! * by caching the tp_iternext slot instead of using PyIter_Next() ! * later, but premature optimization is the root etc. ! */ ! it = PyObject_GetIter(v); ! if (it == NULL) ! return NULL; ! ! /* Guess a result list size. */ ! n = -1; /* unknown */ ! if (PySequence_Check(v) && ! v->ob_type->tp_as_sequence->sq_length) { ! n = PySequence_Size(v); if (n < 0) ! PyErr_Clear(); ! } ! if (n < 0) ! n = 8; /* arbitrary */ ! result = PyList_New(n); ! if (result == NULL) { ! Py_DECREF(it); ! return NULL; ! } ! ! /* Run iterator to exhaustion. */ ! for (i = 0; ; i++) { ! PyObject *item = PyIter_Next(it); ! if (item == NULL) { ! /* We're out of here in any case, but if this is a ! * StopIteration exception it's expected, but if ! * any other kind of exception it's an error. ! */ ! if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); else { ! Py_DECREF(result); ! result = NULL; } } + break; } ! if (i < n) ! PyList_SET_ITEM(result, i, item); ! else if (PyList_Append(result, item) < 0) { ! Py_DECREF(result); ! result = NULL; ! break; ! } ! } ! ! /* Cut back result list if initial guess was too large. */ ! if (i < n && result != NULL) { ! if (PyList_SetSlice(result, i, n, (PyObject *)NULL) != 0) { ! Py_DECREF(result); ! result = NULL; } } ! Py_DECREF(it); ! return result; } From tim_one@users.sourceforge.net Tue May 1 21:45:33 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 01 May 2001 13:45:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.146,1.147 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv9210/python/dist/src/Misc Modified Files: NEWS Log Message: Generalize list(seq) to work with iterators. This also generalizes list() to no longer insist that len(seq) be defined. NEEDS DOC CHANGES. This is meant to be a model for how other functions of this ilk (max, filter, etc) can be generalized similarly. Feel encouraged to grab your favorite and convert it! Note some cute consequences: list(file) == file.readlines() == list(file.xreadlines()) list(dict) == dict.keys() list(dict.iteritems()) = dict.items() list(xrange(i, j, k)) == range(i, j, k) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.146 retrieving revision 1.147 diff -C2 -r1.146 -r1.147 *** NEWS 2001/04/16 18:46:45 1.146 --- NEWS 2001/05/01 20:45:30 1.147 *************** *** 1,2 **** --- 1,12 ---- + What's New in Python 2.2a0? + =========================== + + Core + + - The following functions were generalized to work nicely with iterator + arguments: + list() + + What's New in Python 2.1 (final)? ================================= From gvanrossum@users.sourceforge.net Tue May 1 21:54:32 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 01 May 2001 13:54:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.147,1.148 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv13008 Modified Files: NEWS Log Message: Add more news about iterators. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.147 retrieving revision 1.148 diff -C2 -r1.147 -r1.148 *** NEWS 2001/05/01 20:45:30 1.147 --- NEWS 2001/05/01 20:54:30 1.148 *************** *** 4,7 **** --- 4,19 ---- Core + - Dictionary objects now support the "in" operator: "x in dict" means + the same as dict.has_key(x). + + - Iterators were added; this is a generalized way of providing values + to a for loop. See PEP 234. There's a new built-in function iter() + to return an iterator. There's a new protocol to get the next value + from an iterator using the next() method (in Python) or the + tp_iternext slot (in C). There's a new protocol to get iterators + using the __iter__() method (in Python) or the tp_iter slot (in C). + Iterating (i.e. a for loop) over a dictionary generates its keys. + Iterating over a file generates its lines. + - The following functions were generalized to work nicely with iterator arguments: From gvanrossum@users.sourceforge.net Tue May 1 22:04:23 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 01 May 2001 14:04:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include descrobject.h,1.1.2.5,1.1.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv13966/Include Modified Files: Tag: descr-branch descrobject.h Log Message: There's a subtlety in type_getattr() that makes me feel the pain of not having metaclasses -- or actually, the mistake of using FooClass.barMethod to reference the unbound barMethod method of FooClass instances (where Smalltalk puts the methods in FooClass.methodDict). To fix this, I added query functions to determine whether a descriptor describes a method or data, and I use this to implement the following priority rules when accessing the bar attribute of type FooType: 1) methods in FooType.__dict__, unadorned 2) anything in FooType.__class__.__dict__, used as a descriptor 3) anything else in FooType.__dict__, unadorned This means that if both have a __repr__, FooType.__repr__ is the unbound __repr__ method for Foo objects, but FooType.__class__ is the class (or type) of FooType, which is (usually) TypeType. If you're confused by this, don't worry. This is on a branch. :-) Index: descrobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Attic/descrobject.h,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -r1.1.2.5 -r1.1.2.6 *** descrobject.h 2001/04/30 01:14:56 1.1.2.5 --- descrobject.h 2001/05/01 21:04:21 1.1.2.6 *************** *** 32,35 **** --- 32,37 ---- extern DL_IMPORT(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); + extern DL_IMPORT(int) PyDescr_IsMethod(PyObject *); + extern DL_IMPORT(int) PyDescr_IsData(PyObject *); extern DL_IMPORT(PyObject *) PyDictProxy_New(PyObject *); From gvanrossum@users.sourceforge.net Tue May 1 22:04:23 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 01 May 2001 14:04:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.1.2.3,1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13966/Lib/test Modified Files: Tag: descr-branch test_descr.py Log Message: There's a subtlety in type_getattr() that makes me feel the pain of not having metaclasses -- or actually, the mistake of using FooClass.barMethod to reference the unbound barMethod method of FooClass instances (where Smalltalk puts the methods in FooClass.methodDict). To fix this, I added query functions to determine whether a descriptor describes a method or data, and I use this to implement the following priority rules when accessing the bar attribute of type FooType: 1) methods in FooType.__dict__, unadorned 2) anything in FooType.__class__.__dict__, used as a descriptor 3) anything else in FooType.__dict__, unadorned This means that if both have a __repr__, FooType.__repr__ is the unbound __repr__ method for Foo objects, but FooType.__class__ is the class (or type) of FooType, which is (usually) TypeType. If you're confused by this, don't worry. This is on a branch. :-) Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -r1.1.2.3 -r1.1.2.4 *** test_descr.py 2001/04/30 16:44:56 1.1.2.3 --- test_descr.py 2001/05/01 21:04:21 1.1.2.4 *************** *** 120,124 **** verify(l == l1) testunop({1:2,3:4}, 2, "len(a)", "__len__") ! ##testunop({1:2,3:4}, "{3: 4, 1: 2}", "repr(a)", "__repr__") testset2op({1:2,3:4}, 2, 3, {1:2,2:3,3:4}, "a[b]=c", "__setitem__") --- 120,124 ---- verify(l == l1) testunop({1:2,3:4}, 2, "len(a)", "__len__") ! testunop({1:2,3:4}, "{3: 4, 1: 2}", "repr(a)", "__repr__") testset2op({1:2,3:4}, 2, 3, {1:2,2:3,3:4}, "a[b]=c", "__setitem__") From gvanrossum@users.sourceforge.net Tue May 1 22:04:24 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 01 May 2001 14:04:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects descrobject.c,1.1.2.6,1.1.2.7 typeobject.c,2.16.8.7,2.16.8.8 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13966/Objects Modified Files: Tag: descr-branch descrobject.c typeobject.c Log Message: There's a subtlety in type_getattr() that makes me feel the pain of not having metaclasses -- or actually, the mistake of using FooClass.barMethod to reference the unbound barMethod method of FooClass instances (where Smalltalk puts the methods in FooClass.methodDict). To fix this, I added query functions to determine whether a descriptor describes a method or data, and I use this to implement the following priority rules when accessing the bar attribute of type FooType: 1) methods in FooType.__dict__, unadorned 2) anything in FooType.__class__.__dict__, used as a descriptor 3) anything else in FooType.__dict__, unadorned This means that if both have a __repr__, FooType.__repr__ is the unbound __repr__ method for Foo objects, but FooType.__class__ is the class (or type) of FooType, which is (usually) TypeType. If you're confused by this, don't worry. This is on a branch. :-) Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/descrobject.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -r1.1.2.6 -r1.1.2.7 *** descrobject.c 2001/04/30 01:14:56 1.1.2.6 --- descrobject.c 2001/05/01 21:04:21 1.1.2.7 *************** *** 397,400 **** --- 397,426 ---- }; + int + PyDescr_IsMethod(PyObject *d) + { + if (PyDescr_Check(d)) { + switch (((PyDescrObject *)d)->d_flavor) { + case DF_METHOD: + case DF_WRAPPER: + return 1; + } + } + return 0; + } + + int + PyDescr_IsData(PyObject *d) + { + if (PyDescr_Check(d)) { + switch (((PyDescrObject *)d)->d_flavor) { + case DF_MEMBER: + case DF_GETSET: + return 1; + } + } + return 0; + } + static PyDescrObject * PyDescr_New(PyTypeObject *type) Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.7 retrieving revision 2.16.8.8 diff -C2 -r2.16.8.7 -r2.16.8.8 *** typeobject.c 2001/04/30 15:54:21 2.16.8.7 --- typeobject.c 2001/05/01 21:04:21 2.16.8.8 *************** *** 62,65 **** --- 62,69 ---- return NULL; } + descr = PyDict_GetItem(type->tp_dict, name); + if (descr != NULL && PyDescr_IsMethod(descr) && + (f = descr->ob_type->tp_descr_get) != NULL) + return (*f)(descr, NULL); } From fdrake@users.sourceforge.net Wed May 2 06:43:11 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 01 May 2001 22:43:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib weakref.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28469 Modified Files: weakref.py Log Message: Added iterator support to the Weak*Dictionary classes. Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** weakref.py 2001/04/19 16:26:06 1.9 --- weakref.py 2001/05/02 05:43:09 1.10 *************** *** 85,88 **** --- 85,98 ---- return L + def iteritems(self): + return WeakValuedItemIterator(self) + + def iterkeys(self): + return self.data.iterkeys() + __iter__ = iterkeys + + def itervalues(self): + return WeakValuedValueIterator(self) + def popitem(self): while 1: *************** *** 168,171 **** --- 178,191 ---- return L + def iteritems(self): + return WeakKeyedItemIterator(self) + + def iterkeys(self): + return WeakKeyedKeyIterator(self) + __iter__ = iterkeys + + def itervalues(self): + return self.data.itervalues() + def keys(self): L = [] *************** *** 190,193 **** --- 210,266 ---- for key, value in dict.items(): d[ref(key, self._remove)] = value + + + class BaseIter: + def __iter__(self): + return self + + + class WeakKeyedKeyIterator(BaseIter): + def __init__(self, weakdict): + self._next = weakdict.data.iterkeys().next + + def next(self): + while 1: + wr = self._next() + obj = wr() + if obj is not None: + return obj + + + class WeakKeyedItemIterator(BaseIter): + def __init__(self, weakdict): + self._next = weakdict.data.iteritems().next + + def next(self): + while 1: + wr, value = self._next() + key = wr() + if key is not None: + return key, value + + + class WeakValuedValueIterator(BaseIter): + def __init__(self, weakdict): + self._next = weakdict.data.itervalues().next + + def next(self): + while 1: + wr = self._next() + obj = wr() + if obj is not None: + return obj + + + class WeakValuedItemIterator(BaseIter): + def __init__(self, weakdict): + self._next = weakdict.data.iteritems().next + + def next(self): + while 1: + key, wr = self._next() + value = wr() + if value is not None: + return key, value From fdrake@users.sourceforge.net Wed May 2 06:44:24 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 01 May 2001 22:44:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28623 Modified Files: test_weakref.py Log Message: Added tests for Weak*Dictionary iterator support. Refactored some object initialization to be more reusable. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** test_weakref.py 2001/04/16 17:37:27 1.7 --- test_weakref.py 2001/05/02 05:44:22 1.8 *************** *** 230,239 **** def test_weak_values(self): ! dict = weakref.WeakValueDictionary() ! objects = map(Object, range(self.COUNT)) for o in objects: - dict[o.arg] = o - - for o in objects: self.assert_(weakref.getweakrefcount(o) == 1, "wrong number of weak references to %r!" % o) --- 230,238 ---- def test_weak_values(self): ! # ! # This exercises d.copy(), d.items(), d[], del d[], len(d). ! # ! dict, objects = self.make_weak_valued_dict() for o in objects: self.assert_(weakref.getweakrefcount(o) == 1, "wrong number of weak references to %r!" % o) *************** *** 256,265 **** def test_weak_keys(self): ! dict = weakref.WeakKeyDictionary() ! objects = map(Object, range(self.COUNT)) for o in objects: - dict[o] = o.arg - - for o in objects: self.assert_(weakref.getweakrefcount(o) == 1, "wrong number of weak references to %r!" % o) --- 255,264 ---- def test_weak_keys(self): ! # ! # This exercises d.copy(), d.items(), d[] = v, d[], del d[], ! # len(d). ! # ! dict, objects = self.make_weak_keyed_dict() for o in objects: self.assert_(weakref.getweakrefcount(o) == 1, "wrong number of weak references to %r!" % o) *************** *** 281,285 **** --- 280,329 ---- "deleting the keys did not clear the dictionary") + def test_weak_keyed_iters(self): + dict, objects = self.make_weak_keyed_dict() + self.check_iters(dict) + + def test_weak_valued_iters(self): + dict, objects = self.make_weak_valued_dict() + self.check_iters(dict) + + def check_iters(self, dict): + # item iterator: + items = dict.items() + for item in dict.iteritems(): + items.remove(item) + self.assert_(len(items) == 0, "iterator did not touch all items") + + # key iterator: + keys = dict.keys() + for k in dict: + keys.remove(k) + self.assert_(len(keys) == 0, "iterator did not touch all keys") + + # value iterator: + values = dict.values() + for v in dict.itervalues(): + values.remove(v) + self.assert_(len(values) == 0, "iterator did not touch all values") + + def make_weak_keyed_dict(self): + dict = weakref.WeakKeyDictionary() + objects = map(Object, range(self.COUNT)) + for o in objects: + dict[o] = o.arg + return dict, objects + + def make_weak_valued_dict(self): + dict = weakref.WeakValueDictionary() + objects = map(Object, range(self.COUNT)) + for o in objects: + dict[o.arg] = o + return dict, objects + def check_update(self, klass, dict): + # + # This exercises d.update(), len(d), d.keys(), d.has_key(), + # d.get(), d[]. + # weakdict = klass() weakdict.update(dict) From tim_one@users.sourceforge.net Wed May 2 06:54:46 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 01 May 2001 22:54:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib asyncore.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29889/python/dist/src/Lib Modified Files: asyncore.py Log Message: Whitespace normalization. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** asyncore.py 2001/04/20 19:04:55 1.11 --- asyncore.py 2001/05/02 05:54:44 1.12 *************** *** 225,229 **** except: pass ! try: ar = repr (self.addr) --- 225,229 ---- except: pass ! try: ar = repr (self.addr) From tim_one@users.sourceforge.net Wed May 2 06:54:46 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 01 May 2001 22:54:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_locale.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29889/python/dist/src/Lib/test Modified Files: test_locale.py Log Message: Whitespace normalization. Index: test_locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_locale.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_locale.py 2001/04/15 13:15:56 1.2 --- test_locale.py 2001/05/02 05:54:44 1.3 *************** *** 37,42 **** testformat("%+f", -42, grouping=1, output='-42.000000') testformat("%20.f", -42, grouping=1, output=' -42') ! testformat("%+10.f", -4200, grouping=1, output=' -4,200') ! testformat("%-10.f", 4200, grouping=1, output='4,200 ') finally: locale.setlocale(locale.LC_NUMERIC, oldlocale) --- 37,42 ---- testformat("%+f", -42, grouping=1, output='-42.000000') testformat("%20.f", -42, grouping=1, output=' -42') ! testformat("%+10.f", -4200, grouping=1, output=' -4,200') ! testformat("%-10.f", 4200, grouping=1, output='4,200 ') finally: locale.setlocale(locale.LC_NUMERIC, oldlocale) From tim_one@users.sourceforge.net Wed May 2 08:12:41 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 02 May 2001 00:12:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.61,2.62 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7959 Modified Files: abstract.c Log Message: Plug a memory leak in list(), when appending to the result list. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -r2.61 -r2.62 *** abstract.c 2001/05/01 20:45:31 2.61 --- abstract.c 2001/05/02 07:12:39 2.62 *************** *** 1292,1300 **** } if (i < n) ! PyList_SET_ITEM(result, i, item); ! else if (PyList_Append(result, item) < 0) { ! Py_DECREF(result); ! result = NULL; ! break; } } --- 1292,1304 ---- } if (i < n) ! PyList_SET_ITEM(result, i, item); /* steals ref */ ! else { ! int status = PyList_Append(result, item); ! Py_DECREF(item); /* append creates a new ref */ ! if (status < 0) { ! Py_DECREF(result); ! result = NULL; ! break; ! } } } From tim_one@users.sourceforge.net Wed May 2 08:39:40 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 02 May 2001 00:39:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.148,1.149 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv11690/python/dist/src/Misc Modified Files: NEWS Log Message: Generalize filter(f, seq) to work with iterators. This also generalizes filter() to no longer insist that len(seq) be defined. NEEDS DOC CHANGES. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.148 retrieving revision 1.149 diff -C2 -r1.148 -r1.149 *** NEWS 2001/05/01 20:54:30 1.148 --- NEWS 2001/05/02 07:39:38 1.149 *************** *** 18,22 **** - The following functions were generalized to work nicely with iterator arguments: ! list() --- 18,23 ---- - The following functions were generalized to work nicely with iterator arguments: ! filter() ! list() *************** *** 237,241 **** - Some improvements to Tools/webchecker (ignore some more URL types, ! follow some more links). - Brought the Tools/compiler package up to date. --- 238,242 ---- - Some improvements to Tools/webchecker (ignore some more URL types, ! follow some more links). - Brought the Tools/compiler package up to date. *************** *** 325,329 **** PyRun_AnyFileExFlags(), PyRun_InteractiveLoopFlags(). These variants may be removed in Python 2.2, when nested scopes are ! mandatory. Distutils --- 326,330 ---- PyRun_AnyFileExFlags(), PyRun_InteractiveLoopFlags(). These variants may be removed in Python 2.2, when nested scopes are ! mandatory. Distutils *************** *** 332,345 **** into the release tree. ! - several enhancements to the bdist_wininst command from Thomas Heller (an uninstaller, more customization of the installer's display) - from Jack Jansen: added Mac-specific code to generate a dialog for users to specify the command-line (because providing a command-line with ! MacPython is awkward). Jack also made various fixes for the Mac and the Metrowerks compiler. ! ! - added 'platforms' and 'keywords' to the set of metadata that can be ! specified for a distribution. - applied patches from Jason Tishler to make the compiler class work with --- 333,346 ---- into the release tree. ! - several enhancements to the bdist_wininst command from Thomas Heller (an uninstaller, more customization of the installer's display) - from Jack Jansen: added Mac-specific code to generate a dialog for users to specify the command-line (because providing a command-line with ! MacPython is awkward). Jack also made various fixes for the Mac and the Metrowerks compiler. ! ! - added 'platforms' and 'keywords' to the set of metadata that can be ! specified for a distribution. - applied patches from Jason Tishler to make the compiler class work with From tim_one@users.sourceforge.net Wed May 2 08:39:40 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 02 May 2001 00:39:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.199,2.200 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv11690/python/dist/src/Python Modified Files: bltinmodule.c Log Message: Generalize filter(f, seq) to work with iterators. This also generalizes filter() to no longer insist that len(seq) be defined. NEEDS DOC CHANGES. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.199 retrieving revision 2.200 diff -C2 -r2.199 -r2.200 *** bltinmodule.c 2001/04/28 08:20:22 2.199 --- bltinmodule.c 2001/05/02 07:39:38 2.200 *************** *** 163,169 **** builtin_filter(PyObject *self, PyObject *args) { ! PyObject *func, *seq, *result; ! PySequenceMethods *sqf; ! int len; register int i, j; --- 163,168 ---- builtin_filter(PyObject *self, PyObject *args) { ! PyObject *func, *seq, *result, *it; ! int len; /* guess for result list size */ register int i, j; *************** *** 171,213 **** return NULL; ! if (PyString_Check(seq)) { ! PyObject *r = filterstring(func, seq); ! return r; ! } ! ! if (PyTuple_Check(seq)) { ! PyObject *r = filtertuple(func, seq); ! return r; ! } ! sqf = seq->ob_type->tp_as_sequence; ! if (sqf == NULL || sqf->sq_length == NULL || sqf->sq_item == NULL) { ! PyErr_SetString(PyExc_TypeError, ! "filter() arg 2 must be a sequence"); ! goto Fail_2; } ! ! if ((len = (*sqf->sq_length)(seq)) < 0) ! goto Fail_2; if (PyList_Check(seq) && seq->ob_refcnt == 1) { Py_INCREF(seq); result = seq; } else { ! if ((result = PyList_New(len)) == NULL) ! goto Fail_2; } for (i = j = 0; ; ++i) { PyObject *item, *good; int ok; ! if ((item = (*sqf->sq_item)(seq, i)) == NULL) { ! if (PyErr_ExceptionMatches(PyExc_IndexError)) { ! PyErr_Clear(); ! break; } ! goto Fail_1; } --- 170,225 ---- return NULL; ! /* Strings and tuples return a result of the same type. */ ! if (PyString_Check(seq)) ! return filterstring(func, seq); ! if (PyTuple_Check(seq)) ! return filtertuple(func, seq); ! ! /* Get iterator. */ ! it = PyObject_GetIter(seq); ! if (it == NULL) ! return NULL; ! /* Guess a result list size. */ ! len = -1; /* unknown */ ! if (PySequence_Check(seq) && ! seq->ob_type->tp_as_sequence->sq_length) { ! len = PySequence_Size(seq); ! if (len < 0) ! PyErr_Clear(); } ! if (len < 0) ! len = 8; /* arbitrary */ + /* Get a result list. */ if (PyList_Check(seq) && seq->ob_refcnt == 1) { + /* Eww - can modify the list in-place. */ Py_INCREF(seq); result = seq; } else { ! result = PyList_New(len); ! if (result == NULL) ! goto Fail_it; } + /* Build the result list. */ for (i = j = 0; ; ++i) { PyObject *item, *good; int ok; ! item = PyIter_Next(it); ! if (item == NULL) { ! /* We're out of here in any case, but if this is a ! * StopIteration exception it's expected, but if ! * any other kind of exception it's an error. ! */ ! if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches(PyExc_StopIteration)) ! PyErr_Clear(); ! else ! goto Fail_result_it; } ! break; } *************** *** 218,228 **** else { PyObject *arg = Py_BuildValue("(O)", item); ! if (arg == NULL) ! goto Fail_1; good = PyEval_CallObject(func, arg); Py_DECREF(arg); if (good == NULL) { Py_DECREF(item); ! goto Fail_1; } } --- 230,242 ---- else { PyObject *arg = Py_BuildValue("(O)", item); ! if (arg == NULL) { ! Py_DECREF(item); ! goto Fail_result_it; ! } good = PyEval_CallObject(func, arg); Py_DECREF(arg); if (good == NULL) { Py_DECREF(item); ! goto Fail_result_it; } } *************** *** 230,258 **** Py_DECREF(good); if (ok) { ! if (j < len) { ! if (PyList_SetItem(result, j++, item) < 0) ! goto Fail_1; ! } else { int status = PyList_Append(result, item); - j++; Py_DECREF(item); if (status < 0) ! goto Fail_1; } ! } else { ! Py_DECREF(item); } } if (j < len && PyList_SetSlice(result, j, len, NULL) < 0) ! goto Fail_1; return result; ! Fail_1: Py_DECREF(result); ! Fail_2: return NULL; } --- 244,272 ---- Py_DECREF(good); if (ok) { ! if (j < len) ! PyList_SET_ITEM(result, j, item); else { int status = PyList_Append(result, item); Py_DECREF(item); if (status < 0) ! goto Fail_result_it; } ! ++j; } + else + Py_DECREF(item); } + /* Cut back result list if len is too big. */ if (j < len && PyList_SetSlice(result, j, len, NULL) < 0) ! goto Fail_result_it; return result; ! Fail_result_it: Py_DECREF(result); ! Fail_it: ! Py_DECREF(it); return NULL; } From tim_one@users.sourceforge.net Wed May 2 08:39:40 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 02 May 2001 00:39:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11690/python/dist/src/Lib/test Modified Files: test_iter.py Log Message: Generalize filter(f, seq) to work with iterators. This also generalizes filter() to no longer insist that len(seq) be defined. NEEDS DOC CHANGES. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_iter.py 2001/05/01 20:45:30 1.3 --- test_iter.py 2001/05/02 07:39:38 1.4 *************** *** 276,278 **** --- 276,322 ---- pass + # Test filter()'s use of iterators. + def test_builtin_filter(self): + self.assertEqual(filter(None, SequenceClass(5)), range(1, 5)) + self.assertEqual(filter(None, SequenceClass(0)), []) + self.assertEqual(filter(None, ()), ()) + self.assertEqual(filter(None, "abc"), "abc") + + d = {"one": 1, "two": 2, "three": 3} + self.assertEqual(filter(None, d), d.keys()) + + self.assertRaises(TypeError, filter, None, list) + self.assertRaises(TypeError, filter, None, 42) + + class Boolean: + def __init__(self, truth): + self.truth = truth + def __nonzero__(self): + return self.truth + True = Boolean(1) + False = Boolean(0) + + class Seq: + def __init__(self, *args): + self.vals = args + def __iter__(self): + class SeqIter: + def __init__(self, vals): + self.vals = vals + self.i = 0 + def __iter__(self): + return self + def next(self): + i = self.i + self.i = i + 1 + if i < len(self.vals): + return self.vals[i] + else: + raise StopIteration + return SeqIter(self.vals) + + seq = Seq(*([True, False] * 25)) + self.assertEqual(filter(lambda x: not x, seq), [False]*25) + self.assertEqual(filter(lambda x: not x, iter(seq)), [False]*25) + run_unittest(TestCase) From lemburg@users.sourceforge.net Wed May 2 15:21:55 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Wed, 02 May 2001 07:21:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.105,2.106 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv20111/Objects Modified Files: stringobject.c Log Message: Fix for bug #417030: "print '%*s' fails for unicode string" Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.105 retrieving revision 2.106 diff -C2 -r2.105 -r2.106 *** stringobject.c 2001/05/01 16:51:53 2.105 --- stringobject.c 2001/05/02 14:21:53 2.106 *************** *** 2782,2785 **** --- 2782,2786 ---- char formatbuf[FORMATBUFLEN]; /* For format{float,int,char}() */ char *fmt_start = fmt; + int argidx_start = argidx; fmt++; *************** *** 2935,2938 **** --- 2936,2940 ---- if (PyUnicode_Check(v)) { fmt = fmt_start; + argidx = argidx_start; goto unicode; } *************** *** 3099,3104 **** args_owned = 0; } ! /* Fiddle args right (remove the first argidx-1 arguments) */ ! --argidx; if (PyTuple_Check(orig_args) && argidx > 0) { PyObject *v; --- 3101,3105 ---- args_owned = 0; } ! /* Fiddle args right (remove the first argidx arguments) */ if (PyTuple_Check(orig_args) && argidx > 0) { PyObject *v; From lemburg@users.sourceforge.net Wed May 2 15:21:55 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Wed, 02 May 2001 07:21:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_unicode.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20111/Lib/test Modified Files: test_unicode.py Log Message: Fix for bug #417030: "print '%*s' fails for unicode string" Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** test_unicode.py 2001/02/10 14:09:31 1.31 --- test_unicode.py 2001/05/02 14:21:52 1.32 *************** *** 367,370 **** --- 367,376 ---- verify('...%%...%%s...%s...%s...%s...%s...' % (1,2,3,u"abc") == u'...%...%s...1...2...3...abc...') verify('...%s...' % u"abc" == u'...abc...') + verify('%*s' % (5,u'abc',) == u' abc') + verify('%*s' % (-5,u'abc',) == u'abc ') + verify('%*.*s' % (5,2,u'abc',) == u' ab') + verify('%*.*s' % (5,3,u'abc',) == u' abc') + verify('%i %*.*s' % (10, 5,3,u'abc',) == u'10 abc') + verify('%i%s %*.*s' % (10, 3, 5,3,u'abc',) == u'103 abc') print 'done.' From gvanrossum@users.sourceforge.net Wed May 2 16:13:46 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 02 May 2001 08:13:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.81,2.82 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31550 Modified Files: dictobject.c Log Message: Mchael Hudson pointed out that the code for detecting changes in dictionary size was comparing ma_size, the hash table size, which is always a power of two, rather than ma_used, wich changes on each insertion or deletion. Fixed this. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.81 retrieving revision 2.82 diff -C2 -r2.81 -r2.82 *** dictobject.c 2001/05/01 12:10:21 2.81 --- dictobject.c 2001/05/02 15:13:44 2.82 *************** *** 1480,1484 **** PyObject_HEAD dictobject *di_dict; ! int di_size; int di_pos; binaryfunc di_select; --- 1480,1484 ---- PyObject_HEAD dictobject *di_dict; ! int di_used; int di_pos; binaryfunc di_select; *************** *** 1494,1498 **** Py_INCREF(dict); di->di_dict = dict; ! di->di_size = dict->ma_size; di->di_pos = 0; di->di_select = select; --- 1494,1498 ---- Py_INCREF(dict); di->di_dict = dict; ! di->di_used = dict->ma_used; di->di_pos = 0; di->di_select = select; *************** *** 1512,1516 **** PyObject *key, *value; ! if (di->di_size != di->di_dict->ma_size) { PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); --- 1512,1516 ---- PyObject *key, *value; ! if (di->di_used != di->di_dict->ma_used) { PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); *************** *** 1547,1551 **** PyObject *key, *value; ! if (di->di_size != di->di_dict->ma_size) { PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); --- 1547,1551 ---- PyObject *key, *value; ! if (di->di_used != di->di_dict->ma_used) { PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); From lemburg@users.sourceforge.net Wed May 2 18:16:18 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Wed, 02 May 2001 10:16:18 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ext ext.tex,1.95,1.96 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory usw-pr-cvs1:/tmp/cvs-serv22026/Doc/ext Modified Files: ext.tex Log Message: Added new parser markers 'et' and 'et#' which do not recode string objects but instead assume that they use the requested encoding. This is needed on Windows to enable opening files by passing in Unicode file names. Index: ext.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/ext.tex,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -r1.95 -r1.96 *** ext.tex 2001/03/19 04:19:56 1.95 --- ext.tex 2001/05/02 17:16:16 1.96 *************** *** 737,740 **** --- 737,746 ---- \cfunction{PyMem_Free()} to free the allocated buffer after usage. + \item[\samp{et} (string, Unicode object or character buffer compatible + object) {[const char *encoding, char **buffer]}] + Same as \samp{es} except that string objects are passed through without + recoding them. Instead, the implementation assumes that the string + object uses the encoding passed in as parameter. + \item[\samp{es\#} (string, Unicode object or character buffer compatible object) {[const char *encoding, char **buffer, int *buffer_length]}] *************** *** 767,770 **** --- 773,782 ---- In both cases, \var{*buffer_length} is set to the length of the encoded data without the trailing 0-byte. + + \item[\samp{et\#} (string, Unicode object or character buffer compatible + object) {[const char *encoding, char **buffer]}] + Same as \samp{es\#} except that string objects are passed through without + recoding them. Instead, the implementation assumes that the string + object uses the encoding passed in as parameter. \item[\samp{b} (integer) {[char]}] From lemburg@users.sourceforge.net Wed May 2 18:16:18 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Wed, 02 May 2001 10:16:18 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python getargs.c,2.54,2.55 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv22026/Python Modified Files: getargs.c Log Message: Added new parser markers 'et' and 'et#' which do not recode string objects but instead assume that they use the requested encoding. This is needed on Windows to enable opening files by passing in Unicode file names. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.54 retrieving revision 2.55 diff -C2 -r2.54 -r2.55 *** getargs.c 2001/02/12 22:13:26 2.54 --- getargs.c 2001/05/02 17:16:16 2.55 *************** *** 688,692 **** const char *encoding; PyObject *u, *s; ! int size; /* Get 'e' parameter: the encoding name */ --- 688,692 ---- const char *encoding; PyObject *u, *s; ! int size, recode_strings; /* Get 'e' parameter: the encoding name */ *************** *** 695,700 **** encoding = PyUnicode_GetDefaultEncoding(); ! /* Get 's' parameter: the output buffer to use */ if (*format != 's') return "(unknown parser marker combination)"; buffer = (char **)va_arg(*p_va, char **); --- 695,707 ---- encoding = PyUnicode_GetDefaultEncoding(); ! /* Get output buffer parameter: ! 's' (recode all objects via Unicode) or ! 't' (only recode non-string objects) ! */ if (*format != 's') + recode_strings = 1; + else if (*format == 't') + recode_strings = 0; + else return "(unknown parser marker combination)"; buffer = (char **)va_arg(*p_va, char **); *************** *** 703,710 **** return "(buffer is NULL)"; /* Convert object to Unicode */ u = PyUnicode_FromObject(arg); if (u == NULL) ! return "string or unicode or text buffer"; /* Encode object; use default error handling */ --- 710,724 ---- return "(buffer is NULL)"; + /* Encode object */ + if (!recode_strings && PyString_Check(arg)) { + s = arg; + Py_INCREF(s); + } + else { /* Convert object to Unicode */ u = PyUnicode_FromObject(arg); if (u == NULL) ! return \ ! "string or unicode or text buffer"; /* Encode object; use default error handling */ *************** *** 717,721 **** if (!PyString_Check(s)) { Py_DECREF(s); ! return "(encoder failed to return a string)"; } size = PyString_GET_SIZE(s); --- 731,737 ---- if (!PyString_Check(s)) { Py_DECREF(s); ! return \ ! "(encoder failed to return a string)"; ! } } size = PyString_GET_SIZE(s); From fdrake@users.sourceforge.net Wed May 2 21:18:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 02 May 2001 13:18:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv29777 Modified Files: libstdtypes.tex Log Message: Added section describing the iterator protocol. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -r1.56 -r1.57 *** libstdtypes.tex 2001/04/23 13:22:59 1.56 --- libstdtypes.tex 2001/05/02 20:18:03 1.57 *************** *** 314,317 **** --- 314,368 ---- + \subsection{Iterator Types \label{typeiter}} + + \versionadded{2.1} + \index{iterator protocol} + \index{protocol!iterator} + \index{sequence!iteration} + \index{container!iteration over} + + Python supports a concept of iteration over containers. This is + implemented using two distinct methods; these are used to allow + user-defined classes to support iteration. Sequences, described below + in more detail, always support the iteration methods. + + One method needs to be defined for container objects to provide + iteration support: + + \begin{methoddesc}[container]{__iter__}{} + Return an interator object. The object is required to support the + iterator protocol described below. If a container supports + different types of iteration, additional methods can be provided to + specifically request iterators for those iteration types. (An + example of an object supporting multiple forms of iteration would be + a tree structure which supports both breadth-first and depth-first + traversal.) This method corresponds to the \member{tp_iter} slot of + the type structure for Python objects in the Python/C API. + \end{methoddesc} + + The iterator objects themselves are required to support the following + two methods, which together form the \dfn{iterator protocol}: + + \begin{methoddesc}[iterator]{__iter__}{} + Return the iterator object itself. This is required to allow both + containers and iterators to be used with the \keyword{for} and + \keyword{in} statements. This method corresponds to the + \member{tp_iter} slot of the type structure for Python objects in + the Python/C API. + \end{methoddesc} + + \begin{methoddesc}[iteratpr]{next}{} + Return the next item from the container. If there are no further + items, raise the \exception{StopIteration} exception. This method + corresponds to the \member{tp_iternext} slot of the type structure + for Python objects in the Python/C API. + \end{methoddesc} + + Python defines several iterator objects to support iteration over + general and specific sequence types, dictionaries, and other more + specialized forms. The specific types are not important beyond their + implementation of the iterator protocol. + + \subsection{Sequence Types \label{typesseq}} From fdrake@users.sourceforge.net Wed May 2 21:19:21 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 02 May 2001 13:19:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libfuncs.tex,1.76,1.77 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv30084 Modified Files: libfuncs.tex Log Message: Update the filter() and list() descriptions to include information about the support for containers and iteration. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -r1.76 -r1.77 *** libfuncs.tex 2001/01/19 21:36:19 1.76 --- libfuncs.tex 2001/05/02 20:19:19 1.77 *************** *** 235,244 **** \begin{funcdesc}{filter}{function, list} ! Construct a list from those elements of \var{list} for which ! \var{function} returns true. If \var{list} is a string or a tuple, ! the result also has that type; otherwise it is always a list. If ! \var{function} is \code{None}, the identity function is assumed, ! i.e.\ all elements of \var{list} that are false (zero or empty) are ! removed. \end{funcdesc} --- 235,245 ---- \begin{funcdesc}{filter}{function, list} ! Construct a list from those elements of \var{list} for which ! \var{function} returns true. \var{list} may be either a sequence, a ! container which supports iteration, or an iterator, If \var{list} ! is a string or a tuple, the result also has that type; otherwise it ! is always a list. If \var{function} is \code{None}, the identity ! function is assumed, i.e.\ all elements of \var{list} that are false ! (zero or empty) are removed. \end{funcdesc} *************** *** 379,388 **** \begin{funcdesc}{list}{sequence} ! Return a list whose items are the same and in the same order as ! \var{sequence}'s items. If \var{sequence} is already a list, ! a copy is made and returned, similar to \code{\var{sequence}[:]}. ! For instance, \code{list('abc')} returns ! returns \code{['a', 'b', 'c']} and \code{list( (1, 2, 3) )} returns ! \code{[1, 2, 3]}. \end{funcdesc} --- 380,390 ---- \begin{funcdesc}{list}{sequence} ! Return a list whose items are the same and in the same order as ! \var{sequence}'s items. \var{sequence} may be either a sequence, a ! container that supports iteration, or an iterator object. If ! \var{sequence} is already a list, a copy is made and returned, ! similar to \code{\var{sequence}[:]}. For instance, ! \code{list('abc')} returns \code{['a', 'b', 'c']} and \code{list( ! (1, 2, 3) )} returns \code{[1, 2, 3]}. \end{funcdesc} From fdrake@users.sourceforge.net Wed May 2 21:20:55 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 02 May 2001 13:20:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib mailbox.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv30365 Modified Files: mailbox.py Log Message: Make the Mailbox objects support iteration -- they already had the appropriate next() method, and this is what people really want to do with these objects in practice. Index: mailbox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mailbox.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** mailbox.py 2001/04/15 13:32:27 1.30 --- mailbox.py 2001/05/02 20:20:53 1.31 *************** *** 15,18 **** --- 15,21 ---- self.factory = factory + def __iter__(self): + return self + def next(self): while 1: *************** *** 192,195 **** --- 195,201 ---- self.factory = factory + def __iter__(self): + return self + def next(self): if not self.boxes: *************** *** 219,222 **** --- 225,231 ---- self.boxes = boxes + + def __iter__(self): + return self def next(self): From fdrake@users.sourceforge.net Wed May 2 21:22:14 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 02 May 2001 13:22:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libmailbox.tex,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv30711 Modified Files: libmailbox.tex Log Message: State that Mailbox objects are iterator objects. Index: libmailbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmailbox.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** libmailbox.tex 2001/04/11 20:12:33 1.18 --- libmailbox.tex 2001/05/02 20:22:12 1.19 *************** *** 87,92 **** \subsection{Mailbox Objects \label{mailbox-objects}} ! All implementations of Mailbox objects have one externally visible ! method: \begin{methoddesc}[mailbox]{next}{} --- 87,92 ---- \subsection{Mailbox Objects \label{mailbox-objects}} ! All implementations of Mailbox objects are iterator objects, and so ! have one externally visible method: \begin{methoddesc}[mailbox]{next}{} From gvanrossum@users.sourceforge.net Wed May 2 22:24:02 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 02 May 2001 14:24:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.124.4.3,2.124.4.4 stringobject.c,2.103.2.2,2.103.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv10773 Modified Files: Tag: descr-branch object.c stringobject.c Log Message: Apply printing fixes from trunk. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.4.3 retrieving revision 2.124.4.4 diff -C2 -r2.124.4.3 -r2.124.4.4 *** object.c 2001/04/27 21:32:11 2.124.4.3 --- object.c 2001/05/02 21:24:00 2.124.4.4 *************** *** 197,221 **** op->ob_refcnt, op); else if (op->ob_type->tp_print == NULL) { ! if ((flags & Py_PRINT_RAW) ! ? (op->ob_type->tp_str == NULL) ! : (op->ob_type->tp_repr == NULL)) ! { ! fprintf(fp, "<%s object at %p>", ! op->ob_type->tp_name, op); ! } else { ! PyObject *s; ! if (flags & Py_PRINT_RAW) ! s = PyObject_Str(op); ! else ! s = PyObject_Repr(op); ! if (s == NULL) ! ret = -1; ! else { ! ret = PyObject_Print(s, fp, ! Py_PRINT_RAW); ! } ! Py_XDECREF(s); } } else --- 197,211 ---- op->ob_refcnt, op); else if (op->ob_type->tp_print == NULL) { ! PyObject *s; ! if (flags & Py_PRINT_RAW) ! s = PyObject_Str(op); ! else ! s = PyObject_Repr(op); ! if (s == NULL) ! ret = -1; else { ! ret = PyObject_Print(s, fp, Py_PRINT_RAW); } + Py_XDECREF(s); } else *************** *** 302,321 **** if (v == NULL) return PyString_FromString(""); ! else if (PyString_Check(v)) { Py_INCREF(v); return v; - } - else if (v->ob_type->tp_str != NULL) - res = (*v->ob_type->tp_str)(v); - else { - PyObject *func; - if (!PyInstance_Check(v) || - (func = PyObject_GetAttrString(v, "__str__")) == NULL) { - PyErr_Clear(); - return PyObject_Repr(v); - } - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); } if (res == NULL) return NULL; --- 292,303 ---- if (v == NULL) return PyString_FromString(""); ! if (PyString_Check(v)) { Py_INCREF(v); return v; } + if (v->ob_type->tp_str == NULL) + return PyObject_Repr(v); + + res = (*v->ob_type->tp_str)(v); if (res == NULL) return NULL; Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.103.2.2 retrieving revision 2.103.2.3 diff -C2 -r2.103.2.2 -r2.103.2.3 *** stringobject.c 2001/04/27 18:04:51 2.103.2.2 --- stringobject.c 2001/05/02 21:24:00 2.103.2.3 *************** *** 402,405 **** --- 402,412 ---- } + static PyObject * + string_str(PyObject *s) + { + Py_INCREF(s); + return s; + } + static int string_length(PyStringObject *a) *************** *** 2369,2373 **** (hashfunc)string_hash, /* tp_hash */ 0, /* tp_call */ ! 0, /* tp_str */ PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ --- 2376,2380 ---- (hashfunc)string_hash, /* tp_hash */ 0, /* tp_call */ ! (reprfunc)string_str, /* tp_str */ PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ From fdrake@users.sourceforge.net Thu May 3 05:30:47 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 02 May 2001 21:30:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libexcs.tex,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23579/lib Modified Files: libexcs.tex Log Message: Add documentation for the StopIteration exception. Index: libexcs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libexcs.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** libexcs.tex 2000/12/19 04:27:54 1.35 --- libexcs.tex 2001/05/03 04:30:45 1.36 *************** *** 238,241 **** --- 238,249 ---- \end{excdesc} + \begin{excdesc}{StopIteration} + Raised by an iterator's \method{next()} method to signal that there + are no further values. + This is derived from \exception{Exception} rather than + \exception{StandardError}, since this is not considered an error in + its normal application. + \end{excdesc} + \begin{excdesc}{SyntaxError} % XXXJH xref to these functions? From fdrake@users.sourceforge.net Thu May 3 05:39:12 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 02 May 2001 21:39:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libexcs.tex,1.36,1.37 libstdtypes.tex,1.57,1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv25077 Modified Files: libexcs.tex libstdtypes.tex Log Message: The general iteration support is part of 2.2, not 2.1 -- fixed the version annotations! Also fixed a typo noted by Neil S. Index: libexcs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libexcs.tex,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -r1.36 -r1.37 *** libexcs.tex 2001/05/03 04:30:45 1.36 --- libexcs.tex 2001/05/03 04:39:10 1.37 *************** *** 244,247 **** --- 244,248 ---- \exception{StandardError}, since this is not considered an error in its normal application. + \versionadded{2.2} \end{excdesc} Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -r1.57 -r1.58 *** libstdtypes.tex 2001/05/02 20:18:03 1.57 --- libstdtypes.tex 2001/05/03 04:39:10 1.58 *************** *** 316,320 **** \subsection{Iterator Types \label{typeiter}} ! \versionadded{2.1} \index{iterator protocol} \index{protocol!iterator} --- 316,320 ---- \subsection{Iterator Types \label{typeiter}} ! \versionadded{2.2} \index{iterator protocol} \index{protocol!iterator} *************** *** 352,356 **** \end{methoddesc} ! \begin{methoddesc}[iteratpr]{next}{} Return the next item from the container. If there are no further items, raise the \exception{StopIteration} exception. This method --- 352,356 ---- \end{methoddesc} ! \begin{methoddesc}[iterator]{next}{} Return the next item from the container. If there are no further items, raise the \exception{StopIteration} exception. This method From fdrake@users.sourceforge.net Thu May 3 05:54:43 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 02 May 2001 21:54:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib UserDict.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26938 Modified Files: UserDict.py Log Message: Added support for .iteritems(), .iterkeys(), .itervalues(). Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** UserDict.py 2001/04/21 09:13:15 1.12 --- UserDict.py 2001/05/03 04:54:41 1.13 *************** *** 23,26 **** --- 23,29 ---- def keys(self): return self.data.keys() def items(self): return self.data.items() + def iteritems(self): return self.data.iteritems() + def iterkeys(self): return self.data.iterkeys() + def itervalues(self): return self.data.itervalues() def values(self): return self.data.values() def has_key(self, key): return self.data.has_key(key) From fdrake@users.sourceforge.net Thu May 3 05:55:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 02 May 2001 21:55:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib dumbdbm.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27091 Modified Files: dumbdbm.py Log Message: Added support for .__contains__(), .__iter__(), .iterkeys(). Index: dumbdbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dumbdbm.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** dumbdbm.py 2001/03/02 06:43:49 1.10 --- dumbdbm.py 2001/05/03 04:55:47 1.11 *************** *** 136,139 **** --- 136,146 ---- return self._index.has_key(key) + def __contains__(self, key): + return self._index.has_key(key) + + def iterkeys(self): + return self._index.iterkeys() + __iter__ = iterkeys + def __len__(self): return len(self._index) *************** *** 144,148 **** ! def open(file, flag = None, mode = None): # flag, mode arguments are currently ignored return _Database(file) --- 151,155 ---- ! def open(file, flag=None, mode=None): # flag, mode arguments are currently ignored return _Database(file) From fdrake@users.sourceforge.net Thu May 3 05:58:51 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 02 May 2001 21:58:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib code.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27462 Modified Files: code.py Log Message: InteractiveInterpreter.showsyntaxerror(): When replacing the exception object, be sure we stuff the new value in sys.last_value (which we already did for the original value). Index: code.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/code.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** code.py 2001/02/09 08:56:30 1.15 --- code.py 2001/05/03 04:58:49 1.16 *************** *** 138,141 **** --- 138,142 ---- # If that failed, assume SyntaxError is a string value = msg, (filename, lineno, offset, line) + sys.last_value = value list = traceback.format_exception_only(type, value) map(self.write, list) From tim_one@users.sourceforge.net Thu May 3 08:00:34 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 00:00:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv12812/python/dist/src/Lib/test Modified Files: test_iter.py Log Message: Generalize max(seq) and min(seq) to work with iterators. NEEDS DOC CHANGES. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** test_iter.py 2001/05/02 07:39:38 1.4 --- test_iter.py 2001/05/03 07:00:32 1.5 *************** *** 320,322 **** --- 320,357 ---- self.assertEqual(filter(lambda x: not x, iter(seq)), [False]*25) + # Test max() and min()'s use of iterators. + def test_builtin_max_min(self): + self.assertEqual(max(SequenceClass(5)), 4) + self.assertEqual(min(SequenceClass(5)), 0) + self.assertEqual(max(8, -1), 8) + self.assertEqual(min(8, -1), -1) + + d = {"one": 1, "two": 2, "three": 3} + self.assertEqual(max(d), "two") + self.assertEqual(min(d), "one") + self.assertEqual(max(d.itervalues()), 3) + self.assertEqual(min(iter(d.itervalues())), 1) + + self.assertRaises(TypeError, list, list) + self.assertRaises(TypeError, list, 42) + + f = open(TESTFN, "w") + try: + f.write("medium line\n") + f.write("xtra large line\n") + f.write("itty-bitty line\n") + finally: + f.close() + f = open(TESTFN, "r") + try: + self.assertEqual(min(f), "itty-bitty line\n") + f.seek(0, 0) + self.assertEqual(max(f), "xtra large line\n") + finally: + f.close() + try: + unlink(TESTFN) + except OSError: + pass + run_unittest(TestCase) From tim_one@users.sourceforge.net Thu May 3 08:00:34 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 00:00:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.200,2.201 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv12812/python/dist/src/Python Modified Files: bltinmodule.c Log Message: Generalize max(seq) and min(seq) to work with iterators. NEEDS DOC CHANGES. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.200 retrieving revision 2.201 diff -C2 -r2.200 -r2.201 *** bltinmodule.c 2001/05/02 07:39:38 2.200 --- bltinmodule.c 2001/05/03 07:00:32 2.201 *************** *** 1445,1450 **** { int i; ! PyObject *v, *w, *x; ! PySequenceMethods *sq; if (PyTuple_Size(args) > 1) --- 1445,1449 ---- { int i; ! PyObject *v, *w, *x, *it; if (PyTuple_Size(args) > 1) *************** *** 1452,1472 **** else if (!PyArg_ParseTuple(args, "O:min/max", &v)) return NULL; ! sq = v->ob_type->tp_as_sequence; ! if (sq == NULL || sq->sq_item == NULL) { ! PyErr_SetString(PyExc_TypeError, ! "min() or max() arg must be a sequence"); return NULL; ! } ! w = NULL; for (i = 0; ; i++) { ! x = (*sq->sq_item)(v, i); /* Implies INCREF */ if (x == NULL) { ! if (PyErr_ExceptionMatches(PyExc_IndexError)) { ! PyErr_Clear(); ! break; } ! Py_XDECREF(w); ! return NULL; } if (w == NULL) w = x; --- 1451,1479 ---- else if (!PyArg_ParseTuple(args, "O:min/max", &v)) return NULL; ! ! it = PyObject_GetIter(v); ! if (it == NULL) return NULL; ! ! w = NULL; /* the result */ for (i = 0; ; i++) { ! x = PyIter_Next(it); if (x == NULL) { ! /* We're out of here in any case, but if this is a ! * StopIteration exception it's expected, but if ! * any other kind of exception it's an error. ! */ ! if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches(PyExc_StopIteration)) ! PyErr_Clear(); ! else { ! Py_XDECREF(w); ! Py_DECREF(it); ! return NULL; ! } } ! break; } + if (w == NULL) w = x; *************** *** 1479,1483 **** else if (cmp < 0) { Py_DECREF(x); ! Py_XDECREF(w); return NULL; } --- 1486,1491 ---- else if (cmp < 0) { Py_DECREF(x); ! Py_DECREF(w); ! Py_DECREF(it); return NULL; } *************** *** 1489,1492 **** --- 1497,1501 ---- PyErr_SetString(PyExc_ValueError, "min() or max() arg is an empty sequence"); + Py_DECREF(it); return w; } From tim_one@users.sourceforge.net Thu May 3 08:00:34 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 00:00:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.149,1.150 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv12812/python/dist/src/Misc Modified Files: NEWS Log Message: Generalize max(seq) and min(seq) to work with iterators. NEEDS DOC CHANGES. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.149 retrieving revision 1.150 diff -C2 -r1.149 -r1.150 *** NEWS 2001/05/02 07:39:38 1.149 --- NEWS 2001/05/03 07:00:32 1.150 *************** *** 20,23 **** --- 20,25 ---- filter() list() + max() + min() From tim_one@users.sourceforge.net Thu May 3 08:09:27 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 00:09:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14663/python/dist/src/Lib/test Modified Files: test_iter.py Log Message: Remove redundant copy+paste code. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** test_iter.py 2001/05/03 07:00:32 1.5 --- test_iter.py 2001/05/03 07:09:25 1.6 *************** *** 333,339 **** self.assertEqual(min(iter(d.itervalues())), 1) - self.assertRaises(TypeError, list, list) - self.assertRaises(TypeError, list, 42) - f = open(TESTFN, "w") try: --- 333,336 ---- From fdrake@users.sourceforge.net Thu May 3 17:04:15 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 03 May 2001 09:04:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.128,2.129 funcobject.c,2.37,2.38 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv2979 Modified Files: classobject.c funcobject.c Log Message: Since Py_TPFLAGS_HAVE_WEAKREFS is set in Py_TPFLAGS_DEFAULT, it does not need to be specified in the type structures independently. The flag exists only for binary compatibility. This is a "source cleanliness" issue and introduces no behavioral changes. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.128 retrieving revision 2.129 diff -C2 -r2.128 -r2.129 *** classobject.c 2001/04/30 14:39:18 2.128 --- classobject.c 2001/05/03 16:04:13 2.129 *************** *** 2104,2108 **** (setattrofunc)instancemethod_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC | Py_TPFLAGS_HAVE_WEAKREFS, 0, /* tp_doc */ (traverseproc)instancemethod_traverse, /* tp_traverse */ --- 2104,2108 ---- (setattrofunc)instancemethod_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ 0, /* tp_doc */ (traverseproc)instancemethod_traverse, /* tp_traverse */ Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -r2.37 -r2.38 *** funcobject.c 2001/03/23 04:19:27 2.37 --- funcobject.c 2001/05/03 16:04:13 2.38 *************** *** 321,344 **** sizeof(PyFunctionObject) + PyGC_HEAD_SIZE, 0, ! (destructor)func_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! 0, /*tp_compare*/ ! (reprfunc)func_repr, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! 0, /*tp_hash*/ ! 0, /*tp_call*/ ! 0, /*tp_str*/ ! (getattrofunc)func_getattro, /*tp_getattro*/ ! (setattrofunc)func_setattro, /*tp_setattro*/ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC | Py_TPFLAGS_HAVE_WEAKREFS, ! 0, /* tp_doc */ ! (traverseproc)func_traverse, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ offsetof(PyFunctionObject, func_weakreflist), /* tp_weaklistoffset */ }; --- 321,344 ---- sizeof(PyFunctionObject) + PyGC_HEAD_SIZE, 0, ! (destructor)func_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! (reprfunc)func_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! (getattrofunc)func_getattro, /* tp_getattro */ ! (setattrofunc)func_setattro, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)func_traverse, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ offsetof(PyFunctionObject, func_weakreflist), /* tp_weaklistoffset */ }; From fdrake@users.sourceforge.net Thu May 3 17:05:48 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 03 May 2001 09:05:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules _weakref.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv3296 Modified Files: _weakref.c Log Message: Remove an obsolete comment and a "return" before fallig off the end of a void function. Index: _weakref.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_weakref.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** _weakref.c 2001/04/13 17:15:47 1.10 --- _weakref.c 2001/05/03 16:05:46 1.11 *************** *** 737,741 **** || object->ob_refcnt != 0) { PyErr_BadInternalCall(); - /* not sure what we should return here */ return; } --- 737,740 ---- *************** *** 793,797 **** } } - return; } --- 792,795 ---- From fdrake@users.sourceforge.net Thu May 3 20:44:52 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 03 May 2001 12:44:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.126,2.127 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12831 Modified Files: object.c Log Message: Remove unnecessary intialization for the case of weakly-referencable objects; the code necessary to accomplish this is simpler and faster if confined to the object implementations, so we only do this there. This causes no behaviorial changes beyond a (very slight) speedup. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.126 retrieving revision 2.127 diff -C2 -r2.126 -r2.127 *** object.c 2001/05/01 16:53:37 2.126 --- object.c 2001/05/03 19:44:50 2.127 *************** *** 101,108 **** op->ob_type = tp; _Py_NewReference(op); - if (PyType_SUPPORTS_WEAKREFS(tp)) { - PyObject **weaklist = PyObject_GET_WEAKREFS_LISTPTR(op); - *weaklist = NULL; - } return op; } --- 101,104 ---- From fdrake@users.sourceforge.net Thu May 3 20:45:36 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 03 May 2001 12:45:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.124,2.124.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12979 Modified Files: Tag: release21-maint object.c Log Message: Remove unnecessary intialization for the case of weakly-referencable objects; the code necessary to accomplish this is simpler and faster if confined to the object implementations, so we only do this there. This causes no behaviorial changes beyond a (very slight) speedup. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124 retrieving revision 2.124.2.1 diff -C2 -r2.124 -r2.124.2.1 *** object.c 2001/03/25 19:16:13 2.124 --- object.c 2001/05/03 19:45:34 2.124.2.1 *************** *** 101,108 **** op->ob_type = tp; _Py_NewReference(op); - if (PyType_SUPPORTS_WEAKREFS(tp)) { - PyObject **weaklist = PyObject_GET_WEAKREFS_LISTPTR(op); - *weaklist = NULL; - } return op; } --- 101,104 ---- From gvanrossum@users.sourceforge.net Thu May 3 20:51:37 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 03 May 2001 12:51:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.124.4.4,2.124.4.5 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14259 Modified Files: Tag: descr-branch object.c Log Message: Get rid of the weakref related code that Fred just purged from the main trunk. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.4.4 retrieving revision 2.124.4.5 diff -C2 -r2.124.4.4 -r2.124.4.5 *** object.c 2001/05/02 21:24:00 2.124.4.4 --- object.c 2001/05/03 19:51:35 2.124.4.5 *************** *** 101,108 **** op->ob_type = tp; _Py_NewReference(op); - if (PyType_SUPPORTS_WEAKREFS(tp)) { - PyObject **weaklist = PyObject_GET_WEAKREFS_LISTPTR(op); - *weaklist = NULL; - } return op; } --- 101,104 ---- *************** *** 124,131 **** op->ob_type = tp; _Py_NewReference((PyObject *)op); - if (PyType_SUPPORTS_WEAKREFS(tp)) { - PyObject **weaklist = PyObject_GET_WEAKREFS_LISTPTR(op); - *weaklist = NULL; - } return op; } --- 120,123 ---- From fdrake@users.sourceforge.net Thu May 3 21:04:35 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 03 May 2001 13:04:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.127,2.128 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16852 Modified Files: object.c Log Message: The weakref support in PyObject_InitVar() as well; this should have come out at the same time as it did from PyObject_Init() . Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.127 retrieving revision 2.128 diff -C2 -r2.127 -r2.128 *** object.c 2001/05/03 19:44:50 2.127 --- object.c 2001/05/03 20:04:33 2.128 *************** *** 120,127 **** op->ob_type = tp; _Py_NewReference((PyObject *)op); - if (PyType_SUPPORTS_WEAKREFS(tp)) { - PyObject **weaklist = PyObject_GET_WEAKREFS_LISTPTR(op); - *weaklist = NULL; - } return op; } --- 120,123 ---- From fdrake@users.sourceforge.net Thu May 3 21:04:51 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 03 May 2001 13:04:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.124.2.1,2.124.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv16896 Modified Files: Tag: release21-maint object.c Log Message: The weakref support in PyObject_InitVar() as well; this should have come out at the same time as it did from PyObject_Init() . Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.2.1 retrieving revision 2.124.2.2 diff -C2 -r2.124.2.1 -r2.124.2.2 *** object.c 2001/05/03 19:45:34 2.124.2.1 --- object.c 2001/05/03 20:04:49 2.124.2.2 *************** *** 120,127 **** op->ob_type = tp; _Py_NewReference((PyObject *)op); - if (PyType_SUPPORTS_WEAKREFS(tp)) { - PyObject **weaklist = PyObject_GET_WEAKREFS_LISTPTR(op); - *weaklist = NULL; - } return op; } --- 120,123 ---- From akuchling@users.sourceforge.net Thu May 3 23:30:40 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Thu, 03 May 2001 15:30:40 -0700 Subject: [Python-checkins] CVS: distutils CHANGES.txt,1.20,1.21 Message-ID: Update of /cvsroot/python/distutils In directory usw-pr-cvs1:/tmp/cvs-serv12348 Modified Files: CHANGES.txt Log Message: Update changes: the compulsory version number was backed out, and I don't believe that any of the 2.1 changes broke things for Python 1.5 Index: CHANGES.txt =================================================================== RCS file: /cvsroot/python/distutils/CHANGES.txt,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** CHANGES.txt 2001/04/20 18:30:36 1.20 --- CHANGES.txt 2001/05/03 22:30:38 1.21 *************** *** 2,7 **** ------------------------------ * fixes to accommodate the major revisions made to Python's build system ! for 2.1. (This will break the Distutils for 1.5.2 and 2.0, though; ! it should be made backward compatible.) * from Thomas Heller: the installer generated by bdist_wininst now --- 2,6 ---- ------------------------------ * fixes to accommodate the major revisions made to Python's build system ! for 2.1. * from Thomas Heller: the installer generated by bdist_wininst now *************** *** 29,34 **** * applied patches from Jason Tishler to make the compiler class work with Cygwin. - - * it's now compulsory to supply a version number. * various bugfixes --- 28,31 ---- From tim_one@users.sourceforge.net Fri May 4 00:54:51 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 16:54:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29503/python/dist/src/Lib/test Modified Files: test_iter.py Log Message: Generalize map() to work with iterators. NEEDS DOC CHANGES. Possibly contentious: The first time s.next() yields StopIteration (for a given map argument s) is the last time map() *tries* s.next(). That is, if other sequence args are longer, s will never again contribute anything but None values to the result, even if trying s.next() again could yield another result. This is the same behavior map() used to have wrt IndexError, so it's the only way to be wholly backward-compatible. I'm not a fan of letting StopIteration mean "try again later" anyway. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** test_iter.py 2001/05/03 07:09:25 1.6 --- test_iter.py 2001/05/03 23:54:49 1.7 *************** *** 352,354 **** --- 352,389 ---- pass + # Test map()'s use of iterators. + def test_builtin_map(self): + self.assertEqual(map(None, SequenceClass(5)), range(5)) + self.assertEqual(map(lambda x: x+1, SequenceClass(5)), range(1, 6)) + + d = {"one": 1, "two": 2, "three": 3} + self.assertEqual(map(None, d), d.keys()) + self.assertEqual(map(lambda k, d=d: (k, d[k]), d), d.items()) + dkeys = d.keys() + expected = [(i < len(d) and dkeys[i] or None, + i, + i < len(d) and dkeys[i] or None) + for i in range(5)] + self.assertEqual(map(None, d, + SequenceClass(5), + iter(d.iterkeys())), + expected) + + f = open(TESTFN, "w") + try: + for i in range(10): + f.write("xy" * i + "\n") # line i has len 2*i+1 + finally: + f.close() + f = open(TESTFN, "r") + try: + self.assertEqual(map(len, f), range(1, 21, 2)) + f.seek(0, 0) + finally: + f.close() + try: + unlink(TESTFN) + except OSError: + pass + run_unittest(TestCase) From tim_one@users.sourceforge.net Fri May 4 00:54:51 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 16:54:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.150,1.151 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv29503/python/dist/src/Misc Modified Files: NEWS Log Message: Generalize map() to work with iterators. NEEDS DOC CHANGES. Possibly contentious: The first time s.next() yields StopIteration (for a given map argument s) is the last time map() *tries* s.next(). That is, if other sequence args are longer, s will never again contribute anything but None values to the result, even if trying s.next() again could yield another result. This is the same behavior map() used to have wrt IndexError, so it's the only way to be wholly backward-compatible. I'm not a fan of letting StopIteration mean "try again later" anyway. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.150 retrieving revision 1.151 diff -C2 -r1.150 -r1.151 *** NEWS 2001/05/03 07:00:32 1.150 --- NEWS 2001/05/03 23:54:49 1.151 *************** *** 20,23 **** --- 20,24 ---- filter() list() + map() max() min() From tim_one@users.sourceforge.net Fri May 4 00:54:51 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 16:54:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.201,2.202 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv29503/python/dist/src/Python Modified Files: bltinmodule.c Log Message: Generalize map() to work with iterators. NEEDS DOC CHANGES. Possibly contentious: The first time s.next() yields StopIteration (for a given map argument s) is the last time map() *tries* s.next(). That is, if other sequence args are longer, s will never again contribute anything but None values to the result, even if trying s.next() again could yield another result. This is the same behavior map() used to have wrt IndexError, so it's the only way to be wholly backward-compatible. I'm not a fan of letting StopIteration mean "try again later" anyway. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.201 retrieving revision 2.202 diff -C2 -r2.201 -r2.202 *** bltinmodule.c 2001/05/03 07:00:32 2.201 --- bltinmodule.c 2001/05/03 23:54:49 2.202 *************** *** 937,943 **** { typedef struct { ! PyObject *seq; ! PySequenceMethods *sqf; ! int saw_IndexError; } sequence; --- 937,942 ---- { typedef struct { ! PyObject *it; /* the iterator object */ ! int saw_StopIteration; /* bool: did the iterator end? */ } sequence; *************** *** 962,991 **** } if ((seqs = PyMem_NEW(sequence, n)) == NULL) { PyErr_NoMemory(); ! goto Fail_2; } ! /* Do a first pass to (a) verify the args are sequences; (b) set ! * len to the largest of their lengths; (c) initialize the seqs ! * descriptor vector. */ ! for (len = 0, i = 0, sqp = seqs; i < n; ++i, ++sqp) { int curlen; - PySequenceMethods *sqf; - - if ((sqp->seq = PyTuple_GetItem(args, i + 1)) == NULL) - goto Fail_2; - - sqp->saw_IndexError = 0; ! sqp->sqf = sqf = sqp->seq->ob_type->tp_as_sequence; ! if (sqf == NULL || ! sqf->sq_item == NULL) ! { static char errmsg[] = ! "argument %d to map() must be a sequence object"; char errbuf[sizeof(errmsg) + 25]; - sprintf(errbuf, errmsg, i+2); PyErr_SetString(PyExc_TypeError, errbuf); --- 961,991 ---- } + /* Get space for sequence descriptors. Must NULL out the iterator + * pointers so that jumping to Fail_2 later doesn't see trash. + */ if ((seqs = PyMem_NEW(sequence, n)) == NULL) { PyErr_NoMemory(); ! return NULL; ! } ! for (i = 0; i < n; ++i) { ! seqs[i].it = (PyObject*)NULL; ! seqs[i].saw_StopIteration = 0; } ! /* Do a first pass to obtain iterators for the arguments, and set len ! * to the largest of their lengths. */ ! len = 0; ! for (i = 0, sqp = seqs; i < n; ++i, ++sqp) { ! PyObject *curseq; int curlen; ! /* Get iterator. */ ! curseq = PyTuple_GetItem(args, i+1); ! sqp->it = PyObject_GetIter(curseq); ! if (sqp->it == NULL) { static char errmsg[] = ! "argument %d to map() must support iteration"; char errbuf[sizeof(errmsg) + 25]; sprintf(errbuf, errmsg, i+2); PyErr_SetString(PyExc_TypeError, errbuf); *************** *** 993,1057 **** } ! if (sqf->sq_length == NULL) ! /* doesn't matter -- make something up */ ! curlen = 8; ! else ! curlen = (*sqf->sq_length)(sqp->seq); if (curlen < 0) ! goto Fail_2; if (curlen > len) len = curlen; } if ((result = (PyObject *) PyList_New(len)) == NULL) goto Fail_2; ! /* Iterate over the sequences until all have raised IndexError. */ for (i = 0; ; ++i) { PyObject *alist, *item=NULL, *value; ! int any = 0; if (func == Py_None && n == 1) alist = NULL; ! else { ! if ((alist = PyTuple_New(n)) == NULL) ! goto Fail_1; ! } for (j = 0, sqp = seqs; j < n; ++j, ++sqp) { ! if (sqp->saw_IndexError) { Py_INCREF(Py_None); item = Py_None; } else { ! item = (*sqp->sqf->sq_item)(sqp->seq, i); ! if (item == NULL) { ! if (PyErr_ExceptionMatches( ! PyExc_IndexError)) ! { ! PyErr_Clear(); ! Py_INCREF(Py_None); ! item = Py_None; ! sqp->saw_IndexError = 1; ! } ! else { ! goto Fail_0; } } - else - any = 1; } ! if (!alist) break; - if (PyTuple_SetItem(alist, j, item) < 0) { - Py_DECREF(item); - goto Fail_0; - } - continue; - - Fail_0: - Py_XDECREF(alist); - goto Fail_1; } --- 993,1057 ---- } ! /* Update len. */ ! curlen = -1; /* unknown */ ! if (PySequence_Check(curseq) && ! curseq->ob_type->tp_as_sequence->sq_length) { ! curlen = PySequence_Size(curseq); ! if (curlen < 0) ! PyErr_Clear(); ! } if (curlen < 0) ! curlen = 8; /* arbitrary */ if (curlen > len) len = curlen; } + /* Get space for the result list. */ if ((result = (PyObject *) PyList_New(len)) == NULL) goto Fail_2; ! /* Iterate over the sequences until all have stopped. */ for (i = 0; ; ++i) { PyObject *alist, *item=NULL, *value; ! int numactive = 0; if (func == Py_None && n == 1) alist = NULL; ! else if ((alist = PyTuple_New(n)) == NULL) ! goto Fail_1; for (j = 0, sqp = seqs; j < n; ++j, ++sqp) { ! if (sqp->saw_StopIteration) { Py_INCREF(Py_None); item = Py_None; } else { ! item = PyIter_Next(sqp->it); ! if (item) ! ++numactive; ! else { ! /* StopIteration is *implied* by a ! * NULL return from PyIter_Next() if ! * PyErr_Occurred() is false. ! */ ! if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches( ! PyExc_StopIteration)) ! PyErr_Clear(); ! else { ! Py_XDECREF(alist); ! goto Fail_1; ! } } + Py_INCREF(Py_None); + item = Py_None; + sqp->saw_StopIteration = 1; } } ! if (alist) ! PyTuple_SET_ITEM(alist, j, item); ! else break; } *************** *** 1059,1063 **** alist = item; ! if (!any) { Py_DECREF(alist); break; --- 1059,1063 ---- alist = item; ! if (numactive == 0) { Py_DECREF(alist); break; *************** *** 1077,1085 **** if (status < 0) goto Fail_1; - } - else { - if (PyList_SetItem(result, i, value) < 0) - goto Fail_1; } } --- 1077,1083 ---- if (status < 0) goto Fail_1; } + else if (PyList_SetItem(result, i, value) < 0) + goto Fail_1; } *************** *** 1087,1098 **** goto Fail_1; ! PyMem_DEL(seqs); ! return result; Fail_1: Py_DECREF(result); Fail_2: ! if (seqs) PyMem_DEL(seqs); ! return NULL; } --- 1085,1100 ---- goto Fail_1; ! goto Succeed; Fail_1: Py_DECREF(result); Fail_2: ! result = NULL; ! Succeed: ! assert(seqs); ! for (i = 0; i < n; ++i) ! Py_XDECREF(seqs[i].it); ! PyMem_DEL(seqs); ! return result; } From tim_one@users.sourceforge.net Fri May 4 00:58:50 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 16:58:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv30981/python/dist/src/Lib/test Modified Files: test_iter.py Log Message: Purge redundant cut&paste line. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** test_iter.py 2001/05/03 23:54:49 1.7 --- test_iter.py 2001/05/03 23:58:47 1.8 *************** *** 368,372 **** SequenceClass(5), iter(d.iterkeys())), ! expected) f = open(TESTFN, "w") --- 368,372 ---- SequenceClass(5), iter(d.iterkeys())), ! expected) f = open(TESTFN, "w") *************** *** 379,383 **** try: self.assertEqual(map(len, f), range(1, 21, 2)) - f.seek(0, 0) finally: f.close() --- 379,382 ---- From tim_one@users.sourceforge.net Fri May 4 05:39:23 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 21:39:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.151,1.152 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv3611/python/dist/src/Misc Modified Files: NEWS Log Message: Generalize reduce() to work with iterators. NEEDS DOC CHANGES. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.151 retrieving revision 1.152 diff -C2 -r1.151 -r1.152 *** NEWS 2001/05/03 23:54:49 1.151 --- NEWS 2001/05/04 04:39:21 1.152 *************** *** 23,26 **** --- 23,27 ---- max() min() + reduce() From tim_one@users.sourceforge.net Fri May 4 05:39:23 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 21:39:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.202,2.203 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv3611/python/dist/src/Python Modified Files: bltinmodule.c Log Message: Generalize reduce() to work with iterators. NEEDS DOC CHANGES. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.202 retrieving revision 2.203 diff -C2 -r2.202 -r2.203 *** bltinmodule.c 2001/05/03 23:54:49 2.202 --- bltinmodule.c 2001/05/04 04:39:21 2.203 *************** *** 1852,1858 **** builtin_reduce(PyObject *self, PyObject *args) { ! PyObject *seq, *func, *result = NULL; ! PySequenceMethods *sqf; ! register int i; if (!PyArg_ParseTuple(args, "OO|O:reduce", &func, &seq, &result)) --- 1852,1856 ---- builtin_reduce(PyObject *self, PyObject *args) { ! PyObject *seq, *func, *result = NULL, *it; if (!PyArg_ParseTuple(args, "OO|O:reduce", &func, &seq, &result)) *************** *** 1861,1868 **** Py_INCREF(result); ! sqf = seq->ob_type->tp_as_sequence; ! if (sqf == NULL || sqf->sq_item == NULL) { PyErr_SetString(PyExc_TypeError, ! "reduce() arg 2 must be a sequence"); return NULL; } --- 1859,1867 ---- Py_INCREF(result); ! it = PyObject_GetIter(seq); ! if (it == NULL) { PyErr_SetString(PyExc_TypeError, ! "reduce() arg 2 must support iteration"); ! Py_XDECREF(result); return NULL; } *************** *** 1871,1875 **** goto Fail; ! for (i = 0; ; ++i) { PyObject *op2; --- 1870,1874 ---- goto Fail; ! for (;;) { PyObject *op2; *************** *** 1880,1889 **** } ! if ((op2 = (*sqf->sq_item)(seq, i)) == NULL) { ! if (PyErr_ExceptionMatches(PyExc_IndexError)) { ! PyErr_Clear(); ! break; } ! goto Fail; } --- 1879,1894 ---- } ! op2 = PyIter_Next(it); ! if (op2 == NULL) { ! /* StopIteration is *implied* by a NULL return from ! * PyIter_Next() if PyErr_Occurred() is false. ! */ ! if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches(PyExc_StopIteration)) ! PyErr_Clear(); ! else ! goto Fail; } ! break; } *************** *** 1904,1907 **** --- 1909,1913 ---- "reduce() of empty sequence with no initial value"); + Py_DECREF(it); return result; *************** *** 1909,1912 **** --- 1915,1919 ---- Py_XDECREF(args); Py_XDECREF(result); + Py_DECREF(it); return NULL; } From tim_one@users.sourceforge.net Fri May 4 05:39:23 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 21:39:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv3611/python/dist/src/Lib/test Modified Files: test_iter.py Log Message: Generalize reduce() to work with iterators. NEEDS DOC CHANGES. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** test_iter.py 2001/05/03 23:58:47 1.8 --- test_iter.py 2001/05/04 04:39:21 1.9 *************** *** 386,388 **** --- 386,401 ---- pass + # Test reduces()'s use of iterators. + def test_builtin_reduce(self): + from operator import add + self.assertEqual(reduce(add, SequenceClass(5)), 10) + self.assertEqual(reduce(add, SequenceClass(5), 42), 52) + self.assertRaises(TypeError, reduce, add, SequenceClass(0)) + self.assertEqual(reduce(add, SequenceClass(0), 42), 42) + self.assertEqual(reduce(add, SequenceClass(1)), 0) + self.assertEqual(reduce(add, SequenceClass(1), 42), 42) + + d = {"one": 1, "two": 2, "three": 3} + self.assertEqual(reduce(add, d), "".join(d.keys())) + run_unittest(TestCase) From tim_one@users.sourceforge.net Fri May 4 05:43:44 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 03 May 2001 21:43:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.152,1.153 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv4175/python/dist/src/Misc Modified Files: NEWS Log Message: Added reminders to make some remaining functions iterator-friendly. Feel free to do one! Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -r1.152 -r1.153 *** NEWS 2001/05/04 04:39:21 1.152 --- NEWS 2001/05/04 04:43:42 1.153 *************** *** 24,28 **** min() reduce() ! What's New in Python 2.1 (final)? --- 24,30 ---- min() reduce() ! XXX TODO string.join(), unicode.join() ! XXX TODO tuple() ! XXX TODO zip() What's New in Python 2.1 (final)? From gvanrossum@users.sourceforge.net Fri May 4 14:40:21 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 06:40:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.153,1.154 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv20359 Modified Files: NEWS Log Message: Add TODO item about x in y -- this should use iterators too, IMO. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -r1.153 -r1.154 *** NEWS 2001/05/04 04:43:42 1.153 --- NEWS 2001/05/04 13:40:18 1.154 *************** *** 27,30 **** --- 27,31 ---- XXX TODO tuple() XXX TODO zip() + XXX TODO 'x in y' (!) (?) What's New in Python 2.1 (final)? From gvanrossum@users.sourceforge.net Fri May 4 17:44:55 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 09:44:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include object.h,2.79.2.3,2.79.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv27155 Modified Files: Tag: descr-branch object.h Log Message: Add dummy versions of PyType_IS_GC(), PyObject_IS_GC(), PyObject_AS_GC(), PyObject_FROM_GC(), so that idiomatic code using these doesn't have to be inside #ifdef WITH_CYCLE_GC. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.79.2.3 retrieving revision 2.79.2.4 diff -C2 -r2.79.2.3 -r2.79.2.4 *** object.h 2001/04/29 14:53:55 2.79.2.3 --- object.h 2001/05/04 16:44:53 2.79.2.4 *************** *** 266,270 **** --- 266,272 ---- descrgetfunc tp_descr_get; descrsetfunc tp_descr_set; + unaryfunc tp_construct; + #ifdef COUNT_ALLOCS /* these must be last and never explicitly initialized */ *************** *** 276,282 **** } PyTypeObject; extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of type objects */ ! #define PyType_Check(op) ((op)->ob_type == &PyType_Type) extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *); --- 278,290 ---- } PyTypeObject; + + /* Generic type check */ + extern DL_IMPORT(int) _PyObject_TypeCheck(PyObject *, PyTypeObject *); + #define PyObject_TypeCheck(ob, tp) \ + ((ob)->ob_type == (tp) || _PyObject_TypeCheck(ob, tp)) + extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of type objects */ ! #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type) extern DL_IMPORT(int) PyType_InitDict(PyTypeObject *); From gvanrossum@users.sourceforge.net Fri May 4 17:48:10 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 09:48:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include objimpl.h,2.34,2.34.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv27785 Modified Files: Tag: descr-branch objimpl.h Log Message: Oops. The previous checkin comment (to object.h) was for this file. Repeating it here: Add dummy versions of PyType_IS_GC(), PyObject_IS_GC(), PyObject_AS_GC(), PyObject_FROM_GC(), so that idiomatic code using these doesn't have to be inside #ifdef WITH_CYCLE_GC. The object.h checkin should have read: - Add tp_construct slot, to initialize (and optionally allocate) a new instance. - Add API for type checking that supports subtypes: PyObject_TypeCheck(). (Depends on changes in object.c.) - Use PyObject_TypeCheck() for PyType_Check(). Index: objimpl.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/objimpl.h,v retrieving revision 2.34 retrieving revision 2.34.4.1 diff -C2 -r2.34 -r2.34.4.1 *** objimpl.h 2001/03/22 18:26:47 2.34 --- objimpl.h 2001/05/04 16:48:08 2.34.4.1 *************** *** 237,241 **** #define PyObject_AS_GC(op) (op) #define PyObject_FROM_GC(op) (op) ! #else --- 237,245 ---- #define PyObject_AS_GC(op) (op) #define PyObject_FROM_GC(op) (op) ! #define PyType_IS_GC(t) 0 ! #define PyObject_IS_GC(o) 0 ! #define PyObject_AS_GC(o) (o) ! #define PyObject_FROM_GC(o) (o) ! #else From gvanrossum@users.sourceforge.net Fri May 4 17:50:24 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 09:50:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.124.4.5,2.124.4.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28044 Modified Files: Tag: descr-branch object.c Log Message: - Remove now-redundant #ifdef WITH_CYCLE_GCs. - Add _PyObject_TypeCheck(), support for PyObject_TypeCheck(). - Disambiguate a complex Boolean expression in debug-only code. (Yes I had to use some heavy-duty debugging tools to figure out a simple problem. :-) Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.4.5 retrieving revision 2.124.4.6 diff -C2 -r2.124.4.5 -r2.124.4.6 *** object.c 2001/05/03 19:51:35 2.124.4.5 --- object.c 2001/05/04 16:50:22 2.124.4.6 *************** *** 94,101 **** return op; } - #ifdef WITH_CYCLE_GC if (PyType_IS_GC(tp)) op = (PyObject *) PyObject_FROM_GC(op); - #endif /* Any changes should be reflected in PyObject_INIT (objimpl.h) */ op->ob_type = tp; --- 94,99 ---- *************** *** 112,119 **** return op; } - #ifdef WITH_CYCLE_GC if (PyType_IS_GC(tp)) op = (PyVarObject *) PyObject_FROM_GC(op); - #endif /* Any changes should be reflected in PyObject_INIT_VAR */ op->ob_size = size; --- 110,115 ---- *************** *** 130,137 **** if (op == NULL) return PyErr_NoMemory(); - #ifdef WITH_CYCLE_GC if (PyType_IS_GC(tp)) op = (PyObject *) PyObject_FROM_GC(op); - #endif return PyObject_INIT(op, tp); } --- 126,131 ---- *************** *** 144,151 **** if (op == NULL) return (PyVarObject *)PyErr_NoMemory(); - #ifdef WITH_CYCLE_GC if (PyType_IS_GC(tp)) op = (PyVarObject *) PyObject_FROM_GC(op); - #endif return PyObject_INIT_VAR(op, tp, size); } --- 138,143 ---- *************** *** 154,162 **** _PyObject_Del(PyObject *op) { - #ifdef WITH_CYCLE_GC if (op && PyType_IS_GC(op->ob_type)) { op = (PyObject *) PyObject_AS_GC(op); } - #endif PyObject_FREE(op); } --- 146,152 ---- *************** *** 1240,1243 **** --- 1230,1251 ---- + /* type test with subclassing support */ + + int + _PyObject_TypeCheck(PyObject *obj, PyTypeObject *type) + { + PyTypeObject *tp = obj->ob_type; + + do { + if (tp == type) + return 1; + if (!PyType_HasFeature(tp, Py_TPFLAGS_HAVE_CLASS)) + return 0; + tp = tp->tp_base; + } while (tp != NULL); + return 0; + } + + /* NoObject is usable as a non-NULL undefined value, used by the macro None. *************** *** 1406,1410 **** for (i = 0; (n == 0 || i < n) && op != &refchain; i++) { while (op == self || op == args || op == res || op == t || ! t != NULL && op->ob_type != (PyTypeObject *) t) { op = op->_ob_next; if (op == &refchain) --- 1414,1418 ---- for (i = 0; (n == 0 || i < n) && op != &refchain; i++) { while (op == self || op == args || op == res || op == t || ! (t != NULL && op->ob_type != (PyTypeObject *) t)) { op = op->_ob_next; if (op == &refchain) From gvanrossum@users.sourceforge.net Fri May 4 17:51:42 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 09:51:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib types.py,1.14,1.14.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28240 Modified Files: Tag: descr-branch types.py Log Message: Add namew for new types: DictIterType, SequenceIterType, FunctionIterType, DictProxyType. Index: types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/types.py,v retrieving revision 1.14 retrieving revision 1.14.10.1 diff -C2 -r1.14 -r1.14.10.1 *** types.py 2000/03/10 23:18:11 1.14 --- types.py 2001/05/04 16:51:40 1.14.10.1 *************** *** 66,68 **** --- 66,73 ---- EllipsisType = type(Ellipsis) + DictIterType = type(iter({})) + SequenceIterType = type(iter([])) + FunctionIterType = type(iter(lambda: 0, 0)) + DictProxyType = type(TypeType.__dict__) + del sys, _f, _C, _x # Not for export From gvanrossum@users.sourceforge.net Fri May 4 17:52:47 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 09:52:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.60,2.60.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28365 Modified Files: Tag: descr-branch abstract.c Log Message: Use PyObject_TypeCheck() in PyObject_IsInstance() when cls is a type. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.60 retrieving revision 2.60.2.1 diff -C2 -r2.60 -r2.60.2.1 *** abstract.c 2001/04/23 14:08:49 2.60 --- abstract.c 2001/05/04 16:52:44 2.60.2.1 *************** *** 1694,1698 **** } else if (PyType_Check(cls)) { ! retval = ((PyObject *)(inst->ob_type) == cls); } else if (!PyInstance_Check(inst)) { --- 1694,1698 ---- } else if (PyType_Check(cls)) { ! retval = PyObject_TypeCheck(inst, (PyTypeObject *)cls); } else if (!PyInstance_Check(inst)) { From gvanrossum@users.sourceforge.net Fri May 4 18:09:40 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 10:09:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.8,2.16.8.9 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31686 Modified Files: Tag: descr-branch typeobject.c Log Message: Basic support for single inheritance at the C level. NOTE: This only works for base classes that support subtyping. This requires a tp_construct slot that takes an already-allocated object as first argument. I'll check in experimental support for subclassing list and dict next. Instructions: Define and initialize a static type struct like normal, but leave most slots empty. Put the address of the base class in your tp_base slot. Call PyType_InitDict() for your type *before creating the first instance*. This will copy all the slots from the base class into your derived class. It will also initialize your tp_dict. To create an instance, use PyObject_CallObject() to call your type object. I'll check in an example module soon. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.8 retrieving revision 2.16.8.9 diff -C2 -r2.16.8.8 -r2.16.8.9 *** typeobject.c 2001/05/01 21:04:21 2.16.8.8 --- typeobject.c 2001/05/04 17:09:38 2.16.8.9 *************** *** 14,18 **** type_bases(PyTypeObject *type, void *context) { ! return PyTuple_New(0); } --- 14,21 ---- type_bases(PyTypeObject *type, void *context) { ! if (type->tp_base == NULL) ! return PyTuple_New(0); ! else ! return Py_BuildValue("(O)", type->tp_base); } *************** *** 49,52 **** --- 52,84 ---- static PyObject * + type_call(PyTypeObject *type, PyObject *args, PyObject *kwds) + { + char *dummy = NULL; + PyObject *obj, *res; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", &dummy)) + return NULL; + + if (type->tp_construct == NULL) { + PyErr_Format(PyExc_TypeError, + "cannot construct '%.100s' instances", + type->tp_name); + return NULL; + } + obj = PyObject_New(PyObject, type); + if (obj == NULL) + return NULL; + res = (type->tp_construct)(obj); + if (res != obj) { + Py_DECREF(obj); + if (res == NULL) + return NULL; + } + if (PyType_IS_GC(type)) + PyObject_GC_Init(res); + return res; + } + + static PyObject * type_getattro(PyTypeObject *type, PyObject *name) { *************** *** 108,112 **** 0, /* tp_as_mapping */ 0, /* tp_hash */ ! 0, /* tp_call */ 0, /* tp_str */ (getattrofunc)type_getattro, /* tp_getattro */ --- 140,144 ---- 0, /* tp_as_mapping */ 0, /* tp_hash */ ! (ternaryfunc)type_call, /* tp_call */ 0, /* tp_str */ (getattrofunc)type_getattro, /* tp_getattro */ *************** *** 211,222 **** staticforward int add_operators(PyTypeObject *); int PyType_InitDict(PyTypeObject *type) { PyObject *dict; if (type->tp_dict != NULL) return 0; ! dict = PyDict_New(); if (dict == NULL) return -1; --- 243,409 ---- staticforward int add_operators(PyTypeObject *); + static int + inherit_slots(PyTypeObject *type, PyTypeObject *base) + { + #undef COPYSLOT + #undef COPYNUM + #undef COPYSEQ + #undef COPYMAP + #define COPYSLOT(SLOT) \ + if (!type->SLOT) type->SLOT = base->SLOT + + #define COPYNUM(SLOT) COPYSLOT(tp_as_number->SLOT) + #define COPYSEQ(SLOT) COPYSLOT(tp_as_sequence->SLOT) + #define COPYMAP(SLOT) COPYSLOT(tp_as_mapping->SLOT) + + if (type->tp_as_number == NULL) + type->tp_as_number = base->tp_as_number; + else if (base->tp_as_number) { + COPYNUM(nb_add); + COPYNUM(nb_subtract); + COPYNUM(nb_multiply); + COPYNUM(nb_divide); + COPYNUM(nb_remainder); + COPYNUM(nb_divmod); + COPYNUM(nb_power); + COPYNUM(nb_negative); + COPYNUM(nb_positive); + COPYNUM(nb_absolute); + COPYNUM(nb_nonzero); + COPYNUM(nb_invert); + COPYNUM(nb_lshift); + COPYNUM(nb_rshift); + COPYNUM(nb_and); + COPYNUM(nb_xor); + COPYNUM(nb_or); + COPYNUM(nb_coerce); + COPYNUM(nb_int); + COPYNUM(nb_long); + COPYNUM(nb_float); + COPYNUM(nb_oct); + COPYNUM(nb_hex); + COPYNUM(nb_inplace_add); + COPYNUM(nb_inplace_subtract); + COPYNUM(nb_inplace_multiply); + COPYNUM(nb_inplace_divide); + COPYNUM(nb_inplace_remainder); + COPYNUM(nb_inplace_power); + COPYNUM(nb_inplace_lshift); + COPYNUM(nb_inplace_rshift); + COPYNUM(nb_inplace_and); + COPYNUM(nb_inplace_xor); + COPYNUM(nb_inplace_or); + } + + if (type->tp_as_sequence == NULL) + type->tp_as_sequence = base->tp_as_sequence; + else if (base->tp_as_sequence) { + COPYSEQ(sq_length); + COPYSEQ(sq_concat); + COPYSEQ(sq_repeat); + COPYSEQ(sq_item); + COPYSEQ(sq_slice); + COPYSEQ(sq_ass_item); + COPYSEQ(sq_ass_slice); + COPYSEQ(sq_contains); + COPYSEQ(sq_inplace_concat); + COPYSEQ(sq_inplace_repeat); + } + + if (type->tp_as_mapping == NULL) + type->tp_as_mapping = base->tp_as_mapping; + else if (base->tp_as_mapping) { + COPYMAP(mp_length); + COPYMAP(mp_subscript); + COPYMAP(mp_ass_subscript); + } + + /* Special flag magic */ + if (!type->tp_as_buffer && base->tp_as_buffer) { + type->tp_flags &= ~Py_TPFLAGS_HAVE_GETCHARBUFFER; + type->tp_flags |= + base->tp_flags & Py_TPFLAGS_HAVE_GETCHARBUFFER; + } + if (!type->tp_as_sequence && base->tp_as_sequence) { + type->tp_flags &= ~Py_TPFLAGS_HAVE_SEQUENCE_IN; + type->tp_flags |= base->tp_flags & Py_TPFLAGS_HAVE_SEQUENCE_IN; + } + if (!(type->tp_flags & Py_TPFLAGS_GC) && + (base->tp_flags & Py_TPFLAGS_GC) && + (type->tp_flags & Py_TPFLAGS_HAVE_RICHCOMPARE/*GC slots exist*/) && + (!type->tp_traverse && !type->tp_clear)) { + type->tp_flags |= Py_TPFLAGS_GC; + type->tp_basicsize += PyGC_HEAD_SIZE; + COPYSLOT(tp_traverse); + COPYSLOT(tp_clear); + } + if ((type->tp_flags & Py_TPFLAGS_HAVE_INPLACEOPS) != + (base->tp_flags & Py_TPFLAGS_HAVE_INPLACEOPS)) { + if ((!type->tp_as_number && base->tp_as_number) || + (!type->tp_as_sequence && base->tp_as_sequence)) { + type->tp_flags &= ~Py_TPFLAGS_HAVE_INPLACEOPS; + if (!type->tp_as_number && !type->tp_as_sequence) { + type->tp_flags |= base->tp_flags & + Py_TPFLAGS_HAVE_INPLACEOPS; + } + } + /* Wow */ + } + if (!type->tp_as_number && base->tp_as_number) { + type->tp_flags &= ~Py_TPFLAGS_CHECKTYPES; + type->tp_flags |= base->tp_flags & Py_TPFLAGS_CHECKTYPES; + } + + COPYSLOT(tp_name); + COPYSLOT(tp_basicsize); + COPYSLOT(tp_itemsize); + COPYSLOT(tp_dealloc); + COPYSLOT(tp_print); + COPYSLOT(tp_getattr); + COPYSLOT(tp_setattr); + COPYSLOT(tp_compare); + COPYSLOT(tp_repr); + COPYSLOT(tp_hash); + COPYSLOT(tp_call); + COPYSLOT(tp_str); + COPYSLOT(tp_getattro); + COPYSLOT(tp_setattro); + COPYSLOT(tp_as_buffer); + COPYSLOT(tp_flags); + COPYSLOT(tp_doc); + if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_RICHCOMPARE) { + COPYSLOT(tp_richcompare); + } + if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_WEAKREFS) { + COPYSLOT(tp_weaklistoffset); + } + if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_ITER) { + COPYSLOT(tp_iter); + COPYSLOT(tp_iternext); + } + if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_CLASS) { + COPYSLOT(tp_descr_get); + COPYSLOT(tp_descr_set); + COPYSLOT(tp_construct); + } + + return 0; + } + int PyType_InitDict(PyTypeObject *type) { PyObject *dict; + PyTypeObject *base = type->tp_base; if (type->tp_dict != NULL) return 0; ! if (base) { ! if (PyType_InitDict(base) < 0) ! return -1; ! dict = PyDict_Copy(base->tp_dict); ! } ! else ! dict = PyDict_New(); if (dict == NULL) return -1; *************** *** 246,249 **** --- 433,443 ---- return -1; } + + /* Inherit base class slots and methods */ + if (base) { + if (inherit_slots(type, base) < 0) + return -1; + } + return 0; } From gvanrossum@users.sourceforge.net Fri May 4 18:12:56 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 10:12:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects listobject.c,2.92.6.2,2.92.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv32430/Objects Modified Files: Tag: descr-branch listobject.c Log Message: Make lists subclassable. Add code that frees ob_item when empty. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.92.6.2 retrieving revision 2.92.6.3 diff -C2 -r2.92.6.2 -r2.92.6.3 *** listobject.c 2001/04/27 18:04:51 2.92.6.2 --- listobject.c 2001/05/04 17:12:53 2.92.6.3 *************** *** 459,462 **** --- 459,466 ---- PyMem_DEL(recycle); } + if (a->ob_size == 0 && a->ob_item != NULL) { + PyMem_FREE(a->ob_item); + a->ob_item = NULL; + } return 0; #undef b *************** *** 1491,1494 **** --- 1495,1508 ---- } + static PyObject * + list_construct(PyListObject *self) + { + if (self == NULL) + return PyList_New(0); + self->ob_size = 0; + self->ob_item = NULL; + return (PyObject *)self; + } + static char append_doc[] = "L.append(object) -- append object to end"; *************** *** 1570,1573 **** --- 1584,1590 ---- 0, /* tp_base */ 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + (unaryfunc)list_construct, /* tp_construct */ }; *************** *** 1650,1653 **** --- 1667,1673 ---- 0, /* tp_base */ 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + (unaryfunc)list_construct, /* tp_construct */ /* NOTE: This is *not* the standard list_type struct! */ }; From gvanrossum@users.sourceforge.net Fri May 4 18:12:56 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 10:12:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include listobject.h,2.21,2.21.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv32430/Include Modified Files: Tag: descr-branch listobject.h Log Message: Make lists subclassable. Add code that frees ob_item when empty. Index: listobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/listobject.h,v retrieving revision 2.21 retrieving revision 2.21.8.1 diff -C2 -r2.21 -r2.21.8.1 *** listobject.h 2000/09/01 23:29:26 2.21 --- listobject.h 2001/05/04 17:12:53 2.21.8.1 *************** *** 27,31 **** extern DL_IMPORT(PyTypeObject) PyList_Type; ! #define PyList_Check(op) ((op)->ob_type == &PyList_Type) extern DL_IMPORT(PyObject *) PyList_New(int size); --- 27,31 ---- extern DL_IMPORT(PyTypeObject) PyList_Type; ! #define PyList_Check(op) PyObject_TypeCheck(op, &PyList_Type) extern DL_IMPORT(PyObject *) PyList_New(int size); From gvanrossum@users.sourceforge.net Fri May 4 18:15:04 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 10:15:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include dictobject.h,2.20,2.20.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv414/Include Modified Files: Tag: descr-branch dictobject.h Log Message: Make dicts subclassable. This required publishing PyDictObject. Index: dictobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/dictobject.h,v retrieving revision 2.20 retrieving revision 2.20.8.1 diff -C2 -r2.20 -r2.20.8.1 *** dictobject.h 2000/09/01 23:29:26 2.20 --- dictobject.h 2001/05/04 17:15:02 2.20.8.1 *************** *** 8,14 **** /* Dictionary object type -- mapping from hashable object to object */ extern DL_IMPORT(PyTypeObject) PyDict_Type; ! #define PyDict_Check(op) ((op)->ob_type == &PyDict_Type) extern DL_IMPORT(PyObject *) PyDict_New(void); --- 8,66 ---- /* Dictionary object type -- mapping from hashable object to object */ + /* + There are three kinds of slots in the table: + + 1. Unused. me_key == me_value == NULL + Does not hold an active (key, value) pair now and never did. Unused can + transition to Active upon key insertion. This is the only case in which + me_key is NULL, and is each slot's initial state. + + 2. Active. me_key != NULL and me_key != dummy and me_value != NULL + Holds an active (key, value) pair. Active can transition to Dummy upon + key deletion. This is the only case in which me_value != NULL. + + 3. Dummy. me_key == dummy and me_value == NULL + Previously held an active (key, value) pair, but that was deleted and an + active pair has not yet overwritten the slot. Dummy can transition to + Active upon key insertion. Dummy slots cannot be made Unused again + (cannot have me_key set to NULL), else the probe sequence in case of + collision would have no way to know they were once active. + + Note: .popitem() abuses the me_hash field of an Unused or Dummy slot to + hold a search finger. The me_hash field of Unused or Dummy slots has no + meaning otherwise. + */ + typedef struct { + long me_hash; /* cached hash code of me_key */ + PyObject *me_key; + PyObject *me_value; + #ifdef USE_CACHE_ALIGNED + long aligner; + #endif + } PyDictEntry; + + /* + To ensure the lookup algorithm terminates, there must be at least one Unused + slot (NULL key) in the table. + The value ma_fill is the number of non-NULL keys (sum of Active and Dummy); + ma_used is the number of non-NULL, non-dummy keys (== the number of non-NULL + values == the number of Active items). + To avoid slowing down lookups on a near-full table, we resize the table when + it's two-thirds full. + */ + typedef struct _dictobject PyDictObject; + struct _dictobject { + PyObject_HEAD + int ma_fill; /* # Active + # Dummy */ + int ma_used; /* # Active */ + int ma_size; /* total # slots in ma_table */ + int ma_poly; /* appopriate entry from polys vector */ + PyDictEntry *ma_table; + PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash); + }; + extern DL_IMPORT(PyTypeObject) PyDict_Type; ! #define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type) extern DL_IMPORT(PyObject *) PyDict_New(void); From gvanrossum@users.sourceforge.net Fri May 4 18:15:04 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 10:15:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.80.2.3,2.80.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv414/Objects Modified Files: Tag: descr-branch dictobject.c Log Message: Make dicts subclassable. This required publishing PyDictObject. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.80.2.3 retrieving revision 2.80.2.4 diff -C2 -r2.80.2.3 -r2.80.2.4 *** dictobject.c 2001/04/30 14:24:45 2.80.2.3 --- dictobject.c 2001/05/04 17:15:02 2.80.2.4 *************** *** 4,7 **** --- 4,9 ---- #include "Python.h" + typedef PyDictEntry dictentry; + typedef PyDictObject dictobject; /* *************** *** 54,109 **** static PyObject *dummy; /* Initialized by first call to newdictobject() */ - /* - There are three kinds of slots in the table: - - 1. Unused. me_key == me_value == NULL - Does not hold an active (key, value) pair now and never did. Unused can - transition to Active upon key insertion. This is the only case in which - me_key is NULL, and is each slot's initial state. - - 2. Active. me_key != NULL and me_key != dummy and me_value != NULL - Holds an active (key, value) pair. Active can transition to Dummy upon - key deletion. This is the only case in which me_value != NULL. - - 3. Dummy. me_key == dummy and me_value == NULL - Previously held an active (key, value) pair, but that was deleted and an - active pair has not yet overwritten the slot. Dummy can transition to - Active upon key insertion. Dummy slots cannot be made Unused again - (cannot have me_key set to NULL), else the probe sequence in case of - collision would have no way to know they were once active. - - Note: .popitem() abuses the me_hash field of an Unused or Dummy slot to - hold a search finger. The me_hash field of Unused or Dummy slots has no - meaning otherwise. - */ - typedef struct { - long me_hash; /* cached hash code of me_key */ - PyObject *me_key; - PyObject *me_value; - #ifdef USE_CACHE_ALIGNED - long aligner; - #endif - } dictentry; - - /* - To ensure the lookup algorithm terminates, there must be at least one Unused - slot (NULL key) in the table. - The value ma_fill is the number of non-NULL keys (sum of Active and Dummy); - ma_used is the number of non-NULL, non-dummy keys (== the number of non-NULL - values == the number of Active items). - To avoid slowing down lookups on a near-full table, we resize the table when - it's two-thirds full. - */ - typedef struct dictobject dictobject; - struct dictobject { - PyObject_HEAD - int ma_fill; /* # Active + # Dummy */ - int ma_used; /* # Active */ - int ma_size; /* total # slots in ma_table */ - int ma_poly; /* appopriate entry from polys vector */ - dictentry *ma_table; - dictentry *(*ma_lookup)(dictobject *mp, PyObject *key, long hash); - }; - /* forward declarations */ static dictentry * --- 56,59 ---- *************** *** 1321,1324 **** --- 1271,1291 ---- staticforward PyObject *dictiter_new(dictobject *); + static PyObject * + dict_construct(PyDictObject *self) + { + if (self == NULL) + return PyDict_New(); + self->ma_size = 0; + self->ma_poly = 0; + self->ma_table = NULL; + self->ma_fill = 0; + self->ma_used = 0; + self->ma_lookup = lookdict_string; + #ifdef SHOW_CONVERSION_COUNTS + ++created; + #endif + return (PyObject *)self; + } + PyTypeObject PyDict_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 1355,1358 **** --- 1322,1328 ---- 0, /* tp_base */ 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + (unaryfunc)dict_construct, /* tp_construct */ }; From gvanrossum@users.sourceforge.net Fri May 4 18:19:12 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 10:19:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules spam.c,NONE,1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv1148/Modules Added Files: Tag: descr-branch spam.c Log Message: Example of subtyping existing types. This modules subtypes list and dict (separately). Note that I forgot to write in my instructions that in order to be subtyped, a type must publish its structure, and the subtype must define its own type to begin with a the base class's structure. --- NEW FILE: spam.c --- #include "Python.h" /* spamlist -- a list subtype */ typedef struct { PyListObject list; int state; } spamlistobject; static PyObject * spamlist_getstate(spamlistobject *self, PyObject *args) { if (!PyArg_ParseTuple(args, ":getstate")) return NULL; return PyInt_FromLong(self->state); } static PyObject * spamlist_setstate(spamlistobject *self, PyObject *args) { int state; if (!PyArg_ParseTuple(args, "i:setstate", &state)) return NULL; self->state = state; Py_INCREF(Py_None); return Py_None; } static PyMethodDef spamlist_methods[] = { {"getstate", (PyCFunction)spamlist_getstate, METH_VARARGS, "getstate() -> state"}, {"setstate", (PyCFunction)spamlist_setstate, METH_VARARGS, "setstate(state)"}, {0}, }; staticforward PyTypeObject spamlist_type; static PyObject * spamlist_construct(spamlistobject *arg) { spamlistobject *self; if (arg != NULL) self = arg; else { self = PyObject_New(spamlistobject, &spamlist_type); if (self == NULL) return NULL; } if (PyList_Type.tp_construct((PyObject *)self) == NULL) { if (self != arg) PyObject_Del(self); return NULL; } self->state = 0; return (PyObject *)self; } static PyTypeObject spamlist_type = { PyObject_HEAD_INIT(&PyType_Type) 0, "spamlist", sizeof(spamlistobject), 0, 0, /* 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 */ PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ 0, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ spamlist_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyList_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ (unaryfunc)spamlist_construct, /* tp_construct */ }; static PyObject * spamlist_new(void) { return PyObject_CallObject((PyObject *) &spamlist_type, NULL); } /* spamdict -- a dictf subtype */ typedef struct { PyDictObject dict; int state; } spamdictobject; static PyObject * spamdict_getstate(spamdictobject *self, PyObject *args) { if (!PyArg_ParseTuple(args, ":getstate")) return NULL; return PyInt_FromLong(self->state); } static PyObject * spamdict_setstate(spamdictobject *self, PyObject *args) { int state; if (!PyArg_ParseTuple(args, "i:setstate", &state)) return NULL; self->state = state; Py_INCREF(Py_None); return Py_None; } static PyMethodDef spamdict_methods[] = { {"getstate", (PyCFunction)spamdict_getstate, METH_VARARGS, "getstate() -> state"}, {"setstate", (PyCFunction)spamdict_setstate, METH_VARARGS, "setstate(state)"}, {0}, }; staticforward PyTypeObject spamdict_type; static PyObject * spamdict_construct(spamdictobject *arg) { spamdictobject *self; if (arg != NULL) self = arg; else { self = PyObject_New(spamdictobject, &spamdict_type); if (self == NULL) return NULL; } if (PyDict_Type.tp_construct((PyObject *)self) == NULL) { if (self != arg) PyObject_Del(self); return NULL; } self->state = 0; return (PyObject *)self; } static PyTypeObject spamdict_type = { PyObject_HEAD_INIT(&PyType_Type) 0, "spamdict", sizeof(spamdictobject), 0, 0, /* 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 */ PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ 0, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ spamdict_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyDict_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ (unaryfunc)spamdict_construct, /* tp_construct */ }; static PyObject * spamdict_new(void) { return PyObject_CallObject((PyObject *) &spamdict_type, NULL); } static PyObject * spam_dict(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, ":dict")) return NULL; return spamdict_new(); } /* Module spam */ static PyObject * spam_list(PyObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, ":list")) return NULL; return spamlist_new(); } static PyMethodDef spam_functions[] = { {"list", spam_list, METH_VARARGS, "create a new spamlist object"}, {"dict", spam_dict, METH_VARARGS, "create a new spamdict object"}, {0} }; DL_EXPORT(void) initspam(void) { PyObject *m, *d; m = Py_InitModule("spam", spam_functions); if (m == NULL) return; if (PyType_InitDict(&spamlist_type) < 0) return; if (PyType_InitDict(&spamdict_type) < 0) return; d = PyModule_GetDict(m); if (d == NULL) return; Py_INCREF(&spamlist_type); if (PyDict_SetItemString(d, "SpamListType", (PyObject *) &spamlist_type) < 0) return; Py_INCREF(&spamdict_type); if (PyDict_SetItemString(d, "SpamDictType", (PyObject *) &spamdict_type) < 0) return; } From gvanrossum@users.sourceforge.net Fri May 4 19:49:08 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 11:49:08 -0700 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv19690 Modified Files: LICENSE Log Message: Make the license GPL-compatible. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** LICENSE 2001/04/13 19:41:28 1.15 --- LICENSE 2001/05/04 18:49:06 1.16 *************** *** 77,96 **** breach of its terms and conditions. ! 7. This License Agreement shall be governed by the federal ! intellectual property law of the United States, including without ! limitation the federal copyright law, and, to the extent such ! U.S. federal law does not apply, by the law of the Commonwealth of ! Virginia, excluding Virginia's conflict of law provisions. ! Notwithstanding the foregoing, with regard to derivative works based ! on Python 2.1 that incorporate non-separable material that was ! previously distributed under the GNU General Public License (GPL), the ! law of the Commonwealth of Virginia shall govern this License ! Agreement only as to issues arising under or with respect to ! Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this ! License Agreement shall be deemed to create any relationship of ! agency, partnership, or joint venture between PSF and Licensee. This ! License Agreement does not grant permission to use PSF trademarks or ! trade name in a trademark sense to endorse or promote products or ! services of Licensee, or any third party. 8. By copying, installing or otherwise using Python 2.1, Licensee --- 77,85 ---- breach of its terms and conditions. ! 7. Nothing in this License Agreement shall be deemed to create any ! relationship of agency, partnership, or joint venture between PSF and ! Licensee. This License Agreement does not grant permission to use PSF ! trademarks or trade name in a trademark sense to endorse or promote ! products or services of Licensee, or any third party. 8. By copying, installing or otherwise using Python 2.1, Licensee From gvanrossum@users.sourceforge.net Fri May 4 19:50:16 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 11:50:16 -0700 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.7.2.2,1.7.2.3 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv19972 Modified Files: Tag: release20-maint LICENSE Log Message: Make the license GPL-compatible. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.7.2.2 retrieving revision 1.7.2.3 diff -C2 -r1.7.2.2 -r1.7.2.3 *** LICENSE 2001/04/13 19:44:25 1.7.2.2 --- LICENSE 2001/05/04 18:50:14 1.7.2.3 *************** *** 77,96 **** breach of its terms and conditions. ! 7. This License Agreement shall be governed by the federal ! intellectual property law of the United States, including without ! limitation the federal copyright law, and, to the extent such ! U.S. federal law does not apply, by the law of the Commonwealth of ! Virginia, excluding Virginia's conflict of law provisions. ! Notwithstanding the foregoing, with regard to derivative works based ! on Python 2.0.1 that incorporate non-separable material that was ! previously distributed under the GNU General Public License (GPL), the ! law of the Commonwealth of Virginia shall govern this License ! Agreement only as to issues arising under or with respect to ! Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this ! License Agreement shall be deemed to create any relationship of ! agency, partnership, or joint venture between PSF and Licensee. This ! License Agreement does not grant permission to use PSF trademarks or ! trade name in a trademark sense to endorse or promote products or ! services of Licensee, or any third party. 8. By copying, installing or otherwise using Python 2.1, Licensee --- 77,85 ---- breach of its terms and conditions. ! 7. Nothing in this License Agreement shall be deemed to create any ! relationship of agency, partnership, or joint venture between PSF and ! Licensee. This License Agreement does not grant permission to use PSF ! trademarks or trade name in a trademark sense to endorse or promote ! products or services of Licensee, or any third party. 8. By copying, installing or otherwise using Python 2.1, Licensee From gvanrossum@users.sourceforge.net Fri May 4 19:55:41 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 11:55:41 -0700 Subject: [Python-checkins] CVS: python/dist/src LICENSE,1.15,1.15.2.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv21136 Modified Files: Tag: release21-maint LICENSE Log Message: Make the license GPL-compatible. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.15 retrieving revision 1.15.2.1 diff -C2 -r1.15 -r1.15.2.1 *** LICENSE 2001/04/13 19:41:28 1.15 --- LICENSE 2001/05/04 18:55:39 1.15.2.1 *************** *** 77,96 **** breach of its terms and conditions. ! 7. This License Agreement shall be governed by the federal ! intellectual property law of the United States, including without ! limitation the federal copyright law, and, to the extent such ! U.S. federal law does not apply, by the law of the Commonwealth of ! Virginia, excluding Virginia's conflict of law provisions. ! Notwithstanding the foregoing, with regard to derivative works based ! on Python 2.1 that incorporate non-separable material that was ! previously distributed under the GNU General Public License (GPL), the ! law of the Commonwealth of Virginia shall govern this License ! Agreement only as to issues arising under or with respect to ! Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this ! License Agreement shall be deemed to create any relationship of ! agency, partnership, or joint venture between PSF and Licensee. This ! License Agreement does not grant permission to use PSF trademarks or ! trade name in a trademark sense to endorse or promote products or ! services of Licensee, or any third party. 8. By copying, installing or otherwise using Python 2.1, Licensee --- 77,85 ---- breach of its terms and conditions. ! 7. Nothing in this License Agreement shall be deemed to create any ! relationship of agency, partnership, or joint venture between PSF and ! Licensee. This License Agreement does not grant permission to use PSF ! trademarks or trade name in a trademark sense to endorse or promote ! products or services of Licensee, or any third party. 8. By copying, installing or otherwise using Python 2.1, Licensee From gvanrossum@users.sourceforge.net Fri May 4 22:56:55 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 14:56:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.9,2.16.8.10 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22591 Modified Files: Tag: descr-branch typeobject.c Log Message: Produce a clearer error message from tp_call. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.9 retrieving revision 2.16.8.10 diff -C2 -r2.16.8.9 -r2.16.8.10 *** typeobject.c 2001/05/04 17:09:38 2.16.8.9 --- typeobject.c 2001/05/04 21:56:53 2.16.8.10 *************** *** 56,61 **** char *dummy = NULL; PyObject *obj, *res; ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "", &dummy)) return NULL; --- 56,63 ---- char *dummy = NULL; PyObject *obj, *res; + char buffer[100]; ! sprintf(buffer, ":", type->tp_name); ! if (!PyArg_ParseTupleAndKeywords(args, kwds, buffer, &dummy)) return NULL; From gvanrossum@users.sourceforge.net Fri May 4 22:58:47 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 04 May 2001 14:58:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules spam.c,1.1.2.1,1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv22904 Modified Files: Tag: descr-branch spam.c Log Message: Fold some long lines. Index: spam.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Attic/spam.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -r1.1.2.1 -r1.1.2.2 *** spam.c 2001/05/04 17:19:10 1.1.2.1 --- spam.c 2001/05/04 21:58:45 1.1.2.2 *************** *** 29,34 **** static PyMethodDef spamlist_methods[] = { ! {"getstate", (PyCFunction)spamlist_getstate, METH_VARARGS, "getstate() -> state"}, ! {"setstate", (PyCFunction)spamlist_setstate, METH_VARARGS, "setstate(state)"}, {0}, }; --- 29,36 ---- static PyMethodDef spamlist_methods[] = { ! {"getstate", (PyCFunction)spamlist_getstate, METH_VARARGS, ! "getstate() -> state"}, ! {"setstate", (PyCFunction)spamlist_setstate, METH_VARARGS, ! "setstate(state)"}, {0}, }; From tim_one@users.sourceforge.net Sat May 5 01:14:58 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 17:14:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.62,2.63 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12706/python/dist/src/Objects Modified Files: abstract.c Log Message: Make PyIter_Next() a little smarter (wrt its knowledge of iterator internals) so clients can be a lot dumber (wrt their knowledge). Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -r2.62 -r2.63 *** abstract.c 2001/05/02 07:12:39 2.62 --- abstract.c 2001/05/05 00:14:56 2.63 *************** *** 1277,1291 **** PyObject *item = PyIter_Next(it); if (item == NULL) { - /* We're out of here in any case, but if this is a - * StopIteration exception it's expected, but if - * any other kind of exception it's an error. - */ if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches(PyExc_StopIteration)) ! PyErr_Clear(); ! else { ! Py_DECREF(result); ! result = NULL; ! } } break; --- 1277,1283 ---- PyObject *item = PyIter_Next(it); if (item == NULL) { if (PyErr_Occurred()) { ! Py_DECREF(result); ! result = NULL; } break; *************** *** 1797,1803 **** --- 1789,1803 ---- } + /* Return next item. + * If an error occurs, return NULL. PyErr_Occurred() will be true. + * If the iteration terminates normally, return NULL and clear the + * PyExc_StopIteration exception (if it was set). PyErr_Occurred() + * will be false. + * Else return the next object. PyErr_Occurred() will be false. + */ PyObject * PyIter_Next(PyObject *iter) { + PyObject *result; if (!PyIter_Check(iter)) { PyErr_Format(PyExc_TypeError, *************** *** 1806,1809 **** return NULL; } ! return (*iter->ob_type->tp_iternext)(iter); } --- 1806,1814 ---- return NULL; } ! result = (*iter->ob_type->tp_iternext)(iter); ! if (result == NULL && ! PyErr_Occurred() && ! PyErr_ExceptionMatches(PyExc_StopIteration)) ! PyErr_Clear(); ! return result; } From tim_one@users.sourceforge.net Sat May 5 01:14:58 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 17:14:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include abstract.h,2.31,2.32 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv12706/python/dist/src/Include Modified Files: abstract.h Log Message: Make PyIter_Next() a little smarter (wrt its knowledge of iterator internals) so clients can be a lot dumber (wrt their knowledge). Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -r2.31 -r2.32 *** abstract.h 2001/04/23 14:08:49 2.31 --- abstract.h 2001/05/05 00:14:56 2.32 *************** *** 485,491 **** /* Takes an iterator object and calls its tp_iternext slot, returning the next value. If the iterator is exhausted, ! this can return NULL without setting an exception, *or* ! NULL with a StopIteration exception. ! NULL with any other exception means an error occurred. */ /* Number Protocol:*/ --- 485,490 ---- /* Takes an iterator object and calls its tp_iternext slot, returning the next value. If the iterator is exhausted, ! this returns NULL without setting an exception. ! NULL with an exception means an error occurred. */ /* Number Protocol:*/ From tim_one@users.sourceforge.net Sat May 5 01:14:58 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 17:14:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.203,2.204 ceval.c,2.242,2.243 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv12706/python/dist/src/Python Modified Files: bltinmodule.c ceval.c Log Message: Make PyIter_Next() a little smarter (wrt its knowledge of iterator internals) so clients can be a lot dumber (wrt their knowledge). Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.203 retrieving revision 2.204 diff -C2 -r2.203 -r2.204 *** bltinmodule.c 2001/05/04 04:39:21 2.203 --- bltinmodule.c 2001/05/05 00:14:56 2.204 *************** *** 165,169 **** PyObject *func, *seq, *result, *it; int len; /* guess for result list size */ ! register int i, j; if (!PyArg_ParseTuple(args, "OO:filter", &func, &seq)) --- 165,169 ---- PyObject *func, *seq, *result, *it; int len; /* guess for result list size */ ! register int j; if (!PyArg_ParseTuple(args, "OO:filter", &func, &seq)) *************** *** 205,209 **** /* Build the result list. */ ! for (i = j = 0; ; ++i) { PyObject *item, *good; int ok; --- 205,210 ---- /* Build the result list. */ ! j = 0; ! for (;;) { PyObject *item, *good; int ok; *************** *** 211,224 **** item = PyIter_Next(it); if (item == NULL) { ! /* We're out of here in any case, but if this is a ! * StopIteration exception it's expected, but if ! * any other kind of exception it's an error. ! */ ! if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches(PyExc_StopIteration)) ! PyErr_Clear(); ! else ! goto Fail_result_it; ! } break; } --- 212,217 ---- item = PyIter_Next(it); if (item == NULL) { ! if (PyErr_Occurred()) ! goto Fail_result_it; break; } *************** *** 1031,1046 **** ++numactive; else { - /* StopIteration is *implied* by a - * NULL return from PyIter_Next() if - * PyErr_Occurred() is false. - */ if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches( ! PyExc_StopIteration)) ! PyErr_Clear(); ! else { ! Py_XDECREF(alist); ! goto Fail_1; ! } } Py_INCREF(Py_None); --- 1024,1030 ---- ++numactive; else { if (PyErr_Occurred()) { ! Py_XDECREF(alist); ! goto Fail_1; } Py_INCREF(Py_None); *************** *** 1048,1052 **** sqp->saw_StopIteration = 1; } - } if (alist) --- 1032,1035 ---- *************** *** 1446,1450 **** min_max(PyObject *args, int op) { - int i; PyObject *v, *w, *x, *it; --- 1429,1432 ---- *************** *** 1459,1477 **** w = NULL; /* the result */ ! for (i = 0; ; i++) { x = PyIter_Next(it); if (x == NULL) { - /* We're out of here in any case, but if this is a - * StopIteration exception it's expected, but if - * any other kind of exception it's an error. - */ if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches(PyExc_StopIteration)) ! PyErr_Clear(); ! else { ! Py_XDECREF(w); ! Py_DECREF(it); ! return NULL; ! } } break; --- 1441,1451 ---- w = NULL; /* the result */ ! for (;;) { x = PyIter_Next(it); if (x == NULL) { if (PyErr_Occurred()) { ! Py_XDECREF(w); ! Py_DECREF(it); ! return NULL; } break; *************** *** 1881,1894 **** op2 = PyIter_Next(it); if (op2 == NULL) { ! /* StopIteration is *implied* by a NULL return from ! * PyIter_Next() if PyErr_Occurred() is false. ! */ ! if (PyErr_Occurred()) { ! if (PyErr_ExceptionMatches(PyExc_StopIteration)) ! PyErr_Clear(); ! else ! goto Fail; ! } ! break; } --- 1855,1861 ---- op2 = PyIter_Next(it); if (op2 == NULL) { ! if (PyErr_Occurred()) ! goto Fail; ! break; } Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.242 retrieving revision 2.243 diff -C2 -r2.242 -r2.243 *** ceval.c 2001/04/27 02:25:33 2.242 --- ceval.c 2001/05/05 00:14:56 2.243 *************** *** 1895,1903 **** continue; } ! if (!PyErr_Occurred() || ! PyErr_ExceptionMatches( ! PyExc_StopIteration)) ! { ! x = v = POP(); Py_DECREF(v); JUMPBY(oparg); --- 1895,1901 ---- continue; } ! if (!PyErr_Occurred()) { ! /* iterator ended normally */ ! x = v = POP(); Py_DECREF(v); JUMPBY(oparg); From tim_one@users.sourceforge.net Sat May 5 01:14:58 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 17:14:58 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0234.txt,1.14,1.15 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv12706/python/nondist/peps Modified Files: pep-0234.txt Log Message: Make PyIter_Next() a little smarter (wrt its knowledge of iterator internals) so clients can be a lot dumber (wrt their knowledge). Index: pep-0234.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0234.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** pep-0234.txt 2001/05/01 17:52:06 1.14 --- pep-0234.txt 2001/05/05 00:14:56 1.15 *************** *** 44,51 **** structure, for obtaining the next value in the iteration. To use this slot, a new C API function PyIter_Next() is added. The ! signature for both the slot and the API function is as follows: ! the argument is a PyObject * and so is the return value. When the ! return value is non-NULL, it is the next value in the iteration. ! When it is NULL, there are three possibilities: - No exception is set; this implies the end of the iteration. --- 44,52 ---- structure, for obtaining the next value in the iteration. To use this slot, a new C API function PyIter_Next() is added. The ! signature for both the slot and the API function is as follows, ! although the NULL return conditions differ: the argument is a ! PyObject * and so is the return value. When the return value is ! non-NULL, it is the next value in the iteration. When it is NULL, ! then for the tp_iternext slot there are three possibilities: - No exception is set; this implies the end of the iteration. *************** *** 56,59 **** --- 57,69 ---- - Some other exception is set; this means that an error occurred that should be propagated normally. + + The higher-level PyIter_Next() function clears the StopIteration + exception (or derived exception) when it occurs, so its NULL return + conditions are simpler: + + - No exception is set; this means iteration has ended. + + - Some exception is set; this means an error occurred, and should + be propagated normally. In addition to the tp_iternext slot, every iterator object must From tim_one@users.sourceforge.net Sat May 5 04:56:39 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 20:56:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include abstract.h,2.32,2.33 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv17966/python/dist/src/Include Modified Files: abstract.h Log Message: Generalize tuple() to work nicely with iterators. NEEDS DOC CHANGES. This one surprised me! While I expected tuple() to be a no-brainer, turns out it's actually dripping with consequences: 1. It will *allow* the popular PySequence_Fast() to work with any iterable object (code for that not yet checked in, but should be trivial). 2. It caused two std tests to fail. This because some places used PyTuple_Sequence() (the C spelling of tuple()) as an indirect way to test whether something *is* a sequence. But tuple() code only looked for the existence of sq->item to determine that, and e.g. an instance passed that test whether or not it supported the other operations tuple() needed (e.g., __len__). So some things the tests *expected* to fail with an AttributeError now fail with a TypeError instead. This looks like an improvement to me; e.g., test_coercion used to produce 559 TypeErrors and 2 AttributeErrors, and now they're all TypeErrors. The error details are more informative too, because the places calling this were *looking* for TypeErrors in order to replace the generic tuple() "not a sequence" msg with their own more specific text, and AttributeErrors snuck by that. Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -r2.32 -r2.33 *** abstract.h 2001/05/05 00:14:56 2.32 --- abstract.h 2001/05/05 03:56:37 2.33 *************** *** 912,916 **** members of this list. ! Returns NULL on failure. If the object is not a sequence, raises a TypeError exception with m as the message text. */ --- 912,916 ---- members of this list. ! Returns NULL on failure. If the object does not support iteration, raises a TypeError exception with m as the message text. */ From tim_one@users.sourceforge.net Sat May 5 04:56:39 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 20:56:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.154,1.155 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv17966/python/dist/src/Misc Modified Files: NEWS Log Message: Generalize tuple() to work nicely with iterators. NEEDS DOC CHANGES. This one surprised me! While I expected tuple() to be a no-brainer, turns out it's actually dripping with consequences: 1. It will *allow* the popular PySequence_Fast() to work with any iterable object (code for that not yet checked in, but should be trivial). 2. It caused two std tests to fail. This because some places used PyTuple_Sequence() (the C spelling of tuple()) as an indirect way to test whether something *is* a sequence. But tuple() code only looked for the existence of sq->item to determine that, and e.g. an instance passed that test whether or not it supported the other operations tuple() needed (e.g., __len__). So some things the tests *expected* to fail with an AttributeError now fail with a TypeError instead. This looks like an improvement to me; e.g., test_coercion used to produce 559 TypeErrors and 2 AttributeErrors, and now they're all TypeErrors. The error details are more informative too, because the places calling this were *looking* for TypeErrors in order to replace the generic tuple() "not a sequence" msg with their own more specific text, and AttributeErrors snuck by that. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -r1.154 -r1.155 *** NEWS 2001/05/04 13:40:18 1.154 --- NEWS 2001/05/05 03:56:37 1.155 *************** *** 25,31 **** reduce() XXX TODO string.join(), unicode.join() ! XXX TODO tuple() XXX TODO zip() ! XXX TODO 'x in y' (!) (?) What's New in Python 2.1 (final)? --- 25,31 ---- reduce() XXX TODO string.join(), unicode.join() ! tuple() XXX TODO zip() ! XXX TODO 'x in y' What's New in Python 2.1 (final)? From tim_one@users.sourceforge.net Sat May 5 04:56:39 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 20:56:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.63,2.64 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17966/python/dist/src/Objects Modified Files: abstract.c Log Message: Generalize tuple() to work nicely with iterators. NEEDS DOC CHANGES. This one surprised me! While I expected tuple() to be a no-brainer, turns out it's actually dripping with consequences: 1. It will *allow* the popular PySequence_Fast() to work with any iterable object (code for that not yet checked in, but should be trivial). 2. It caused two std tests to fail. This because some places used PyTuple_Sequence() (the C spelling of tuple()) as an indirect way to test whether something *is* a sequence. But tuple() code only looked for the existence of sq->item to determine that, and e.g. an instance passed that test whether or not it supported the other operations tuple() needed (e.g., __len__). So some things the tests *expected* to fail with an AttributeError now fail with a TypeError instead. This looks like an improvement to me; e.g., test_coercion used to produce 559 TypeErrors and 2 AttributeErrors, and now they're all TypeErrors. The error details are more informative too, because the places calling this were *looking* for TypeErrors in order to replace the generic tuple() "not a sequence" msg with their own more specific text, and AttributeErrors snuck by that. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -r2.63 -r2.64 *** abstract.c 2001/05/05 00:14:56 2.63 --- abstract.c 2001/05/05 03:56:37 2.64 *************** *** 1177,1235 **** PySequence_Tuple(PyObject *v) { ! PySequenceMethods *m; if (v == NULL) return null_error(); if (PyTuple_Check(v)) { Py_INCREF(v); return v; } - if (PyList_Check(v)) return PyList_AsTuple(v); - - /* There used to be code for strings here, but tuplifying strings is - not a common activity, so I nuked it. Down with code bloat! */ ! /* Generic sequence object */ ! m = v->ob_type->tp_as_sequence; ! if (m && m->sq_item) { ! int i; ! PyObject *t; ! int n = PySequence_Size(v); ! if (n < 0) ! return NULL; ! t = PyTuple_New(n); ! if (t == NULL) ! return NULL; ! for (i = 0; ; i++) { ! PyObject *item = (*m->sq_item)(v, i); ! if (item == NULL) { ! if (PyErr_ExceptionMatches(PyExc_IndexError)) ! PyErr_Clear(); ! else { ! Py_DECREF(t); ! t = NULL; ! } ! break; ! } ! if (i >= n) { ! if (n < 500) ! n += 10; ! else ! n += 100; ! if (_PyTuple_Resize(&t, n, 0) != 0) ! break; ! } ! PyTuple_SET_ITEM(t, i, item); } ! if (i < n && t != NULL) ! _PyTuple_Resize(&t, i, 0); ! return t; } ! /* None of the above */ ! return type_error("tuple() argument must be a sequence"); } --- 1177,1242 ---- PySequence_Tuple(PyObject *v) { ! PyObject *it; /* iter(v) */ ! int n; /* guess for result tuple size */ ! PyObject *result; ! int j; if (v == NULL) return null_error(); + /* Special-case the common tuple and list cases, for efficiency. */ if (PyTuple_Check(v)) { Py_INCREF(v); return v; } if (PyList_Check(v)) return PyList_AsTuple(v); ! /* Get iterator. */ ! it = PyObject_GetIter(v); ! if (it == NULL) ! return type_error("tuple() argument must support iteration"); ! ! /* Guess result size and allocate space. */ ! n = PySequence_Size(v); ! if (n < 0) { ! PyErr_Clear(); ! n = 10; /* arbitrary */ ! } ! result = PyTuple_New(n); ! if (result == NULL) ! goto Fail; ! ! /* Fill the tuple. */ ! for (j = 0; ; ++j) { ! PyObject *item = PyIter_Next(it); ! if (item == NULL) { ! if (PyErr_Occurred()) ! goto Fail; ! break; ! } ! if (j >= n) { ! if (n < 500) ! n += 10; ! else ! n += 100; ! if (_PyTuple_Resize(&result, n, 0) != 0) ! goto Fail; } ! PyTuple_SET_ITEM(result, j, item); } ! /* Cut tuple back if guess was too large. */ ! if (j < n && ! _PyTuple_Resize(&result, j, 0) != 0) ! goto Fail; ! ! Py_DECREF(it); ! return result; ! ! Fail: ! Py_XDECREF(result); ! Py_DECREF(it); ! return NULL; } From tim_one@users.sourceforge.net Sat May 5 04:56:39 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 20:56:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_extcall.py,1.14,1.15 test_iter.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17966/python/dist/src/Lib/test Modified Files: test_extcall.py test_iter.py Log Message: Generalize tuple() to work nicely with iterators. NEEDS DOC CHANGES. This one surprised me! While I expected tuple() to be a no-brainer, turns out it's actually dripping with consequences: 1. It will *allow* the popular PySequence_Fast() to work with any iterable object (code for that not yet checked in, but should be trivial). 2. It caused two std tests to fail. This because some places used PyTuple_Sequence() (the C spelling of tuple()) as an indirect way to test whether something *is* a sequence. But tuple() code only looked for the existence of sq->item to determine that, and e.g. an instance passed that test whether or not it supported the other operations tuple() needed (e.g., __len__). So some things the tests *expected* to fail with an AttributeError now fail with a TypeError instead. This looks like an improvement to me; e.g., test_coercion used to produce 559 TypeErrors and 2 AttributeErrors, and now they're all TypeErrors. The error details are more informative too, because the places calling this were *looking* for TypeErrors in order to replace the generic tuple() "not a sequence" msg with their own more specific text, and AttributeErrors snuck by that. Index: test_extcall.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_extcall.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** test_extcall.py 2001/04/11 13:53:35 1.14 --- test_extcall.py 2001/05/05 03:56:37 1.15 *************** *** 59,66 **** try: g(*Nothing()) ! except AttributeError, attr: pass else: ! print "should raise AttributeError: __len__" class Nothing: --- 59,66 ---- try: g(*Nothing()) ! except TypeError, attr: pass else: ! print "should raise TypeError" class Nothing: *************** *** 69,76 **** try: g(*Nothing()) ! except AttributeError, attr: pass else: ! print "should raise AttributeError: __getitem__" class Nothing: --- 69,76 ---- try: g(*Nothing()) ! except TypeError, attr: pass else: ! print "should raise TypeError" class Nothing: Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** test_iter.py 2001/05/04 04:39:21 1.9 --- test_iter.py 2001/05/05 03:56:37 1.10 *************** *** 276,279 **** --- 276,312 ---- pass + # Test tuples()'s use of iterators. + def test_builtin_tuple(self): + self.assertEqual(tuple(SequenceClass(5)), (0, 1, 2, 3, 4)) + self.assertEqual(tuple(SequenceClass(0)), ()) + self.assertEqual(tuple([]), ()) + self.assertEqual(tuple(()), ()) + self.assertEqual(tuple("abc"), ("a", "b", "c")) + + d = {"one": 1, "two": 2, "three": 3} + self.assertEqual(tuple(d), tuple(d.keys())) + + self.assertRaises(TypeError, tuple, list) + self.assertRaises(TypeError, tuple, 42) + + f = open(TESTFN, "w") + try: + for i in range(5): + f.write("%d\n" % i) + finally: + f.close() + f = open(TESTFN, "r") + try: + self.assertEqual(tuple(f), ("0\n", "1\n", "2\n", "3\n", "4\n")) + f.seek(0, 0) + self.assertEqual(tuple(f.xreadlines()), + ("0\n", "1\n", "2\n", "3\n", "4\n")) + finally: + f.close() + try: + unlink(TESTFN) + except OSError: + pass + # Test filter()'s use of iterators. def test_builtin_filter(self): From tim_one@users.sourceforge.net Sat May 5 04:56:39 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 20:56:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_coercion,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv17966/python/dist/src/Lib/test/output Modified Files: test_coercion Log Message: Generalize tuple() to work nicely with iterators. NEEDS DOC CHANGES. This one surprised me! While I expected tuple() to be a no-brainer, turns out it's actually dripping with consequences: 1. It will *allow* the popular PySequence_Fast() to work with any iterable object (code for that not yet checked in, but should be trivial). 2. It caused two std tests to fail. This because some places used PyTuple_Sequence() (the C spelling of tuple()) as an indirect way to test whether something *is* a sequence. But tuple() code only looked for the existence of sq->item to determine that, and e.g. an instance passed that test whether or not it supported the other operations tuple() needed (e.g., __len__). So some things the tests *expected* to fail with an AttributeError now fail with a TypeError instead. This looks like an improvement to me; e.g., test_coercion used to produce 559 TypeErrors and 2 AttributeErrors, and now they're all TypeErrors. The error details are more informative too, because the places calling this were *looking* for TypeErrors in order to replace the generic tuple() "not a sequence" msg with their own more specific text, and AttributeErrors snuck by that. Index: test_coercion =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_coercion,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_coercion 2001/01/04 01:36:25 1.3 --- test_coercion 2001/05/05 03:56:37 1.4 *************** *** 517,521 **** [1] %= None ... exceptions.TypeError [1] + ... exceptions.TypeError ! [1] += ... exceptions.AttributeError [1] - ... exceptions.TypeError [1] -= ... exceptions.TypeError --- 517,521 ---- [1] %= None ... exceptions.TypeError [1] + ... exceptions.TypeError ! [1] += ... exceptions.TypeError [1] - ... exceptions.TypeError [1] -= ... exceptions.TypeError *************** *** 529,533 **** [1] %= ... exceptions.TypeError [1] + ... exceptions.TypeError ! [1] += ... exceptions.AttributeError [1] - ... exceptions.TypeError [1] -= ... exceptions.TypeError --- 529,533 ---- [1] %= ... exceptions.TypeError [1] + ... exceptions.TypeError ! [1] += ... exceptions.TypeError [1] - ... exceptions.TypeError [1] -= ... exceptions.TypeError From tim_one@users.sourceforge.net Sat May 5 05:10:27 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 21:10:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.64,2.65 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21829/python/dist/src/Objects Modified Files: abstract.c Log Message: Fix a tiny and unlikely memory leak. Was there before too, and actually several of these turned up and got fixed during the iteration crusade. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.64 retrieving revision 2.65 diff -C2 -r2.64 -r2.65 *** abstract.c 2001/05/05 03:56:37 2.64 --- abstract.c 2001/05/05 04:10:25 2.65 *************** *** 1221,1226 **** else n += 100; ! if (_PyTuple_Resize(&result, n, 0) != 0) goto Fail; } PyTuple_SET_ITEM(result, j, item); --- 1221,1228 ---- else n += 100; ! if (_PyTuple_Resize(&result, n, 0) != 0) { ! Py_DECREF(item); goto Fail; + } } PyTuple_SET_ITEM(result, j, item); From tim_one@users.sourceforge.net Sat May 5 05:24:45 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 21:24:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.155,1.156 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv23233/python/dist/src/Misc Modified Files: NEWS Log Message: Mark string.join() as done. Turns out string_join() works "for free" now, because PySequence_Fast() started working for free as soon as PySequence_Tuple() learned how to work with iterators. For some reason unicode.join() still doesn't work, though. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -r1.155 -r1.156 *** NEWS 2001/05/05 03:56:37 1.155 --- NEWS 2001/05/05 04:24:43 1.156 *************** *** 24,29 **** min() reduce() ! XXX TODO string.join(), unicode.join() tuple() XXX TODO zip() XXX TODO 'x in y' --- 24,30 ---- min() reduce() ! string.join() tuple() + XXX TODO unicode.join() XXX TODO zip() XXX TODO 'x in y' From tim_one@users.sourceforge.net Sat May 5 06:36:50 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 22:36:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31444/python/dist/src/Lib/test Modified Files: test_iter.py Log Message: Make unicode.join() work nice with iterators. This also required a change to string.join(), so that when the latter figures out in midstream that it really needs unicode.join() instead, unicode.join() can actually get all the sequence elements (i.e., there's no guarantee that the sequence passed to string.join() can be iterated over *again* by unicode.join(), so string.join() must not pass on the original sequence object anymore). Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** test_iter.py 2001/05/05 03:56:37 1.10 --- test_iter.py 2001/05/05 05:36:48 1.11 *************** *** 432,434 **** --- 432,475 ---- self.assertEqual(reduce(add, d), "".join(d.keys())) + def test_unicode_join_endcase(self): + + # This class inserts a Unicode object into its argument's natural + # iteration, in the 3rd position. + class OhPhooey: + def __init__(self, seq): + self.it = iter(seq) + self.i = 0 + + def __iter__(self): + return self + + def next(self): + i = self.i + self.i = i+1 + if i == 2: + return u"fooled you!" + return self.it.next() + + f = open(TESTFN, "w") + try: + f.write("a\n" + "b\n" + "c\n") + finally: + f.close() + + f = open(TESTFN, "r") + # Nasty: string.join(s) can't know whether unicode.join() is needed + # until it's seen all of s's elements. But in this case, f's + # iterator cannot be restarted. So what we're testing here is + # whether string.join() can manage to remember everything it's seen + # and pass that on to unicode.join(). + try: + got = " - ".join(OhPhooey(f)) + self.assertEqual(got, u"a\n - b\n - fooled you! - c\n") + finally: + f.close() + try: + unlink(TESTFN) + except OSError: + pass + run_unittest(TestCase) From tim_one@users.sourceforge.net Sat May 5 06:36:50 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 22:36:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.106,2.107 unicodeobject.c,2.88,2.89 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31444/python/dist/src/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Make unicode.join() work nice with iterators. This also required a change to string.join(), so that when the latter figures out in midstream that it really needs unicode.join() instead, unicode.join() can actually get all the sequence elements (i.e., there's no guarantee that the sequence passed to string.join() can be iterated over *again* by unicode.join(), so string.join() must not pass on the original sequence object anymore). Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.106 retrieving revision 2.107 diff -C2 -r2.106 -r2.107 *** stringobject.c 2001/05/02 14:21:53 2.106 --- stringobject.c 2001/05/05 05:36:48 2.107 *************** *** 862,867 **** if (!PyString_Check(item)){ if (PyUnicode_Check(item)) { Py_DECREF(seq); ! return PyUnicode_Join((PyObject *)self, orig); } PyErr_Format(PyExc_TypeError, --- 862,874 ---- if (!PyString_Check(item)){ if (PyUnicode_Check(item)) { + /* Defer to Unicode join. + * CAUTION: There's no gurantee that the + * original sequence can be iterated over + * again, so we must pass seq here. + */ + PyObject *result; + result = PyUnicode_Join((PyObject *)self, seq); Py_DECREF(seq); ! return result; } PyErr_Format(PyExc_TypeError, Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.88 retrieving revision 2.89 diff -C2 -r2.88 -r2.89 *** unicodeobject.c 2001/04/28 05:38:26 2.88 --- unicodeobject.c 2001/05/05 05:36:48 2.89 *************** *** 2725,2732 **** int sz = 100; int i; ! seqlen = PySequence_Size(seq); ! if (seqlen < 0 && PyErr_Occurred()) ! return NULL; if (separator == NULL) { --- 2725,2733 ---- int sz = 100; int i; + PyObject *it; ! it = PyObject_GetIter(seq); ! if (it == NULL) ! return NULL; if (separator == NULL) { *************** *** 2738,2742 **** separator = PyUnicode_FromObject(separator); if (separator == NULL) ! return NULL; sep = PyUnicode_AS_UNICODE(separator); seplen = PyUnicode_GET_SIZE(separator); --- 2739,2743 ---- separator = PyUnicode_FromObject(separator); if (separator == NULL) ! goto onError; sep = PyUnicode_AS_UNICODE(separator); seplen = PyUnicode_GET_SIZE(separator); *************** *** 2749,2759 **** reslen = 0; ! for (i = 0; i < seqlen; i++) { int itemlen; ! PyObject *item; ! ! item = PySequence_GetItem(seq, i); ! if (item == NULL) ! goto onError; if (!PyUnicode_Check(item)) { PyObject *v; --- 2750,2761 ---- reslen = 0; ! for (i = 0; ; ++i) { int itemlen; ! PyObject *item = PyIter_Next(it); ! if (item == NULL) { ! if (PyErr_Occurred()) ! goto onError; ! break; ! } if (!PyUnicode_Check(item)) { PyObject *v; *************** *** 2785,2793 **** Py_XDECREF(separator); return (PyObject *)res; onError: Py_XDECREF(separator); ! Py_DECREF(res); return NULL; } --- 2787,2797 ---- Py_XDECREF(separator); + Py_DECREF(it); return (PyObject *)res; onError: Py_XDECREF(separator); ! Py_XDECREF(res); ! Py_DECREF(it); return NULL; } From tim_one@users.sourceforge.net Sat May 5 06:36:50 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 04 May 2001 22:36:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.156,1.157 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv31444/python/dist/src/Misc Modified Files: NEWS Log Message: Make unicode.join() work nice with iterators. This also required a change to string.join(), so that when the latter figures out in midstream that it really needs unicode.join() instead, unicode.join() can actually get all the sequence elements (i.e., there's no guarantee that the sequence passed to string.join() can be iterated over *again* by unicode.join(), so string.join() must not pass on the original sequence object anymore). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -r1.156 -r1.157 *** NEWS 2001/05/05 04:24:43 1.156 --- NEWS 2001/05/05 05:36:48 1.157 *************** *** 26,30 **** string.join() tuple() ! XXX TODO unicode.join() XXX TODO zip() XXX TODO 'x in y' --- 26,30 ---- string.join() tuple() ! unicode.join() XXX TODO zip() XXX TODO 'x in y' From tim_one@users.sourceforge.net Sat May 5 11:06:20 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 03:06:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.65,2.66 object.c,2.128,2.129 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28824/python/dist/src/Objects Modified Files: abstract.c object.c Log Message: Make 'x in y' and 'x not in y' (PySequence_Contains) play nice w/ iterators. NEEDS DOC CHANGES A few more AttributeErrors turned into TypeErrors, but in test_contains this time. The full story for instance objects is pretty much unexplainable, because instance_contains() tries its own flavor of iteration-based containment testing first, and PySequence_Contains doesn't get a chance at it unless instance_contains() blows up. A consequence is that some_complex_number in some_instance dies with a TypeError unless some_instance.__class__ defines __iter__ but does not define __getitem__. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.65 retrieving revision 2.66 diff -C2 -r2.65 -r2.66 *** abstract.c 2001/05/05 04:10:25 2.65 --- abstract.c 2001/05/05 10:06:16 2.66 *************** *** 1364,1407 **** } int PySequence_Contains(PyObject *w, PyObject *v) /* v in w */ { ! int i, cmp; ! PyObject *x; ! PySequenceMethods *sq; ! if(PyType_HasFeature(w->ob_type, Py_TPFLAGS_HAVE_SEQUENCE_IN)) { ! sq = w->ob_type->tp_as_sequence; ! if(sq != NULL && sq->sq_contains != NULL) ! return (*sq->sq_contains)(w, v); } ! /* If there is no better way to check whether an item is is contained, ! do it the hard way */ ! sq = w->ob_type->tp_as_sequence; ! if (sq == NULL || sq->sq_item == NULL) { PyErr_SetString(PyExc_TypeError, ! "'in' or 'not in' needs sequence right argument"); return -1; } ! for (i = 0; ; i++) { ! x = (*sq->sq_item)(w, i); ! if (x == NULL) { ! if (PyErr_ExceptionMatches(PyExc_IndexError)) { ! PyErr_Clear(); ! break; ! } ! return -1; } ! cmp = PyObject_RichCompareBool(v, x, Py_EQ); ! Py_XDECREF(x); ! if (cmp > 0) ! return 1; ! if (cmp < 0) ! return -1; } ! ! return 0; } --- 1364,1412 ---- } + /* Return -1 if error; 1 if v in w; 0 if v not in w. */ int PySequence_Contains(PyObject *w, PyObject *v) /* v in w */ { ! PyObject *it; /* iter(w) */ ! int result; ! if (PyType_HasFeature(w->ob_type, Py_TPFLAGS_HAVE_SEQUENCE_IN)) { ! PySequenceMethods *sq = w->ob_type->tp_as_sequence; ! if (sq != NULL && sq->sq_contains != NULL) { ! result = (*sq->sq_contains)(w, v); ! if (result >= 0) ! return result; ! assert(PyErr_Occurred()); ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) ! PyErr_Clear(); ! else ! return result; ! } } ! /* Try exhaustive iteration. */ ! it = PyObject_GetIter(w); ! if (it == NULL) { PyErr_SetString(PyExc_TypeError, ! "'in' or 'not in' needs iterable right argument"); return -1; } ! for (;;) { ! int cmp; ! PyObject *item = PyIter_Next(it); ! if (item == NULL) { ! result = PyErr_Occurred() ? -1 : 0; ! break; } ! cmp = PyObject_RichCompareBool(v, item, Py_EQ); ! Py_DECREF(item); ! if (cmp == 0) ! continue; ! result = cmp > 0 ? 1 : -1; ! break; } ! Py_DECREF(it); ! return result; } Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.128 retrieving revision 2.129 diff -C2 -r2.128 -r2.129 *** object.c 2001/05/03 20:04:33 2.128 --- object.c 2001/05/05 10:06:17 2.129 *************** *** 836,839 **** --- 836,840 ---- } + /* Return -1 if error; 1 if v op w; 0 if not (v op w). */ int PyObject_RichCompareBool(PyObject *v, PyObject *w, int op) From tim_one@users.sourceforge.net Sat May 5 11:06:47 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 03:06:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_contains.py,1.6,1.7 test_iter.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28824/python/dist/src/Lib/test Modified Files: test_contains.py test_iter.py Log Message: Make 'x in y' and 'x not in y' (PySequence_Contains) play nice w/ iterators. NEEDS DOC CHANGES A few more AttributeErrors turned into TypeErrors, but in test_contains this time. The full story for instance objects is pretty much unexplainable, because instance_contains() tries its own flavor of iteration-based containment testing first, and PySequence_Contains doesn't get a chance at it unless instance_contains() blows up. A consequence is that some_complex_number in some_instance dies with a TypeError unless some_instance.__class__ defines __iter__ but does not define __getitem__. Index: test_contains.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_contains.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** test_contains.py 2000/10/23 17:22:07 1.6 --- test_contains.py 2001/05/05 10:06:14 1.7 *************** *** 32,36 **** 1 in a check(0, "in base_set did not raise error") ! except AttributeError: pass --- 32,36 ---- 1 in a check(0, "in base_set did not raise error") ! except TypeError: pass *************** *** 38,42 **** 1 not in a check(0, "not in base_set did not raise error") ! except AttributeError: pass --- 38,42 ---- 1 not in a check(0, "not in base_set did not raise error") ! except TypeError: pass Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** test_iter.py 2001/05/05 05:36:48 1.11 --- test_iter.py 2001/05/05 10:06:14 1.12 *************** *** 473,475 **** --- 473,530 ---- pass + # Test iterators with 'x in y' and 'x not in y'. + def test_in_and_not_in(self): + sc5 = IteratingSequenceClass(5) + for i in range(5): + self.assert_(i in sc5) + # CAUTION: This test fails on 3-12j if sc5 is SequenceClass(5) + # instead, with: + # TypeError: cannot compare complex numbers using <, <=, >, >= + # The trail leads back to instance_contains() in classobject.c, + # under comment: + # /* fall back to previous behavior */ + # IteratingSequenceClass(5) avoids the same problem only because + # it lacks __getitem__: instance_contains *tries* to do a wrong + # thing with it too, but aborts with an AttributeError the first + # time it calls instance_item(); PySequence_Contains() then catches + # that and clears it, and tries the iterator-based "contains" + # instead. But this is hanging together by a thread. + for i in "abc", -1, 5, 42.42, (3, 4), [], {1: 1}, 3-12j, sc5: + self.assert_(i not in sc5) + del sc5 + + self.assertRaises(TypeError, lambda: 3 in 12) + self.assertRaises(TypeError, lambda: 3 not in map) + + d = {"one": 1, "two": 2, "three": 3, 1j: 2j} + for k in d: + self.assert_(k in d) + self.assert_(k not in d.itervalues()) + for v in d.values(): + self.assert_(v in d.itervalues()) + self.assert_(v not in d) + for k, v in d.iteritems(): + self.assert_((k, v) in d.iteritems()) + self.assert_((v, k) not in d.iteritems()) + del d + + f = open(TESTFN, "w") + try: + f.write("a\n" "b\n" "c\n") + finally: + f.close() + f = open(TESTFN, "r") + try: + for chunk in "abc": + f.seek(0, 0) + self.assert_(chunk not in f) + f.seek(0, 0) + self.assert_((chunk + "\n") in f) + finally: + f.close() + try: + unlink(TESTFN) + except OSError: + pass + run_unittest(TestCase) From tim_one@users.sourceforge.net Sat May 5 11:06:48 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 03:06:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.157,1.158 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv28824/python/dist/src/Misc Modified Files: NEWS Log Message: Make 'x in y' and 'x not in y' (PySequence_Contains) play nice w/ iterators. NEEDS DOC CHANGES A few more AttributeErrors turned into TypeErrors, but in test_contains this time. The full story for instance objects is pretty much unexplainable, because instance_contains() tries its own flavor of iteration-based containment testing first, and PySequence_Contains doesn't get a chance at it unless instance_contains() blows up. A consequence is that some_complex_number in some_instance dies with a TypeError unless some_instance.__class__ defines __iter__ but does not define __getitem__. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -r1.157 -r1.158 *** NEWS 2001/05/05 05:36:48 1.157 --- NEWS 2001/05/05 10:06:15 1.158 *************** *** 24,32 **** min() reduce() ! string.join() tuple() unicode.join() XXX TODO zip() ! XXX TODO 'x in y' What's New in Python 2.1 (final)? --- 24,32 ---- min() reduce() ! .join() method of strings tuple() unicode.join() XXX TODO zip() ! 'x in y' and 'x not in y' What's New in Python 2.1 (final)? From tim_one@users.sourceforge.net Sat May 5 11:14:36 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 03:14:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.158,1.159 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30920/python/dist/src/Misc Modified Files: NEWS Log Message: Remove redundant line. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -r1.158 -r1.159 *** NEWS 2001/05/05 10:06:15 1.158 --- NEWS 2001/05/05 10:14:34 1.159 *************** *** 26,30 **** .join() method of strings tuple() - unicode.join() XXX TODO zip() 'x in y' and 'x not in y' --- 26,29 ---- From tim_one@users.sourceforge.net Sat May 5 12:33:45 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 04:33:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.66,2.67 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7467/python/dist/src/Objects Modified Files: abstract.c Log Message: Generalize PySequence_Count() (operator.countOf) to work with iterators. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.66 retrieving revision 2.67 diff -C2 -r2.66 -r2.67 *** abstract.c 2001/05/05 10:06:16 2.66 --- abstract.c 2001/05/05 11:33:43 2.67 *************** *** 1334,1342 **** } int PySequence_Count(PyObject *s, PyObject *o) { ! int l, i, n, cmp, err; ! PyObject *item; if (s == NULL || o == NULL) { --- 1334,1343 ---- } + /* Return # of times o appears in s. */ int PySequence_Count(PyObject *s, PyObject *o) { ! int n; /* running count of o hits */ ! PyObject *it; /* iter(s) */ if (s == NULL || o == NULL) { *************** *** 1344,1365 **** return -1; } ! ! l = PySequence_Size(s); ! if (l < 0) return -1; n = 0; ! for (i = 0; i < l; i++) { ! item = PySequence_GetItem(s, i); ! if (item == NULL) ! return -1; ! err = PyObject_Cmp(item, o, &cmp); Py_DECREF(item); ! if (err < 0) ! return err; ! if (cmp == 0) n++; } return n; } --- 1345,1383 ---- return -1; } ! ! it = PyObject_GetIter(s); ! if (it == NULL) { ! type_error(".count() requires iterable argument"); return -1; + } n = 0; ! for (;;) { ! int cmp; ! PyObject *item = PyIter_Next(it); ! if (item == NULL) { ! if (PyErr_Occurred()) ! goto Fail; ! break; ! } ! cmp = PyObject_RichCompareBool(o, item, Py_EQ); Py_DECREF(item); ! if (cmp < 0) ! goto Fail; ! if (cmp > 0) { ! if (n == INT_MAX) { ! PyErr_SetString(PyExc_OverflowError, ! "count exceeds C int size"); ! goto Fail; ! } n++; + } } + Py_DECREF(it); return n; + + Fail: + Py_DECREF(it); + return -1; } From tim_one@users.sourceforge.net Sat May 5 12:33:45 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 04:33:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7467/python/dist/src/Lib/test Modified Files: test_iter.py Log Message: Generalize PySequence_Count() (operator.countOf) to work with iterators. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** test_iter.py 2001/05/05 10:06:14 1.12 --- test_iter.py 2001/05/05 11:33:43 1.13 *************** *** 528,530 **** --- 528,565 ---- pass + # Test iterators with operator.countOf (PySequence_Count). + def test_countOf(self): + from operator import countOf + self.assertEqual(countOf([1,2,2,3,2,5], 2), 3) + self.assertEqual(countOf((1,2,2,3,2,5), 2), 3) + self.assertEqual(countOf("122325", "2"), 3) + self.assertEqual(countOf("122325", "6"), 0) + + self.assertRaises(TypeError, countOf, 42, 1) + self.assertRaises(TypeError, countOf, countOf, countOf) + + d = {"one": 3, "two": 3, "three": 3, 1j: 2j} + for k in d: + self.assertEqual(countOf(d, k), 1) + self.assertEqual(countOf(d.itervalues(), 3), 3) + self.assertEqual(countOf(d.itervalues(), 2j), 1) + self.assertEqual(countOf(d.itervalues(), 1j), 0) + + f = open(TESTFN, "w") + try: + f.write("a\n" "b\n" "c\n" "b\n") + finally: + f.close() + f = open(TESTFN, "r") + try: + for letter, count in ("a", 1), ("b", 2), ("c", 1), ("d", 0): + f.seek(0, 0) + self.assertEqual(countOf(f, letter + "\n"), count) + finally: + f.close() + try: + unlink(TESTFN) + except OSError: + pass + run_unittest(TestCase) From tim_one@users.sourceforge.net Sat May 5 12:33:45 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 04:33:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.159,1.160 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv7467/python/dist/src/Misc Modified Files: NEWS Log Message: Generalize PySequence_Count() (operator.countOf) to work with iterators. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -r1.159 -r1.160 *** NEWS 2001/05/05 10:14:34 1.159 --- NEWS 2001/05/05 11:33:43 1.160 *************** *** 24,31 **** min() reduce() .join() method of strings ! tuple() XXX TODO zip() ! 'x in y' and 'x not in y' What's New in Python 2.1 (final)? --- 24,33 ---- min() reduce() + tuple() (PySequence_Tuple() and PySequence_Fast() in C API) .join() method of strings ! 'x in y' and 'x not in y' (PySequence_Contains() in C API) ! operator.countOf() (PySequence_Count() in C API) XXX TODO zip() ! What's New in Python 2.1 (final)? From gvanrossum@users.sourceforge.net Sat May 5 12:37:31 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 05 May 2001 04:37:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include abstract.h,2.31,2.31.2.1 ceval.h,2.41,2.41.4.1 eval.h,2.14,2.14.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv7122/Include Modified Files: Tag: descr-branch abstract.h ceval.h eval.h Log Message: Reorganization of object calling. The call_object() function, originally in ceval.c, begins a new life as the official API PyObject_Call(). It is also much simplified: all it does is call the tp_call slot, or raise an exception if that's NULL. The subsidiary functions (call_eval_code2(), call_cfunction(), call_instance(), and call_method()) have all been moved to the file implementing their particular object type, renamed according to the local convention, and added to the type's tp_call slot. Note that call_eval_code2() became function_call(); the tp_slot for class objects now simply points to PyInstance_New(), which already has the correct signature. Because of these moves, there are some more new APIs that expose helpers in ceval.c that are now needed outside: PyEval_GetFuncName(), PyEval_GetFuncDesc(), PyEval_EvalCodeEx() (formerly get_func_name(), get_func_desc(), and eval_code2(). Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.31 retrieving revision 2.31.2.1 diff -C2 -r2.31 -r2.31.2.1 *** abstract.h 2001/04/23 14:08:49 2.31 --- abstract.h 2001/05/05 11:37:29 2.31.2.1 *************** *** 295,298 **** --- 295,309 ---- + + DL_IMPORT(PyObject *) PyObject_Call(PyObject *callable_object, + PyObject *args, PyObject *kw); + + /* + + Call a callable Python object, callable_object, with + arguments and keywords arguments. The 'args' argument can not be + NULL, but the 'kw' argument can be NULL. + + */ DL_IMPORT(PyObject *) PyObject_CallObject(PyObject *callable_object, Index: ceval.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/ceval.h,v retrieving revision 2.41 retrieving revision 2.41.4.1 diff -C2 -r2.41 -r2.41.4.1 *** ceval.h 2001/03/22 02:32:48 2.41 --- ceval.h 2001/05/05 11:37:29 2.41.4.1 *************** *** 39,42 **** --- 39,45 ---- DL_IMPORT(int) Py_GetRecursionLimit(void); + DL_IMPORT(char *) PyEval_GetFuncName(PyObject *); + DL_IMPORT(char *) PyEval_GetFuncDesc(PyObject *); + /* Interface for threads. Index: eval.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/eval.h,v retrieving revision 2.14 retrieving revision 2.14.8.1 diff -C2 -r2.14 -r2.14.8.1 *** eval.h 2000/09/01 23:29:26 2.14 --- eval.h 2001/05/05 11:37:29 2.14.8.1 *************** *** 10,13 **** --- 10,21 ---- DL_IMPORT(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *); + DL_IMPORT(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co, + PyObject *globals, + PyObject *locals, + PyObject **args, int argc, + PyObject **kwds, int kwdc, + PyObject **defs, int defc, + PyObject *closure); + #ifdef __cplusplus } From gvanrossum@users.sourceforge.net Sat May 5 12:37:31 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 05 May 2001 04:37:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.60.2.1,2.60.2.2 classobject.c,2.127.2.1,2.127.2.2 funcobject.c,2.37,2.37.4.1 methodobject.c,2.33.8.3,2.33.8.4 object.c,2.124.4.6,2.124.4.7 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7122/Objects Modified Files: Tag: descr-branch abstract.c classobject.c funcobject.c methodobject.c object.c Log Message: Reorganization of object calling. The call_object() function, originally in ceval.c, begins a new life as the official API PyObject_Call(). It is also much simplified: all it does is call the tp_call slot, or raise an exception if that's NULL. The subsidiary functions (call_eval_code2(), call_cfunction(), call_instance(), and call_method()) have all been moved to the file implementing their particular object type, renamed according to the local convention, and added to the type's tp_call slot. Note that call_eval_code2() became function_call(); the tp_slot for class objects now simply points to PyInstance_New(), which already has the correct signature. Because of these moves, there are some more new APIs that expose helpers in ceval.c that are now needed outside: PyEval_GetFuncName(), PyEval_GetFuncDesc(), PyEval_EvalCodeEx() (formerly get_func_name(), get_func_desc(), and eval_code2(). Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.60.2.1 retrieving revision 2.60.2.2 diff -C2 -r2.60.2.1 -r2.60.2.2 *** abstract.c 2001/05/04 16:52:44 2.60.2.1 --- abstract.c 2001/05/05 11:37:29 2.60.2.2 *************** *** 1537,1540 **** --- 1537,1558 ---- PyObject * + PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) + { + ternaryfunc call; + + if ((call = func->ob_type->tp_call) != NULL) { + PyObject *result = (*call)(func, arg, kw); + if (result == NULL && !PyErr_Occurred()) + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + return result; + } + PyErr_Format(PyExc_TypeError, "object is not callable: %s", + PyString_AS_STRING(PyObject_Repr(func))); + return NULL; + } + + PyObject * PyObject_CallFunction(PyObject *callable, char *format, ...) { Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.127.2.1 retrieving revision 2.127.2.2 diff -C2 -r2.127.2.1 -r2.127.2.2 *** classobject.c 2001/04/30 14:37:19 2.127.2.1 --- classobject.c 2001/05/05 11:37:29 2.127.2.2 *************** *** 397,401 **** 0, /* tp_as_mapping */ 0, /* tp_hash */ ! 0, /* tp_call */ (reprfunc)class_str, /* tp_str */ (getattrofunc)class_getattr, /* tp_getattro */ --- 397,401 ---- 0, /* tp_as_mapping */ 0, /* tp_hash */ ! PyInstance_New, /* tp_call */ (reprfunc)class_str, /* tp_str */ (getattrofunc)class_getattr, /* tp_getattro */ *************** *** 1792,1795 **** --- 1792,1812 ---- } + static PyObject * + instance_call(PyObject *func, PyObject *arg, PyObject *kw) + { + PyObject *res, *call = PyObject_GetAttrString(func, "__call__"); + if (call == NULL) { + PyInstanceObject *inst = (PyInstanceObject*) func; + PyErr_Clear(); + PyErr_Format(PyExc_AttributeError, + "%.200s instance has no __call__ method", + PyString_AsString(inst->in_class->cl_name)); + return NULL; + } + res = PyObject_Call(call, arg, kw); + Py_DECREF(call); + return res; + } + static PyNumberMethods instance_as_number = { *************** *** 1846,1850 **** &instance_as_mapping, /* tp_as_mapping */ (hashfunc)instance_hash, /* tp_hash */ ! 0, /* tp_call */ (reprfunc)instance_str, /* tp_str */ (getattrofunc)instance_getattr, /* tp_getattro */ --- 1863,1867 ---- &instance_as_mapping, /* tp_as_mapping */ (hashfunc)instance_hash, /* tp_hash */ ! instance_call, /* tp_call */ (reprfunc)instance_str, /* tp_str */ (getattrofunc)instance_getattr, /* tp_getattro */ *************** *** 2083,2086 **** --- 2100,2154 ---- } + static PyObject * + instancemethod_call(PyObject *func, PyObject *arg, PyObject *kw) + { + PyObject *self = PyMethod_GET_SELF(func); + PyObject *class = PyMethod_GET_CLASS(func); + PyObject *result; + + func = PyMethod_GET_FUNCTION(func); + if (self == NULL) { + /* Unbound methods must be called with an instance of + the class (or a derived class) as first argument */ + int ok; + if (PyTuple_Size(arg) >= 1) + self = PyTuple_GET_ITEM(arg, 0); + if (self == NULL) + ok = 0; + else { + ok = PyObject_IsInstance(self, class); + if (ok < 0) + return NULL; + } + if (!ok) { + PyErr_Format(PyExc_TypeError, + "unbound method %s%s must be " + "called with instance as first argument", + PyEval_GetFuncName(func), + PyEval_GetFuncDesc(func)); + return NULL; + } + Py_INCREF(arg); + } + else { + int argcount = PyTuple_Size(arg); + PyObject *newarg = PyTuple_New(argcount + 1); + int i; + if (newarg == NULL) + return NULL; + Py_INCREF(self); + PyTuple_SET_ITEM(newarg, 0, self); + for (i = 0; i < argcount; i++) { + PyObject *v = PyTuple_GET_ITEM(arg, i); + Py_XINCREF(v); + PyTuple_SET_ITEM(newarg, i+1, v); + } + arg = newarg; + } + result = PyObject_Call((PyObject *)func, arg, kw); + Py_DECREF(arg); + return result; + } + PyTypeObject PyMethod_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 2099,2108 **** 0, /* tp_as_mapping */ (hashfunc)instancemethod_hash, /* tp_hash */ ! 0, /* tp_call */ 0, /* tp_str */ (getattrofunc)instancemethod_getattro, /* tp_getattro */ (setattrofunc)instancemethod_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC | Py_TPFLAGS_HAVE_WEAKREFS, 0, /* tp_doc */ (traverseproc)instancemethod_traverse, /* tp_traverse */ --- 2167,2176 ---- 0, /* tp_as_mapping */ (hashfunc)instancemethod_hash, /* tp_hash */ ! instancemethod_call, /* tp_call */ 0, /* tp_str */ (getattrofunc)instancemethod_getattro, /* tp_getattro */ (setattrofunc)instancemethod_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, 0, /* tp_doc */ (traverseproc)instancemethod_traverse, /* tp_traverse */ Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.37 retrieving revision 2.37.4.1 diff -C2 -r2.37 -r2.37.4.1 *** funcobject.c 2001/03/23 04:19:27 2.37 --- funcobject.c 2001/05/05 11:37:29 2.37.4.1 *************** *** 4,7 **** --- 4,8 ---- #include "Python.h" #include "compile.h" + #include "eval.h" #include "structmember.h" *************** *** 315,318 **** --- 316,370 ---- } + static PyObject * + function_call(PyObject *func, PyObject *arg, PyObject *kw) + { + PyObject *result; + PyObject *argdefs; + PyObject **d, **k; + int nk, nd; + + argdefs = PyFunction_GET_DEFAULTS(func); + if (argdefs != NULL && PyTuple_Check(argdefs)) { + d = &PyTuple_GET_ITEM((PyTupleObject *)argdefs, 0); + nd = PyTuple_Size(argdefs); + } + else { + d = NULL; + nd = 0; + } + + if (kw != NULL && PyDict_Check(kw)) { + int pos, i; + nk = PyDict_Size(kw); + k = PyMem_NEW(PyObject *, 2*nk); + if (k == NULL) { + PyErr_NoMemory(); + Py_DECREF(arg); + return NULL; + } + pos = i = 0; + while (PyDict_Next(kw, &pos, &k[i], &k[i+1])) + i += 2; + nk = i/2; + /* XXX This is broken if the caller deletes dict items! */ + } + else { + k = NULL; + nk = 0; + } + + result = PyEval_EvalCodeEx( + (PyCodeObject *)PyFunction_GET_CODE(func), + PyFunction_GET_GLOBALS(func), (PyObject *)NULL, + &PyTuple_GET_ITEM(arg, 0), PyTuple_Size(arg), + k, nk, d, nd, + PyFunction_GET_CLOSURE(func)); + + if (k != NULL) + PyMem_DEL(k); + + return result; + } + PyTypeObject PyFunction_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 331,340 **** 0, /*tp_as_mapping*/ 0, /*tp_hash*/ ! 0, /*tp_call*/ 0, /*tp_str*/ (getattrofunc)func_getattro, /*tp_getattro*/ (setattrofunc)func_setattro, /*tp_setattro*/ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC | Py_TPFLAGS_HAVE_WEAKREFS, 0, /* tp_doc */ (traverseproc)func_traverse, /* tp_traverse */ --- 383,392 ---- 0, /*tp_as_mapping*/ 0, /*tp_hash*/ ! function_call, /*tp_call*/ 0, /*tp_str*/ (getattrofunc)func_getattro, /*tp_getattro*/ (setattrofunc)func_setattro, /*tp_setattro*/ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, 0, /* tp_doc */ (traverseproc)func_traverse, /* tp_traverse */ Index: methodobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/methodobject.c,v retrieving revision 2.33.8.3 retrieving revision 2.33.8.4 diff -C2 -r2.33.8.3 -r2.33.8.4 *** methodobject.c 2001/04/27 18:04:51 2.33.8.3 --- methodobject.c 2001/05/05 11:37:29 2.33.8.4 *************** *** 153,156 **** --- 153,191 ---- } + static PyObject * + meth_call(PyObject *func, PyObject *arg, PyObject *kw) + { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); + + if (flags & METH_KEYWORDS) { + return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); + } + if (kw != NULL && PyDict_Size(kw) != 0) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; + } + if (flags & METH_VARARGS) { + return (*meth)(self, arg); + } + if (!(flags & METH_VARARGS)) { + /* the really old style */ + int size = PyTuple_GET_SIZE(arg); + if (size == 1) + arg = PyTuple_GET_ITEM(arg, 0); + else if (size == 0) + arg = NULL; + return (*meth)(self, arg); + } + /* should never get here ??? */ + PyErr_BadInternalCall(); + return NULL; + } + + PyTypeObject PyCFunction_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 169,173 **** 0, /* tp_as_mapping */ (hashfunc)meth_hash, /* tp_hash */ ! 0, /* tp_call */ 0, /* tp_str */ PyGeneric_GetAttr, /* tp_getattro */ --- 204,208 ---- 0, /* tp_as_mapping */ (hashfunc)meth_hash, /* tp_hash */ ! meth_call, /* tp_call */ 0, /* tp_str */ PyGeneric_GetAttr, /* tp_getattro */ Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.4.6 retrieving revision 2.124.4.7 diff -C2 -r2.124.4.6 -r2.124.4.7 *** object.c 2001/05/04 16:50:22 2.124.4.6 --- object.c 2001/05/05 11:37:29 2.124.4.7 *************** *** 1209,1218 **** if (x == NULL) return 0; - if (x->ob_type->tp_call != NULL || - PyFunction_Check(x) || - PyMethod_Check(x) || - PyCFunction_Check(x) || - PyClass_Check(x)) - return 1; if (PyInstance_Check(x)) { PyObject *call = PyObject_GetAttrString(x, "__call__"); --- 1209,1212 ---- *************** *** 1225,1230 **** Py_DECREF(call); return 1; } - return 0; } --- 1219,1226 ---- Py_DECREF(call); return 1; + } + else { + return x->ob_type->tp_call != NULL; } } From gvanrossum@users.sourceforge.net Sat May 5 12:37:31 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 05 May 2001 04:37:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.241,2.241.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv7122/Python Modified Files: Tag: descr-branch ceval.c Log Message: Reorganization of object calling. The call_object() function, originally in ceval.c, begins a new life as the official API PyObject_Call(). It is also much simplified: all it does is call the tp_call slot, or raise an exception if that's NULL. The subsidiary functions (call_eval_code2(), call_cfunction(), call_instance(), and call_method()) have all been moved to the file implementing their particular object type, renamed according to the local convention, and added to the type's tp_call slot. Note that call_eval_code2() became function_call(); the tp_slot for class objects now simply points to PyInstance_New(), which already has the correct signature. Because of these moves, there are some more new APIs that expose helpers in ceval.c that are now needed outside: PyEval_GetFuncName(), PyEval_GetFuncDesc(), PyEval_EvalCodeEx() (formerly get_func_name(), get_func_desc(), and eval_code2(). Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.241 retrieving revision 2.241.2.1 diff -C2 -r2.241 -r2.241.2.1 *** ceval.c 2001/04/23 14:08:49 2.241 --- ceval.c 2001/05/05 11:37:29 2.241.2.1 *************** *** 34,51 **** /* Forward declarations */ - static PyObject *eval_code2(PyCodeObject *, - PyObject *, PyObject *, - PyObject **, int, - PyObject **, int, - PyObject **, int, - PyObject *); - - static char *get_func_name(PyObject *); - static char *get_func_desc(PyObject *); - static PyObject *call_object(PyObject *, PyObject *, PyObject *); - static PyObject *call_cfunction(PyObject *, PyObject *, PyObject *); - static PyObject *call_instance(PyObject *, PyObject *, PyObject *); - static PyObject *call_method(PyObject *, PyObject *, PyObject *); - static PyObject *call_eval_code2(PyObject *, PyObject *, PyObject *); static PyObject *fast_function(PyObject *, PyObject ***, int, int, int); static PyObject *fast_cfunction(PyObject *, PyObject ***, int); --- 34,37 ---- *************** *** 339,343 **** PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals) { ! return eval_code2(co, globals, locals, (PyObject **)NULL, 0, --- 325,329 ---- PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals) { ! return PyEval_EvalCodeEx(co, globals, locals, (PyObject **)NULL, 0, *************** *** 350,355 **** /* Interpreter main loop */ ! static PyObject * ! eval_code2(PyCodeObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, PyObject **defs, int defcount, PyObject *closure) --- 336,341 ---- /* Interpreter main loop */ ! PyObject * ! PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, PyObject **defs, int defcount, PyObject *closure) *************** *** 426,430 **** if (globals == NULL) { ! PyErr_SetString(PyExc_SystemError, "eval_code2: NULL globals"); return NULL; } --- 412,417 ---- if (globals == NULL) { ! PyErr_SetString(PyExc_SystemError, ! "PyEval_EvalCodeEx: NULL globals"); return NULL; } *************** *** 2761,2765 **** } ! result = call_object(func, arg, kw); Py_DECREF(arg); return result; --- 2748,2752 ---- } ! result = PyObject_Call(func, arg, kw); Py_DECREF(arg); return result; *************** *** 2767,2771 **** /* How often is each kind of object called? The answer depends on the ! program. An instrumented call_object() was used to run the Python regression test suite. The results were: 4200000 PyCFunctions --- 2754,2758 ---- /* How often is each kind of object called? The answer depends on the ! program. An instrumented PyObject_Call() was used to run the Python regression test suite. The results were: 4200000 PyCFunctions *************** *** 2780,2788 **** */ ! static char * ! get_func_name(PyObject *func) { if (PyMethod_Check(func)) ! return get_func_name(PyMethod_GET_FUNCTION(func)); else if (PyFunction_Check(func)) return PyString_AsString(((PyFunctionObject*)func)->func_name); --- 2767,2775 ---- */ ! char * ! PyEval_GetFuncName(PyObject *func) { if (PyMethod_Check(func)) ! return PyEval_GetFuncName(PyMethod_GET_FUNCTION(func)); else if (PyFunction_Check(func)) return PyString_AsString(((PyFunctionObject*)func)->func_name); *************** *** 2799,2804 **** } ! static char * ! get_func_desc(PyObject *func) { if (PyMethod_Check(func)) --- 2786,2791 ---- } ! char * ! PyEval_GetFuncDesc(PyObject *func) { if (PyMethod_Check(func)) *************** *** 2817,3002 **** } - static PyObject * - call_object(PyObject *func, PyObject *arg, PyObject *kw) - { - ternaryfunc call; - PyObject *result; - - if (PyMethod_Check(func)) - result = call_method(func, arg, kw); - else if (PyFunction_Check(func)) - result = call_eval_code2(func, arg, kw); - else if (PyCFunction_Check(func)) - result = call_cfunction(func, arg, kw); - else if (PyClass_Check(func)) - result = PyInstance_New(func, arg, kw); - else if (PyInstance_Check(func)) - result = call_instance(func, arg, kw); - else if ((call = func->ob_type->tp_call) != NULL) - result = (*call)(func, arg, kw); - else { - PyErr_Format(PyExc_TypeError, "object is not callable: %s", - PyString_AS_STRING(PyObject_Repr(func))); - return NULL; - } - if (result == NULL && !PyErr_Occurred()) - PyErr_SetString(PyExc_SystemError, - "NULL result without error in call_object"); - - return result; - } - - static PyObject * - call_cfunction(PyObject *func, PyObject *arg, PyObject *kw) - { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - - if (flags & METH_KEYWORDS) { - return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); - } - if (kw != NULL && PyDict_Size(kw) != 0) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; - } - if (flags & METH_VARARGS) { - return (*meth)(self, arg); - } - if (!(flags & METH_VARARGS)) { - /* the really old style */ - int size = PyTuple_GET_SIZE(arg); - if (size == 1) - arg = PyTuple_GET_ITEM(arg, 0); - else if (size == 0) - arg = NULL; - return (*meth)(self, arg); - } - /* should never get here ??? */ - PyErr_BadInternalCall(); - return NULL; - } - - static PyObject * - call_instance(PyObject *func, PyObject *arg, PyObject *kw) - { - PyObject *res, *call = PyObject_GetAttrString(func, "__call__"); - if (call == NULL) { - PyInstanceObject *inst = (PyInstanceObject*) func; - PyErr_Clear(); - PyErr_Format(PyExc_AttributeError, - "%.200s instance has no __call__ method", - PyString_AsString(inst->in_class->cl_name)); - return NULL; - } - res = call_object(call, arg, kw); - Py_DECREF(call); - return res; - } - - static PyObject * - call_method(PyObject *func, PyObject *arg, PyObject *kw) - { - PyObject *self = PyMethod_GET_SELF(func); - PyObject *class = PyMethod_GET_CLASS(func); - PyObject *result; - - func = PyMethod_GET_FUNCTION(func); - if (self == NULL) { - /* Unbound methods must be called with an instance of - the class (or a derived class) as first argument */ - int ok; - if (PyTuple_Size(arg) >= 1) - self = PyTuple_GET_ITEM(arg, 0); - if (self == NULL) - ok = 0; - else { - ok = PyObject_IsInstance(self, class); - if (ok < 0) - return NULL; - } - if (!ok) { - PyErr_Format(PyExc_TypeError, - "unbound method %s%s must be " - "called with instance as first argument", - get_func_name(func), get_func_desc(func)); - return NULL; - } - Py_INCREF(arg); - } - else { - int argcount = PyTuple_Size(arg); - PyObject *newarg = PyTuple_New(argcount + 1); - int i; - if (newarg == NULL) - return NULL; - Py_INCREF(self); - PyTuple_SET_ITEM(newarg, 0, self); - for (i = 0; i < argcount; i++) { - PyObject *v = PyTuple_GET_ITEM(arg, i); - Py_XINCREF(v); - PyTuple_SET_ITEM(newarg, i+1, v); - } - arg = newarg; - } - result = call_object(func, arg, kw); - Py_DECREF(arg); - return result; - } - - static PyObject * - call_eval_code2(PyObject *func, PyObject *arg, PyObject *kw) - { - PyObject *result; - PyObject *argdefs; - PyObject **d, **k; - int nk, nd; - - argdefs = PyFunction_GET_DEFAULTS(func); - if (argdefs != NULL && PyTuple_Check(argdefs)) { - d = &PyTuple_GET_ITEM((PyTupleObject *)argdefs, 0); - nd = PyTuple_Size(argdefs); - } - else { - d = NULL; - nd = 0; - } - - if (kw != NULL) { - int pos, i; - nk = PyDict_Size(kw); - k = PyMem_NEW(PyObject *, 2*nk); - if (k == NULL) { - PyErr_NoMemory(); - Py_DECREF(arg); - return NULL; - } - pos = i = 0; - while (PyDict_Next(kw, &pos, &k[i], &k[i+1])) - i += 2; - nk = i/2; - /* XXX This is broken if the caller deletes dict items! */ - } - else { - k = NULL; - nk = 0; - } - - result = eval_code2( - (PyCodeObject *)PyFunction_GET_CODE(func), - PyFunction_GET_GLOBALS(func), (PyObject *)NULL, - &PyTuple_GET_ITEM(arg, 0), PyTuple_Size(arg), - k, nk, d, nd, - PyFunction_GET_CLOSURE(func)); - - if (k != NULL) - PyMem_DEL(k); - - return result; - } - #define EXT_POP(STACK_POINTER) (*--(STACK_POINTER)) --- 2804,2807 ---- *************** *** 3042,3046 **** nd = ((PyTupleObject *)argdefs)->ob_size; } ! return eval_code2((PyCodeObject *)co, globals, (PyObject *)NULL, (*pp_stack)-n, na, (*pp_stack)-2*nk, nk, d, nd, --- 2847,2851 ---- nd = ((PyTupleObject *)argdefs)->ob_size; } ! return PyEval_EvalCodeEx((PyCodeObject *)co, globals, (PyObject *)NULL, (*pp_stack)-n, na, (*pp_stack)-2*nk, nk, d, nd, *************** *** 3069,3074 **** "%.200s%s got multiple values " "for keyword argument '%.200s'", ! get_func_name(func), ! get_func_desc(func), PyString_AsString(key)); Py_DECREF(key); --- 2874,2879 ---- "%.200s%s got multiple values " "for keyword argument '%.200s'", ! PyEval_GetFuncName(func), ! PyEval_GetFuncDesc(func), PyString_AsString(key)); Py_DECREF(key); *************** *** 3143,3147 **** if (callargs == NULL) goto call_fail; ! result = call_object(func, callargs, kwdict); call_fail: Py_XDECREF(callargs); --- 2948,2952 ---- if (callargs == NULL) goto call_fail; ! result = PyObject_Call(func, callargs, kwdict); call_fail: Py_XDECREF(callargs); *************** *** 3165,3170 **** "%s%s argument after ** " "must be a dictionary", ! get_func_name(func), ! get_func_desc(func)); goto ext_call_fail; } --- 2970,2975 ---- "%s%s argument after ** " "must be a dictionary", ! PyEval_GetFuncName(func), ! PyEval_GetFuncDesc(func)); goto ext_call_fail; } *************** *** 3180,3185 **** "%s%s argument after * " "must be a sequence", ! get_func_name(func), ! get_func_desc(func)); } goto ext_call_fail; --- 2985,2990 ---- "%s%s argument after * " "must be a sequence", ! PyEval_GetFuncName(func), ! PyEval_GetFuncDesc(func)); } goto ext_call_fail; *************** *** 3198,3202 **** if (callargs == NULL) goto ext_call_fail; ! result = call_object(func, callargs, kwdict); ext_call_fail: Py_XDECREF(callargs); --- 3003,3007 ---- if (callargs == NULL) goto ext_call_fail; ! result = PyObject_Call(func, callargs, kwdict); ext_call_fail: Py_XDECREF(callargs); From gvanrossum@users.sourceforge.net Sat May 5 16:55:49 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 05 May 2001 08:55:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules Setup.dist,1.21,1.21.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv11847 Modified Files: Tag: descr-branch Setup.dist Log Message: Add the spam example module. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.21 retrieving revision 1.21.4.1 diff -C2 -r1.21 -r1.21.4.1 *** Setup.dist 2001/03/22 22:18:55 1.21 --- Setup.dist 2001/05/05 15:55:47 1.21.4.1 *************** *** 465,466 **** --- 465,468 ---- # xx xxmodule.c + # Another example -- the 'spam' module shows C-level subtyping in action + spam spam.c From tim_one@users.sourceforge.net Sat May 5 22:05:03 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 14:05:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include abstract.h,2.33,2.34 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv30187/python/dist/src/Include Modified Files: abstract.h Log Message: Reimplement PySequence_Contains() and instance_contains(), so they work safely together and don't duplicate logic (the common logic was factored out into new private API function _PySequence_IterContains()). Visible change: some_complex_number in some_instance no longer blows up if some_instance has __getitem__ but neither __contains__ nor __iter__. test_iter changed to ensure that remains true. Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.33 retrieving revision 2.34 diff -C2 -r2.33 -r2.34 *** abstract.h 2001/05/05 03:56:37 2.33 --- abstract.h 2001/05/05 21:05:01 2.34 *************** *** 933,937 **** */ ! DL_IMPORT(int) PySequence_Contains(PyObject *o, PyObject *value); /* For DLL-level backwards compatibility */ --- 933,947 ---- */ ! DL_IMPORT(int) PySequence_Contains(PyObject *seq, PyObject *ob); ! /* ! Return -1 if error; 1 if ob in seq; 0 if ob not in seq. ! Use __contains__ if possible, else _PySequence_IterContains(). ! */ ! ! DL_IMPORT(int) _PySequence_IterContains(PyObject *seq, PyObject *ob); ! /* ! Return -1 if error; 1 if ob in seq; 0 if ob not in seq. ! Always uses the iteration protocol, and only Py_EQ comparisons. ! */ /* For DLL-level backwards compatibility */ From tim_one@users.sourceforge.net Sat May 5 22:05:04 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 14:05:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.67,2.68 classobject.c,2.129,2.130 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30187/python/dist/src/Objects Modified Files: abstract.c classobject.c Log Message: Reimplement PySequence_Contains() and instance_contains(), so they work safely together and don't duplicate logic (the common logic was factored out into new private API function _PySequence_IterContains()). Visible change: some_complex_number in some_instance no longer blows up if some_instance has __getitem__ but neither __contains__ nor __iter__. test_iter changed to ensure that remains true. Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.67 retrieving revision 2.68 diff -C2 -r2.67 -r2.68 *** abstract.c 2001/05/05 11:33:43 2.67 --- abstract.c 2001/05/05 21:05:01 2.68 *************** *** 1382,1408 **** } ! /* Return -1 if error; 1 if v in w; 0 if v not in w. */ int ! PySequence_Contains(PyObject *w, PyObject *v) /* v in w */ { - PyObject *it; /* iter(w) */ int result; ! ! if (PyType_HasFeature(w->ob_type, Py_TPFLAGS_HAVE_SEQUENCE_IN)) { ! PySequenceMethods *sq = w->ob_type->tp_as_sequence; ! if (sq != NULL && sq->sq_contains != NULL) { ! result = (*sq->sq_contains)(w, v); ! if (result >= 0) ! return result; ! assert(PyErr_Occurred()); ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) ! PyErr_Clear(); ! else ! return result; ! } ! } ! ! /* Try exhaustive iteration. */ ! it = PyObject_GetIter(w); if (it == NULL) { PyErr_SetString(PyExc_TypeError, --- 1382,1393 ---- } ! /* Return -1 if error; 1 if ob in seq; 0 if ob not in seq. ! * Always uses the iteration protocol, and only Py_EQ comparison. ! */ int ! _PySequence_IterContains(PyObject *seq, PyObject *ob) { int result; ! PyObject *it = PyObject_GetIter(seq); if (it == NULL) { PyErr_SetString(PyExc_TypeError, *************** *** 1418,1422 **** break; } ! cmp = PyObject_RichCompareBool(v, item, Py_EQ); Py_DECREF(item); if (cmp == 0) --- 1403,1407 ---- break; } ! cmp = PyObject_RichCompareBool(ob, item, Py_EQ); Py_DECREF(item); if (cmp == 0) *************** *** 1427,1430 **** --- 1412,1429 ---- Py_DECREF(it); return result; + } + + /* Return -1 if error; 1 if ob in seq; 0 if ob not in seq. + * Use sq_contains if possible, else defer to _PySequence_IterContains(). + */ + int + PySequence_Contains(PyObject *seq, PyObject *ob) + { + if (PyType_HasFeature(seq->ob_type, Py_TPFLAGS_HAVE_SEQUENCE_IN)) { + PySequenceMethods *sqm = seq->ob_type->tp_as_sequence; + if (sqm != NULL && sqm->sq_contains != NULL) + return (*sqm->sq_contains)(seq, ob); + } + return _PySequence_IterContains(seq, ob); } Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.129 retrieving revision 2.130 diff -C2 -r2.129 -r2.130 *** classobject.c 2001/05/03 16:04:13 2.129 --- classobject.c 2001/05/05 21:05:01 2.130 *************** *** 1132,1141 **** } ! static int instance_contains(PyInstanceObject *inst, PyObject *member) { static PyObject *__contains__; ! PyObject *func, *arg, *res; ! int ret; if(__contains__ == NULL) { __contains__ = PyString_InternFromString("__contains__"); --- 1132,1145 ---- } ! static int ! instance_contains(PyInstanceObject *inst, PyObject *member) { static PyObject *__contains__; ! PyObject *func; + /* Try __contains__ first. + * If that can't be done, try iterator-based searching. + */ + if(__contains__ == NULL) { __contains__ = PyString_InternFromString("__contains__"); *************** *** 1144,1186 **** } func = instance_getattr(inst, __contains__); ! if(func == NULL) { ! /* fall back to previous behavior */ ! int i, cmp_res; ! ! if(!PyErr_ExceptionMatches(PyExc_AttributeError)) return -1; - PyErr_Clear(); - for(i=0;;i++) { - PyObject *obj = instance_item(inst, i); - int ret = 0; - - if(obj == NULL) { - if(!PyErr_ExceptionMatches(PyExc_IndexError)) - return -1; - PyErr_Clear(); - return 0; - } - if(PyObject_Cmp(obj, member, &cmp_res) == -1) - ret = -1; - if(cmp_res == 0) - ret = 1; - Py_DECREF(obj); - if(ret) - return ret; } ! } ! arg = Py_BuildValue("(O)", member); ! if(arg == NULL) { Py_DECREF(func); ! return -1; } ! res = PyEval_CallObject(func, arg); ! Py_DECREF(func); ! Py_DECREF(arg); ! if(res == NULL) return -1; - ret = PyObject_IsTrue(res); - Py_DECREF(res); - return ret; } --- 1148,1179 ---- } func = instance_getattr(inst, __contains__); ! if (func) { ! PyObject *res; ! int ret; ! PyObject *arg = Py_BuildValue("(O)", member); ! if(arg == NULL) { ! Py_DECREF(func); return -1; } ! res = PyEval_CallObject(func, arg); Py_DECREF(func); ! Py_DECREF(arg); ! if(res == NULL) ! return -1; ! ret = PyObject_IsTrue(res); ! Py_DECREF(res); ! return ret; ! } ! ! /* Couldn't find __contains__. */ ! if (PyErr_ExceptionMatches(PyExc_AttributeError)) { ! /* Assume the failure was simply due to that there is no ! * __contains__ attribute, and try iterating instead. ! */ ! PyErr_Clear(); ! return _PySequence_IterContains((PyObject *)inst, member); } ! else return -1; } From tim_one@users.sourceforge.net Sat May 5 22:05:03 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 14:05:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv30187/python/dist/src/Lib/test Modified Files: test_iter.py Log Message: Reimplement PySequence_Contains() and instance_contains(), so they work safely together and don't duplicate logic (the common logic was factored out into new private API function _PySequence_IterContains()). Visible change: some_complex_number in some_instance no longer blows up if some_instance has __getitem__ but neither __contains__ nor __iter__. test_iter changed to ensure that remains true. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** test_iter.py 2001/05/05 11:33:43 1.13 --- test_iter.py 2001/05/05 21:05:01 1.14 *************** *** 475,496 **** # Test iterators with 'x in y' and 'x not in y'. def test_in_and_not_in(self): ! sc5 = IteratingSequenceClass(5) ! for i in range(5): ! self.assert_(i in sc5) ! # CAUTION: This test fails on 3-12j if sc5 is SequenceClass(5) ! # instead, with: ! # TypeError: cannot compare complex numbers using <, <=, >, >= ! # The trail leads back to instance_contains() in classobject.c, ! # under comment: ! # /* fall back to previous behavior */ ! # IteratingSequenceClass(5) avoids the same problem only because ! # it lacks __getitem__: instance_contains *tries* to do a wrong ! # thing with it too, but aborts with an AttributeError the first ! # time it calls instance_item(); PySequence_Contains() then catches ! # that and clears it, and tries the iterator-based "contains" ! # instead. But this is hanging together by a thread. ! for i in "abc", -1, 5, 42.42, (3, 4), [], {1: 1}, 3-12j, sc5: ! self.assert_(i not in sc5) ! del sc5 self.assertRaises(TypeError, lambda: 3 in 12) --- 475,484 ---- # Test iterators with 'x in y' and 'x not in y'. def test_in_and_not_in(self): ! for sc5 in IteratingSequenceClass(5), SequenceClass(5): ! for i in range(5): ! self.assert_(i in sc5) ! for i in "abc", -1, 5, 42.42, (3, 4), [], {1: 1}, 3-12j, sc5: ! self.assert_(i not in sc5) ! del sc5 self.assertRaises(TypeError, lambda: 3 in 12) From tim_one@users.sourceforge.net Sat May 5 22:36:54 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 14:36:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_iter.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv3013/python/dist/src/Lib/test Modified Files: test_iter.py Log Message: Get rid of silly 5am "del" stmts. Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** test_iter.py 2001/05/05 21:05:01 1.14 --- test_iter.py 2001/05/05 21:36:52 1.15 *************** *** 480,484 **** for i in "abc", -1, 5, 42.42, (3, 4), [], {1: 1}, 3-12j, sc5: self.assert_(i not in sc5) - del sc5 self.assertRaises(TypeError, lambda: 3 in 12) --- 480,483 ---- *************** *** 495,499 **** self.assert_((k, v) in d.iteritems()) self.assert_((v, k) not in d.iteritems()) - del d f = open(TESTFN, "w") --- 494,497 ---- From tim_one@users.sourceforge.net Sun May 6 02:05:03 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 18:05:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_b2.py,1.24,1.25 test_iter.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31904/python/dist/src/Lib/test Modified Files: test_b2.py test_iter.py Log Message: Generalize zip() to work with iterators. NEEDS DOC CHANGES. More AttributeErrors transmuted into TypeErrors, in test_b2.py, and, again, this strikes me as a good thing. This checkin completes the iterator generalization work that obviously needed to be done. Can anyone think of others that should be changed? Index: test_b2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b2.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** test_b2.py 2001/01/19 21:57:52 1.24 --- test_b2.py 2001/05/06 01:05:01 1.25 *************** *** 310,314 **** try: zip(a, G()) ! except AttributeError: exc = 1 except: --- 310,314 ---- try: zip(a, G()) ! except TypeError: exc = 1 except: *************** *** 316,320 **** raise TestFailed, 'zip(a, b) - b instance w/o __getitem__' if not exc: ! raise TestFailed, 'zip(a, b) - missing expected AttributeError' --- 316,320 ---- raise TestFailed, 'zip(a, b) - b instance w/o __getitem__' if not exc: ! raise TestFailed, 'zip(a, b) - missing expected TypeError' Index: test_iter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_iter.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** test_iter.py 2001/05/05 21:36:52 1.15 --- test_iter.py 2001/05/06 01:05:01 1.16 *************** *** 419,422 **** --- 419,468 ---- pass + # Test zip()'s use of iterators. + def test_builtin_zip(self): + self.assertRaises(TypeError, zip) + self.assertRaises(TypeError, zip, None) + self.assertRaises(TypeError, zip, range(10), 42) + self.assertRaises(TypeError, zip, range(10), zip) + + self.assertEqual(zip(IteratingSequenceClass(3)), + [(0,), (1,), (2,)]) + self.assertEqual(zip(SequenceClass(3)), + [(0,), (1,), (2,)]) + + d = {"one": 1, "two": 2, "three": 3} + self.assertEqual(d.items(), zip(d, d.itervalues())) + + # Generate all ints starting at constructor arg. + class IntsFrom: + def __init__(self, start): + self.i = start + + def __iter__(self): + return self + + def next(self): + i = self.i + self.i = i+1 + return i + + f = open(TESTFN, "w") + try: + f.write("a\n" "bbb\n" "cc\n") + finally: + f.close() + f = open(TESTFN, "r") + try: + self.assertEqual(zip(IntsFrom(0), f, IntsFrom(-100)), + [(0, "a\n", -100), + (1, "bbb\n", -99), + (2, "cc\n", -98)]) + finally: + f.close() + try: + unlink(TESTFN) + except OSError: + pass + # Test reduces()'s use of iterators. def test_builtin_reduce(self): From tim_one@users.sourceforge.net Sun May 6 02:05:04 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 18:05:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.204,2.205 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv31904/python/dist/src/Python Modified Files: bltinmodule.c Log Message: Generalize zip() to work with iterators. NEEDS DOC CHANGES. More AttributeErrors transmuted into TypeErrors, in test_b2.py, and, again, this strikes me as a good thing. This checkin completes the iterator generalization work that obviously needed to be done. Can anyone think of others that should be changed? Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.204 retrieving revision 2.205 diff -C2 -r2.204 -r2.205 *** bltinmodule.c 2001/05/05 00:14:56 2.204 --- bltinmodule.c 2001/05/06 01:05:02 2.205 *************** *** 2103,2107 **** PyObject *ret; int itemsize = PySequence_Length(args); ! int i, j; if (itemsize < 1) { --- 2103,2108 ---- PyObject *ret; int itemsize = PySequence_Length(args); ! int i; ! PyObject *itlist; /* tuple of iterators */ if (itemsize < 1) { *************** *** 2113,2145 **** assert(PyTuple_Check(args)); if ((ret = PyList_New(0)) == NULL) return NULL; ! for (i = 0;; i++) { ! PyObject *next = PyTuple_New(itemsize); ! if (!next) { ! Py_DECREF(ret); ! return NULL; } ! for (j = 0; j < itemsize; j++) { ! PyObject *seq = PyTuple_GET_ITEM(args, j); ! PyObject *item = PySequence_GetItem(seq, i); if (!item) { ! if (PyErr_ExceptionMatches(PyExc_IndexError)) { ! PyErr_Clear(); ! Py_DECREF(next); ! return ret; } Py_DECREF(next); ! Py_DECREF(ret); ! return NULL; } ! PyTuple_SET_ITEM(next, j, item); } ! PyList_Append(ret, next); Py_DECREF(next); } ! /* no return */ } --- 2114,2171 ---- assert(PyTuple_Check(args)); + /* allocate result list */ if ((ret = PyList_New(0)) == NULL) return NULL; ! /* obtain iterators */ ! itlist = PyTuple_New(itemsize); ! if (itlist == NULL) ! goto Fail_ret; ! for (i = 0; i < itemsize; ++i) { ! PyObject *item = PyTuple_GET_ITEM(args, i); ! PyObject *it = PyObject_GetIter(item); ! if (it == NULL) { ! if (PyErr_ExceptionMatches(PyExc_TypeError)) ! PyErr_Format(PyExc_TypeError, ! "zip argument #%d must support iteration", ! i+1); ! goto Fail_ret_itlist; } ! PyTuple_SET_ITEM(itlist, i, it); ! } ! ! /* build result into ret list */ ! for (;;) { ! int status; ! PyObject *next = PyTuple_New(itemsize); ! if (!next) ! goto Fail_ret_itlist; + for (i = 0; i < itemsize; i++) { + PyObject *it = PyTuple_GET_ITEM(itlist, i); + PyObject *item = PyIter_Next(it); if (!item) { ! if (PyErr_Occurred()) { ! Py_DECREF(ret); ! ret = NULL; } Py_DECREF(next); ! Py_DECREF(itlist); ! return ret; } ! PyTuple_SET_ITEM(next, i, item); } ! ! status = PyList_Append(ret, next); Py_DECREF(next); + if (status < 0) + goto Fail_ret_itlist; } ! ! Fail_ret_itlist: ! Py_DECREF(itlist); ! Fail_ret: ! Py_DECREF(ret); ! return NULL; } From tim_one@users.sourceforge.net Sun May 6 02:05:04 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 05 May 2001 18:05:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.160,1.161 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv31904/python/dist/src/Misc Modified Files: NEWS Log Message: Generalize zip() to work with iterators. NEEDS DOC CHANGES. More AttributeErrors transmuted into TypeErrors, in test_b2.py, and, again, this strikes me as a good thing. This checkin completes the iterator generalization work that obviously needed to be done. Can anyone think of others that should be changed? Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -r1.160 -r1.161 *** NEWS 2001/05/05 11:33:43 1.160 --- NEWS 2001/05/06 01:05:01 1.161 *************** *** 18,32 **** - The following functions were generalized to work nicely with iterator arguments: ! filter() ! list() ! map() ! max() ! min() ! reduce() ! tuple() (PySequence_Tuple() and PySequence_Fast() in C API) .join() method of strings 'x in y' and 'x not in y' (PySequence_Contains() in C API) operator.countOf() (PySequence_Count() in C API) - XXX TODO zip() --- 18,28 ---- - The following functions were generalized to work nicely with iterator arguments: ! map(), filter(), reduce() ! list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API) ! max(), min() ! zip() .join() method of strings 'x in y' and 'x not in y' (PySequence_Contains() in C API) operator.countOf() (PySequence_Count() in C API) From gvanrossum@users.sourceforge.net Sun May 6 03:31:15 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 05 May 2001 19:31:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules spam.c,1.1.2.2,1.1.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv9178/Modules Modified Files: Tag: descr-branch spam.c Log Message: Finally we're having fun. This set of changes makes it possible to subclass (some) built-in types in Python. - Introduce another metatype, the type of TypeType, dubbed TurtleType. Its reason for existence is so that its tp_call slot can be the function that is called when a regular type object is present in the list of base classes of a class statement; the (modified) Don Beaudry hook will call the type's type with (name, bases, dict), and the type's type happens to be TypeType; in order to make TypeType (itself) callable, it must have a type that defines the appropriate tp_call slot. This is TurtleType. - The tp_construct slot is changed to take args and kwds. TurtleType's tp_call passes those through, and so does TypeType's tp_call. (The tp_constrict slots in the dict and list types don't do anything with their arguments yet.) - The instance method type was generalized not to require that the class argument is an actual class. Since the class wasn't used in an essential way, this was easy; only its repr() had to be changed. (It could stand some more cleanup, and should be moved to its own file.) - Python function objects now have a tp_descr_get slot, which returns a bound (instance) method object when an object is given; without an object, this returns the function itself unchanged. The latter behavior is not ideal, but the best I can do without changing the tp_descr_get API (since without an object, the class whose unbound method this is isn't known). - PyGeneric_GetAttr no longer requires that all objects it finds in tp_dict are descriptors; non-descriptors are returned unchanged. - The tp_construct slot for TypeType (which defines how to construct regular types) is defined; it takes an argument list of the form (name, bases, dict), so it can be used as the class creation function. It currently requires that there's exactly one base, which must be a type object. The subtypes it defines can override existing methods and define new methods, but it cannot yet override operators (__foo__ methods in the dict don't have an effect yet). - The Don Beaudry hook is changed -- alternative bases now must be types. If this condition is met, the same thing is done as before: the base's type is called with (name, bases, dict) to construct the new class. Not yet implemented: - New instance variables in subtypes (the subtypes don't have a __dict__ to store these). - Overriding operators in subtypes with __foo__ methods. - Any form of multiple inheritance. Index: spam.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Attic/spam.c,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -r1.1.2.2 -r1.1.2.3 *** spam.c 2001/05/04 21:58:45 1.1.2.2 --- spam.c 2001/05/06 02:31:13 1.1.2.3 *************** *** 39,43 **** static PyObject * ! spamlist_construct(spamlistobject *arg) { spamlistobject *self; --- 39,43 ---- static PyObject * ! spamlist_construct(spamlistobject *arg, PyObject *args, PyObject *kwds) { spamlistobject *self; *************** *** 50,54 **** return NULL; } ! if (PyList_Type.tp_construct((PyObject *)self) == NULL) { if (self != arg) PyObject_Del(self); --- 50,54 ---- return NULL; } ! if (PyList_Type.tp_construct((PyObject *)self, args, kwds) == NULL) { if (self != arg) PyObject_Del(self); *************** *** 95,99 **** 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (unaryfunc)spamlist_construct, /* tp_construct */ }; --- 95,99 ---- 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! spamlist_construct, /* tp_construct */ }; *************** *** 142,146 **** static PyObject * ! spamdict_construct(spamdictobject *arg) { spamdictobject *self; --- 142,146 ---- static PyObject * ! spamdict_construct(spamdictobject *arg, PyObject *args, PyObject *kwds) { spamdictobject *self; *************** *** 153,157 **** return NULL; } ! if (PyDict_Type.tp_construct((PyObject *)self) == NULL) { if (self != arg) PyObject_Del(self); --- 153,157 ---- return NULL; } ! if (PyDict_Type.tp_construct((PyObject *)self, args, kwds) == NULL) { if (self != arg) PyObject_Del(self); *************** *** 198,202 **** 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (unaryfunc)spamdict_construct, /* tp_construct */ }; --- 198,202 ---- 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! spamdict_construct, /* tp_construct */ }; From gvanrossum@users.sourceforge.net Sun May 6 03:31:15 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 05 May 2001 19:31:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib types.py,1.14.10.1,1.14.10.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9178/Lib Modified Files: Tag: descr-branch types.py Log Message: Finally we're having fun. This set of changes makes it possible to subclass (some) built-in types in Python. - Introduce another metatype, the type of TypeType, dubbed TurtleType. Its reason for existence is so that its tp_call slot can be the function that is called when a regular type object is present in the list of base classes of a class statement; the (modified) Don Beaudry hook will call the type's type with (name, bases, dict), and the type's type happens to be TypeType; in order to make TypeType (itself) callable, it must have a type that defines the appropriate tp_call slot. This is TurtleType. - The tp_construct slot is changed to take args and kwds. TurtleType's tp_call passes those through, and so does TypeType's tp_call. (The tp_constrict slots in the dict and list types don't do anything with their arguments yet.) - The instance method type was generalized not to require that the class argument is an actual class. Since the class wasn't used in an essential way, this was easy; only its repr() had to be changed. (It could stand some more cleanup, and should be moved to its own file.) - Python function objects now have a tp_descr_get slot, which returns a bound (instance) method object when an object is given; without an object, this returns the function itself unchanged. The latter behavior is not ideal, but the best I can do without changing the tp_descr_get API (since without an object, the class whose unbound method this is isn't known). - PyGeneric_GetAttr no longer requires that all objects it finds in tp_dict are descriptors; non-descriptors are returned unchanged. - The tp_construct slot for TypeType (which defines how to construct regular types) is defined; it takes an argument list of the form (name, bases, dict), so it can be used as the class creation function. It currently requires that there's exactly one base, which must be a type object. The subtypes it defines can override existing methods and define new methods, but it cannot yet override operators (__foo__ methods in the dict don't have an effect yet). - The Don Beaudry hook is changed -- alternative bases now must be types. If this condition is met, the same thing is done as before: the base's type is called with (name, bases, dict) to construct the new class. Not yet implemented: - New instance variables in subtypes (the subtypes don't have a __dict__ to store these). - Overriding operators in subtypes with __foo__ methods. - Any form of multiple inheritance. Index: types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/types.py,v retrieving revision 1.14.10.1 retrieving revision 1.14.10.2 diff -C2 -r1.14.10.1 -r1.14.10.2 *** types.py 2001/05/04 16:51:40 1.14.10.1 --- types.py 2001/05/06 02:31:13 1.14.10.2 *************** *** 70,73 **** --- 70,74 ---- FunctionIterType = type(iter(lambda: 0, 0)) DictProxyType = type(TypeType.__dict__) + TurtleType = type(TypeType) del sys, _f, _C, _x # Not for export From gvanrossum@users.sourceforge.net Sun May 6 03:31:15 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 05 May 2001 19:31:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.241.2.1,2.241.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv9178/Python Modified Files: Tag: descr-branch ceval.c Log Message: Finally we're having fun. This set of changes makes it possible to subclass (some) built-in types in Python. - Introduce another metatype, the type of TypeType, dubbed TurtleType. Its reason for existence is so that its tp_call slot can be the function that is called when a regular type object is present in the list of base classes of a class statement; the (modified) Don Beaudry hook will call the type's type with (name, bases, dict), and the type's type happens to be TypeType; in order to make TypeType (itself) callable, it must have a type that defines the appropriate tp_call slot. This is TurtleType. - The tp_construct slot is changed to take args and kwds. TurtleType's tp_call passes those through, and so does TypeType's tp_call. (The tp_constrict slots in the dict and list types don't do anything with their arguments yet.) - The instance method type was generalized not to require that the class argument is an actual class. Since the class wasn't used in an essential way, this was easy; only its repr() had to be changed. (It could stand some more cleanup, and should be moved to its own file.) - Python function objects now have a tp_descr_get slot, which returns a bound (instance) method object when an object is given; without an object, this returns the function itself unchanged. The latter behavior is not ideal, but the best I can do without changing the tp_descr_get API (since without an object, the class whose unbound method this is isn't known). - PyGeneric_GetAttr no longer requires that all objects it finds in tp_dict are descriptors; non-descriptors are returned unchanged. - The tp_construct slot for TypeType (which defines how to construct regular types) is defined; it takes an argument list of the form (name, bases, dict), so it can be used as the class creation function. It currently requires that there's exactly one base, which must be a type object. The subtypes it defines can override existing methods and define new methods, but it cannot yet override operators (__foo__ methods in the dict don't have an effect yet). - The Don Beaudry hook is changed -- alternative bases now must be types. If this condition is met, the same thing is done as before: the base's type is called with (name, bases, dict) to construct the new class. Not yet implemented: - New instance variables in subtypes (the subtypes don't have a __dict__ to store these). - Overriding operators in subtypes with __foo__ methods. - Any form of multiple inheritance. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.241.2.1 retrieving revision 2.241.2.2 diff -C2 -r2.241.2.1 -r2.241.2.2 *** ceval.c 2001/05/05 11:37:29 2.241.2.1 --- ceval.c 2001/05/06 02:31:13 2.241.2.2 *************** *** 3244,3264 **** PyObject *base = PyTuple_GET_ITEM(bases, i); if (!PyClass_Check(base)) { ! /* Call the base's *type*, if it is callable. ! This code is a hook for Donald Beaudry's ! and Jim Fulton's type extensions. In ! unextended Python it will never be triggered ! since its types are not callable. ! Ditto: call the bases's *class*, if it has ! one. This makes the same thing possible ! without writing C code. A true meta-object ! protocol! */ ! PyObject *basetype = (PyObject *)base->ob_type; ! PyObject *callable = NULL; ! if (PyCallable_Check(basetype)) ! callable = basetype; ! else ! callable = PyObject_GetAttrString( ! base, "__class__"); ! if (callable) { PyObject *args; PyObject *newclass = NULL; --- 3244,3253 ---- PyObject *base = PyTuple_GET_ITEM(bases, i); if (!PyClass_Check(base)) { ! /* If the base is a type, call its base to clone it. ! This is a weaker form of the Don Beaudry hook ! that used to be here. It should be sufficient ! because types can now be subtyped. */ ! if (PyType_Check(base)) { ! PyObject *basetype = (PyObject *)base->ob_type; PyObject *args; PyObject *newclass = NULL; *************** *** 3267,3275 **** if (args != NULL) { newclass = PyEval_CallObject( ! callable, args); Py_DECREF(args); - } - if (callable != basetype) { - Py_DECREF(callable); } return newclass; --- 3256,3261 ---- if (args != NULL) { newclass = PyEval_CallObject( ! basetype, args); Py_DECREF(args); } return newclass; From gvanrossum@users.sourceforge.net Sun May 6 03:31:15 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 05 May 2001 19:31:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include object.h,2.79.2.4,2.79.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv9178/Include Modified Files: Tag: descr-branch object.h Log Message: Finally we're having fun. This set of changes makes it possible to subclass (some) built-in types in Python. - Introduce another metatype, the type of TypeType, dubbed TurtleType. Its reason for existence is so that its tp_call slot can be the function that is called when a regular type object is present in the list of base classes of a class statement; the (modified) Don Beaudry hook will call the type's type with (name, bases, dict), and the type's type happens to be TypeType; in order to make TypeType (itself) callable, it must have a type that defines the appropriate tp_call slot. This is TurtleType. - The tp_construct slot is changed to take args and kwds. TurtleType's tp_call passes those through, and so does TypeType's tp_call. (The tp_constrict slots in the dict and list types don't do anything with their arguments yet.) - The instance method type was generalized not to require that the class argument is an actual class. Since the class wasn't used in an essential way, this was easy; only its repr() had to be changed. (It could stand some more cleanup, and should be moved to its own file.) - Python function objects now have a tp_descr_get slot, which returns a bound (instance) method object when an object is given; without an object, this returns the function itself unchanged. The latter behavior is not ideal, but the best I can do without changing the tp_descr_get API (since without an object, the class whose unbound method this is isn't known). - PyGeneric_GetAttr no longer requires that all objects it finds in tp_dict are descriptors; non-descriptors are returned unchanged. - The tp_construct slot for TypeType (which defines how to construct regular types) is defined; it takes an argument list of the form (name, bases, dict), so it can be used as the class creation function. It currently requires that there's exactly one base, which must be a type object. The subtypes it defines can override existing methods and define new methods, but it cannot yet override operators (__foo__ methods in the dict don't have an effect yet). - The Don Beaudry hook is changed -- alternative bases now must be types. If this condition is met, the same thing is done as before: the base's type is called with (name, bases, dict) to construct the new class. Not yet implemented: - New instance variables in subtypes (the subtypes don't have a __dict__ to store these). - Overriding operators in subtypes with __foo__ methods. - Any form of multiple inheritance. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.79.2.4 retrieving revision 2.79.2.5 diff -C2 -r2.79.2.4 -r2.79.2.5 *** object.h 2001/05/04 16:44:53 2.79.2.4 --- object.h 2001/05/06 02:31:13 2.79.2.5 *************** *** 266,270 **** descrgetfunc tp_descr_get; descrsetfunc tp_descr_set; ! unaryfunc tp_construct; --- 266,270 ---- descrgetfunc tp_descr_get; descrsetfunc tp_descr_set; ! ternaryfunc tp_construct; *************** *** 284,288 **** ((ob)->ob_type == (tp) || _PyObject_TypeCheck(ob, tp)) ! extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of type objects */ #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type) --- 284,289 ---- ((ob)->ob_type == (tp) || _PyObject_TypeCheck(ob, tp)) ! extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of most type objects */ ! extern DL_IMPORT(PyTypeObject) PyTurtle_Type; /* The type of PyType_Type */ #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type) From gvanrossum@users.sourceforge.net Sun May 6 03:31:15 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 05 May 2001 19:31:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.127.2.2,2.127.2.3 funcobject.c,2.37.4.1,2.37.4.2 object.c,2.124.4.7,2.124.4.8 typeobject.c,2.16.8.10,2.16.8.11 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv9178/Objects Modified Files: Tag: descr-branch classobject.c funcobject.c object.c typeobject.c Log Message: Finally we're having fun. This set of changes makes it possible to subclass (some) built-in types in Python. - Introduce another metatype, the type of TypeType, dubbed TurtleType. Its reason for existence is so that its tp_call slot can be the function that is called when a regular type object is present in the list of base classes of a class statement; the (modified) Don Beaudry hook will call the type's type with (name, bases, dict), and the type's type happens to be TypeType; in order to make TypeType (itself) callable, it must have a type that defines the appropriate tp_call slot. This is TurtleType. - The tp_construct slot is changed to take args and kwds. TurtleType's tp_call passes those through, and so does TypeType's tp_call. (The tp_constrict slots in the dict and list types don't do anything with their arguments yet.) - The instance method type was generalized not to require that the class argument is an actual class. Since the class wasn't used in an essential way, this was easy; only its repr() had to be changed. (It could stand some more cleanup, and should be moved to its own file.) - Python function objects now have a tp_descr_get slot, which returns a bound (instance) method object when an object is given; without an object, this returns the function itself unchanged. The latter behavior is not ideal, but the best I can do without changing the tp_descr_get API (since without an object, the class whose unbound method this is isn't known). - PyGeneric_GetAttr no longer requires that all objects it finds in tp_dict are descriptors; non-descriptors are returned unchanged. - The tp_construct slot for TypeType (which defines how to construct regular types) is defined; it takes an argument list of the form (name, bases, dict), so it can be used as the class creation function. It currently requires that there's exactly one base, which must be a type object. The subtypes it defines can override existing methods and define new methods, but it cannot yet override operators (__foo__ methods in the dict don't have an effect yet). - The Don Beaudry hook is changed -- alternative bases now must be types. If this condition is met, the same thing is done as before: the base's type is called with (name, bases, dict) to construct the new class. Not yet implemented: - New instance variables in subtypes (the subtypes don't have a __dict__ to store these). - Overriding operators in subtypes with __foo__ methods. - Any form of multiple inheritance. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.127.2.2 retrieving revision 2.127.2.3 diff -C2 -r2.127.2.2 -r2.127.2.3 *** classobject.c 2001/05/05 11:37:29 2.127.2.2 --- classobject.c 2001/05/06 02:31:13 2.127.2.3 *************** *** 2023,2063 **** instancemethod_repr(PyMethodObject *a) { ! char buf[240]; ! PyInstanceObject *self = (PyInstanceObject *)(a->im_self); PyObject *func = a->im_func; ! PyClassObject *class = (PyClassObject *)(a->im_class); ! PyObject *fclassname, *iclassname, *funcname; ! char *fcname, *icname, *fname; ! fclassname = class->cl_name; ! if (PyFunction_Check(func)) { ! funcname = ((PyFunctionObject *)func)->func_name; ! Py_INCREF(funcname); } - else { - funcname = PyObject_GetAttrString(func,"__name__"); - if (funcname == NULL) - PyErr_Clear(); - } - if (funcname != NULL && PyString_Check(funcname)) - fname = PyString_AS_STRING(funcname); else ! fname = "?"; ! if (fclassname != NULL && PyString_Check(fclassname)) ! fcname = PyString_AsString(fclassname); else ! fcname = "?"; if (self == NULL) ! sprintf(buf, "", fcname, fname); else { ! iclassname = self->in_class->cl_name; ! if (iclassname != NULL && PyString_Check(iclassname)) ! icname = PyString_AsString(iclassname); ! else ! icname = "?"; ! sprintf(buf, "", ! fcname, fname, icname, self); } Py_XDECREF(funcname); ! return PyString_FromString(buf); } --- 2023,2071 ---- instancemethod_repr(PyMethodObject *a) { ! char buffer[240]; ! PyObject *self = a->im_self; PyObject *func = a->im_func; ! PyObject *klass = a->im_class; ! PyObject *funcname = NULL, *klassname = NULL, *result = NULL; ! char *sfuncname = "?", *sklassname = "?"; ! ! funcname = PyObject_GetAttrString(func, "__name__"); ! if (funcname == NULL) ! PyErr_Clear(); ! else if (!PyString_Check(funcname)) { ! Py_DECREF(funcname); ! funcname = NULL; } else ! sfuncname = PyString_AS_STRING(funcname); ! klassname = PyObject_GetAttrString(klass, "__name__"); ! if (klassname == NULL) ! PyErr_Clear(); ! else if (!PyString_Check(klassname)) { ! Py_DECREF(klassname); ! klassname = NULL; ! } else ! sklassname = PyString_AS_STRING(klassname); if (self == NULL) ! sprintf(buffer, "", ! sklassname, sfuncname); else { ! PyObject *selfrepr = PyObject_Repr(self); ! if (selfrepr == NULL) ! goto fail; ! if (!PyString_Check(selfrepr)) { ! Py_DECREF(selfrepr); ! goto fail; ! } ! sprintf(buffer, "", ! sklassname, sfuncname, PyString_AS_STRING(selfrepr)); ! Py_DECREF(selfrepr); } + result = PyString_FromString(buffer); + fail: Py_XDECREF(funcname); ! Py_XDECREF(klassname); ! return result; } Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.37.4.1 retrieving revision 2.37.4.2 diff -C2 -r2.37.4.1 -r2.37.4.2 *** funcobject.c 2001/05/05 11:37:29 2.37.4.1 --- funcobject.c 2001/05/06 02:31:13 2.37.4.2 *************** *** 367,370 **** --- 367,382 ---- } + /* Bind a function to an object */ + static PyObject * + func_descr_get(PyObject *func, PyObject *obj) + { + if (obj == NULL) { + Py_INCREF(func); + return func; + } + else + return PyMethod_New(func, obj, (PyObject *)obj->ob_type); + } + PyTypeObject PyFunction_Type = { PyObject_HEAD_INIT(&PyType_Type) *************** *** 373,396 **** sizeof(PyFunctionObject) + PyGC_HEAD_SIZE, 0, ! (destructor)func_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! 0, /*tp_compare*/ ! (reprfunc)func_repr, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! 0, /*tp_hash*/ ! function_call, /*tp_call*/ ! 0, /*tp_str*/ ! (getattrofunc)func_getattro, /*tp_getattro*/ ! (setattrofunc)func_setattro, /*tp_setattro*/ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, ! 0, /* tp_doc */ ! (traverseproc)func_traverse, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ offsetof(PyFunctionObject, func_weakreflist), /* tp_weaklistoffset */ }; --- 385,417 ---- sizeof(PyFunctionObject) + PyGC_HEAD_SIZE, 0, ! (destructor)func_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! (reprfunc)func_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! function_call, /* tp_call */ ! 0, /* tp_str */ ! (getattrofunc)func_getattro, /* tp_getattro */ ! (setattrofunc)func_setattro, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)func_traverse, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ offsetof(PyFunctionObject, func_weakreflist), /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + func_descr_get, /* tp_descr_get */ + 0, /* tp_descr_set */ }; Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.4.7 retrieving revision 2.124.4.8 diff -C2 -r2.124.4.7 -r2.124.4.8 *** object.c 2001/05/05 11:37:29 2.124.4.7 --- object.c 2001/05/06 02:31:13 2.124.4.8 *************** *** 1088,1093 **** } descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr != NULL && (f = descr->ob_type->tp_descr_get) != NULL) ! return (*f)(descr, obj); PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", --- 1088,1098 ---- } descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr != NULL) { ! f = descr->ob_type->tp_descr_get; ! if (f != NULL) ! return (*f)(descr, obj); ! Py_INCREF(descr); ! return descr; ! } PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.10 retrieving revision 2.16.8.11 diff -C2 -r2.16.8.10 -r2.16.8.11 *** typeobject.c 2001/05/04 21:56:53 2.16.8.10 --- typeobject.c 2001/05/06 02:31:13 2.16.8.11 *************** *** 54,64 **** type_call(PyTypeObject *type, PyObject *args, PyObject *kwds) { - char *dummy = NULL; PyObject *obj, *res; - char buffer[100]; - - sprintf(buffer, ":", type->tp_name); - if (!PyArg_ParseTupleAndKeywords(args, kwds, buffer, &dummy)) - return NULL; if (type->tp_construct == NULL) { --- 54,58 ---- *************** *** 71,75 **** if (obj == NULL) return NULL; ! res = (type->tp_construct)(obj); if (res != obj) { Py_DECREF(obj); --- 65,69 ---- if (obj == NULL) return NULL; ! res = (type->tp_construct)(obj, args, kwds); if (res != obj) { Py_DECREF(obj); *************** *** 115,121 **** if (type->tp_flags & Py_TPFLAGS_HAVE_CLASS) { descr = PyDict_GetItem(type->tp_dict, name); ! if (descr != NULL && ! (f = descr->ob_type->tp_descr_get) != NULL) ! return (*f)(descr, NULL); } --- 109,120 ---- if (type->tp_flags & Py_TPFLAGS_HAVE_CLASS) { descr = PyDict_GetItem(type->tp_dict, name); ! if (descr != NULL) { ! f = descr->ob_type->tp_descr_get; ! if (f != NULL) ! return (*f)(descr, NULL); ! /* Not a descriptor -- a plain value */ ! Py_INCREF(descr); ! return descr; ! } } *************** *** 126,136 **** } PyTypeObject PyType_Type = { ! PyObject_HEAD_INIT(&PyType_Type) 0, /* Number of items for varobject */ "type", /* Name of this type */ sizeof(PyTypeObject), /* Basic object size */ 0, /* Item size for varobject */ ! 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ --- 125,232 ---- } + /* Helpers for subtyping */ + static PyObject * + subtype_construct(PyObject *self, PyObject *args, PyObject *kwds) + { + PyObject *res; + + if (self == NULL) { + PyErr_SetString(PyExc_TypeError, + "can't allocate subtype instances"); + return NULL; + } + res = self->ob_type->tp_base->tp_construct(self, args, kwds); + if (res == self) + Py_INCREF(self->ob_type); + return res; + } + + static void + subtype_dealloc(PyObject *self) + { + self->ob_type->tp_base->tp_dealloc(self); + Py_DECREF(self->ob_type); + } + + /* TypeType's constructor is called when a type is subclassed */ + static PyObject * + type_construct(PyTypeObject *type, PyObject *args, PyObject *kwds) + { + PyObject *name, *bases, *dict, *x; + PyTypeObject *base; + char *dummy = NULL; + + if (type != NULL) { + PyErr_SetString(PyExc_TypeError, + "can't construct a preallocated type"); + return NULL; + } + if (!PyArg_ParseTupleAndKeywords(args, kwds, "SOO", &dummy, + &name, &bases, &dict)) + return NULL; + if (!PyTuple_Check(bases) || !PyDict_Check(dict)) { + PyErr_SetString(PyExc_TypeError, + "usage: TypeType(name, bases, dict) "); + return NULL; + } + if (PyTuple_GET_SIZE(bases) > 1) { + PyErr_SetString(PyExc_TypeError, + "can't multiple-inherit from types"); + return NULL; + } + if (PyTuple_GET_SIZE(bases) < 1) { + PyErr_SetString(PyExc_TypeError, + "can't create a new type without a base type"); + return NULL; + } + base = (PyTypeObject *)PyTuple_GET_ITEM(bases, 0); + if (!PyType_Check((PyObject *)base)) { + PyErr_SetString(PyExc_TypeError, + "base type must be a type"); + return NULL; + } + type = PyObject_New(PyTypeObject, &PyType_Type); + if (type == NULL) + return NULL; + memset(((void *)type) + offsetof(PyTypeObject, tp_name), '\0', + sizeof(PyTypeObject) - offsetof(PyTypeObject, tp_name)); + type->tp_name = PyString_AS_STRING(name); + type->tp_flags = Py_TPFLAGS_DEFAULT; + Py_INCREF(base); + type->tp_base = base; + if (base->tp_construct) + type->tp_construct = subtype_construct; + if (base->tp_dealloc) + type->tp_dealloc = subtype_dealloc; + if (PyType_InitDict(type) < 0) { + Py_DECREF(type); + return NULL; + } + x = PyObject_CallMethod(type->tp_dict, "update", "O", dict); + if (x == NULL) { + Py_DECREF(type); + return NULL; + } + Py_DECREF(x); /* throw away None */ + PyDict_SetItemString(type->tp_dict, "__name__", name); + return (PyObject *)type; + } + + /* Only for dynamic types, created by type_construct() above */ + static void + type_dealloc(PyTypeObject *type) + { + Py_XDECREF(type->tp_base); + Py_XDECREF(type->tp_dict); + PyObject_DEL(type); + } + PyTypeObject PyType_Type = { ! PyObject_HEAD_INIT(&PyTurtle_Type) 0, /* Number of items for varobject */ "type", /* Name of this type */ sizeof(PyTypeObject), /* Basic object size */ 0, /* Item size for varobject */ ! (destructor)type_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ *************** *** 160,163 **** --- 256,328 ---- 0, /* tp_base */ 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + (ternaryfunc)type_construct, /* tp_construct */ + }; + + + /* The "turtle" type is named after the expression "turtles all the way down", + a reference to the fact that it is its own type. We get the progression: + x => {} # for example + type(x) => DictType + type(DictType) => TypeType + type(TypeType) => TurtleType + type(TurtleType) => TurtleType + type(TurtleType) => TurtleType + type(TurtleType) => TurtleType + . + . + . + It's from an old story often told about Bertrand Russel, popularized most + recently by Stephen Hawking; do a Google search for the phrase to find out + more. The oldest turtle reference in the Python archives seems to be: + http://mail.python.org/pipermail/types-sig/1998-November/000084.html */ + + static PyObject * + turtle_call(PyTypeObject *metatype, PyObject *args, PyObject *kwds) + { + if (metatype->tp_construct == NULL) { + PyErr_Format(PyExc_TypeError, + "can't subclass '.%100s' objects yet", + metatype->tp_name); + return NULL; + } + return (*metatype->tp_construct)(NULL, args, kwds); + } + + PyTypeObject PyTurtle_Type = { + PyObject_HEAD_INIT(&PyTurtle_Type) + 0, /* Number of items for varobject */ + "turtle", /* Name of this type */ + sizeof(PyTypeObject), /* Basic object size */ + 0, /* Item size for varobject */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + (reprfunc)type_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)turtle_call, /* tp_call */ + 0, /* tp_str */ + (getattrofunc)type_getattro, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + "Define the behavior of a particular type of object.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + type_members, /* tp_members */ + type_getsets, /* tp_getset */ + &PyType_Type, /* tp_base */ + 0, /* tp_dict */ }; *************** *** 331,343 **** type->tp_flags |= base->tp_flags & Py_TPFLAGS_HAVE_SEQUENCE_IN; } - if (!(type->tp_flags & Py_TPFLAGS_GC) && - (base->tp_flags & Py_TPFLAGS_GC) && - (type->tp_flags & Py_TPFLAGS_HAVE_RICHCOMPARE/*GC slots exist*/) && - (!type->tp_traverse && !type->tp_clear)) { - type->tp_flags |= Py_TPFLAGS_GC; - type->tp_basicsize += PyGC_HEAD_SIZE; - COPYSLOT(tp_traverse); - COPYSLOT(tp_clear); - } if ((type->tp_flags & Py_TPFLAGS_HAVE_INPLACEOPS) != (base->tp_flags & Py_TPFLAGS_HAVE_INPLACEOPS)) { --- 496,499 ---- *************** *** 359,362 **** --- 515,527 ---- COPYSLOT(tp_name); COPYSLOT(tp_basicsize); + if (!(type->tp_flags & Py_TPFLAGS_GC) && + (base->tp_flags & Py_TPFLAGS_GC) && + (type->tp_flags & Py_TPFLAGS_HAVE_RICHCOMPARE/*GC slots exist*/) && + (!type->tp_traverse && !type->tp_clear)) { + type->tp_flags |= Py_TPFLAGS_GC; + type->tp_basicsize += PyGC_HEAD_SIZE; + COPYSLOT(tp_traverse); + COPYSLOT(tp_clear); + } COPYSLOT(tp_itemsize); COPYSLOT(tp_dealloc); From gvanrossum@users.sourceforge.net Sun May 6 03:52:06 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 05 May 2001 19:52:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.11,2.16.8.12 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv11331 Modified Files: Tag: descr-branch typeobject.c Log Message: Th Windows compiler doesn't like adding offsets to a void*, so use char* instead for the memset() arg in type_construct(). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.11 retrieving revision 2.16.8.12 diff -C2 -r2.16.8.11 -r2.16.8.12 *** typeobject.c 2001/05/06 02:31:13 2.16.8.11 --- typeobject.c 2001/05/06 02:52:04 2.16.8.12 *************** *** 189,193 **** if (type == NULL) return NULL; ! memset(((void *)type) + offsetof(PyTypeObject, tp_name), '\0', sizeof(PyTypeObject) - offsetof(PyTypeObject, tp_name)); type->tp_name = PyString_AS_STRING(name); --- 189,193 ---- if (type == NULL) return NULL; ! memset(((char *)type) + offsetof(PyTypeObject, tp_name), '\0', sizeof(PyTypeObject) - offsetof(PyTypeObject, tp_name)); type->tp_name = PyString_AS_STRING(name); From fdrake@users.sourceforge.net Mon May 7 18:42:21 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 07 May 2001 10:42:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.118,1.119 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv31750/api Modified Files: api.tex Log Message: Added documentation for PyIter_Check() and PyIter_Next(). Wrapped a long line. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -r1.118 -r1.119 *** api.tex 2001/04/23 14:44:21 1.118 --- api.tex 2001/05/07 17:42:18 1.119 *************** *** 2083,2091 **** \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyMapping_SetItemString}{PyObject *o, char *key, PyObject *v} Map the object \var{key} to the value \var{v} in object \var{o}. Returns \code{-1} on failure. This is the equivalent of the Python statement \samp{\var{o}[\var{key}] = \var{v}}. \end{cfuncdesc} --- 2083,2129 ---- \end{cfuncdesc} ! \begin{cfuncdesc}{int}{PyMapping_SetItemString}{PyObject *o, char *key, ! PyObject *v} Map the object \var{key} to the value \var{v} in object \var{o}. Returns \code{-1} on failure. This is the equivalent of the Python statement \samp{\var{o}[\var{key}] = \var{v}}. \end{cfuncdesc} + + + \section{Iterator Protocol \label{iterator}} + + There are only a couple of functions specifically for working with + iterators. + + \begin{cfuncdesc}{int}{PyIter_Check}{PyObject *o} + Return true if the object \var{o} supports the iterator protocol. + \end{cfuncdesc} + + \begin{cfuncdesc}{PyObject*}{PyIter_Next}{PyObject *o} + Return the next value from the iteration \var{o}. If the object is + an iterator, this retrieves the next value from the iteration, and + returns \NULL{} with no exception set if there are no remaining + items. If the object is not an iterator, \exception{TypeError} is + raised, or if there is an error in retrieving the item, returns + \NULL{} and passes along the exception. + \end{cfuncdesc} + + To write a loop which iterates over an iterator, the C code should + look something like this: + + \begin{verbatim} + PyObject *iterator = ...; + PyObject *item; + + while (item = PyIter_Next(iter)) { + /* do something with item */ + } + if (PyErr_Occurred()) { + /* propogate error */ + } + else { + /* continue doing useful work */ + } + \end{verbatim} From fdrake@users.sourceforge.net Mon May 7 18:47:09 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 07 May 2001 10:47:09 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.119,1.120 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv429/api Modified Files: api.tex Log Message: Hmm... better add a version annotation for the Iterator Protocol section. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -r1.119 -r1.120 *** api.tex 2001/05/07 17:42:18 1.119 --- api.tex 2001/05/07 17:47:07 1.120 *************** *** 2093,2096 **** --- 2093,2098 ---- \section{Iterator Protocol \label{iterator}} + \versionadded{2.2} + There are only a couple of functions specifically for working with iterators. From fdrake@users.sourceforge.net Mon May 7 18:55:37 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 07 May 2001 10:55:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.24,2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2567/Modules Modified Files: termios.c Log Message: Michael Hudson : This patch does several things to termios: (1) changes all functions to be METH_VARARGS (2) changes all functions to be able to take a file object as the first parameter, as per http://mail.python.org/pipermail/python-dev/2001-February/012701.html (3) give better error messages (4) removes a bunch of comments that just repeat the docstrings (5) #includes before #including so more #constants are actually #defined. (6) a couple of docstring tweaks I have tested this minimally (i.e. it builds, and doesn't blow up too embarassingly) on OSF1/alpha and on one of the sf compile farm's solaris boxes, and rather more comprehansively on my linux/x86 box. It still needs to be tested on all the other platforms we build termios on. This closes the code portion of SF patch #417081. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -r2.24 -r2.25 *** termios.c 2001/04/11 20:57:57 2.24 --- termios.c 2001/05/07 17:55:35 2.25 *************** *** 6,42 **** #include ! /* XXX Some systems need this to get all the symbols, while ! this breaks for others. #include - */ static char termios__doc__[] = "\ This module provides an interface to the Posix calls for tty I/O control.\n\ For a complete description of these calls, see the Posix or Unix manual\n\ pages. It is only available for those Unix versions that support Posix\n\ ! termios style tty I/O control (and then only if configured at installation\n\ ! time).\n\ \n\ All functions in this module take a file descriptor fd as their first\n\ ! argument. This must be an integer file descriptor, such as returned by\n\ ! sys.stdin.fileno()."; ! #ifdef __BEOS__ ! #include ! #endif ! #define BAD "bad termios argument" ! static PyObject *TermiosError; ! /* termios = tcgetattr(fd) ! termios is ! [iflag, oflag, cflag, lflag, ispeed, ospeed, [cc[0], ..., cc[NCCS]]] ! Return the attributes of the terminal device. */ static char termios_tcgetattr__doc__[] = "\ tcgetattr(fd) -> list_of_attrs\n\ Get the tty attributes for file descriptor fd, as follows:\n\ [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] where cc is a list\n\ --- 6,64 ---- #include ! #include #include + #ifdef __BEOS__ + #include + #endif + static char termios__doc__[] = "\ This module provides an interface to the Posix calls for tty I/O control.\n\ For a complete description of these calls, see the Posix or Unix manual\n\ pages. It is only available for those Unix versions that support Posix\n\ ! termios style tty I/O control.\n\ \n\ All functions in this module take a file descriptor fd as their first\n\ ! argument. This can be an integer file descriptor, such as returned by\n\ ! sys.stdin.fileno(), or a file object, such as sys.stdin itself."; + static PyObject *TermiosError; ! static char* fname; ! static int fdconv(PyObject* obj, void* p) ! { ! int fd; ! fd = PyObject_AsFileDescriptor(obj); ! if (fd == -1) { ! if (PyInt_Check(obj)) { ! fd = PyInt_AS_LONG(obj); ! } ! else { ! char* tname; ! if (PyInstance_Check(obj)) { ! tname = PyString_AS_STRING( ! ((PyInstanceObject*)obj)->in_class->cl_name); ! } ! else { ! tname = obj->ob_type->tp_name; ! } ! ! PyErr_Format(PyExc_TypeError, ! "%s, arg 1: can't extract file descriptor from \"%.500s\"", ! fname, tname); ! return 0; ! } ! } ! *(int*)p = fd; ! return 1; ! } static char termios_tcgetattr__doc__[] = "\ tcgetattr(fd) -> list_of_attrs\n\ + \n\ Get the tty attributes for file descriptor fd, as follows:\n\ [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] where cc is a list\n\ *************** *** 58,62 **** char ch; ! if (!PyArg_Parse(args, "i", &fd)) return NULL; --- 80,87 ---- char ch; ! fname = "tcgetattr"; ! ! if (!PyArg_ParseTuple(args, "O&:tcgetattr", ! fdconv, (void*)&fd)) return NULL; *************** *** 112,120 **** } - /* tcsetattr(fd, when, termios) - Set the attributes of the terminal device. */ - static char termios_tcsetattr__doc__[] = "\ tcsetattr(fd, when, attributes) -> None\n\ Set the tty attributes for file descriptor fd.\n\ The attributes to be set are taken from the attributes argument, which\n\ --- 137,143 ---- } static char termios_tcsetattr__doc__[] = "\ tcsetattr(fd, when, attributes) -> None\n\ + \n\ Set the tty attributes for file descriptor fd.\n\ The attributes to be set are taken from the attributes argument, which\n\ *************** *** 133,141 **** PyObject *term, *cc, *v; int i; ! if (!PyArg_Parse(args, "(iiO)", &fd, &when, &term)) return NULL; if (!PyList_Check(term) || PyList_Size(term) != 7) { ! PyErr_SetString(PyExc_TypeError, BAD); return NULL; } --- 156,168 ---- PyObject *term, *cc, *v; int i; + + fname = "tcsetattr"; ! if (!PyArg_ParseTuple(args, "O&iO:tcsetattr", ! fdconv, &fd, &when, &term)) return NULL; if (!PyList_Check(term) || PyList_Size(term) != 7) { ! PyErr_SetString(PyExc_TypeError, ! "tcsetattr, arg 3: must be 7 element list"); return NULL; } *************** *** 155,159 **** if (!PyList_Check(cc) || PyList_Size(cc) != NCCS) { ! PyErr_SetString(PyExc_TypeError, BAD); return NULL; } --- 182,188 ---- if (!PyList_Check(cc) || PyList_Size(cc) != NCCS) { ! PyErr_Format(PyExc_TypeError, ! "tcsetattr: attributes[6] must be %d element list", ! NCCS); return NULL; } *************** *** 167,171 **** mode.c_cc[i] = (cc_t) PyInt_AsLong(v); else { ! PyErr_SetString(PyExc_TypeError, BAD); return NULL; } --- 196,201 ---- mode.c_cc[i] = (cc_t) PyInt_AsLong(v); else { ! PyErr_SetString(PyExc_TypeError, ! "tcsetattr: elements of attributes must be characters or integers"); return NULL; } *************** *** 183,194 **** } - /* tcsendbreak(fd, duration) - Generate a break condition. */ - static char termios_tcsendbreak__doc__[] = "\ tcsendbreak(fd, duration) -> None\n\ Send a break on file descriptor fd.\n\ ! A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration \n\ ! has a system dependent meaning. "; static PyObject * --- 213,222 ---- } static char termios_tcsendbreak__doc__[] = "\ tcsendbreak(fd, duration) -> None\n\ + \n\ Send a break on file descriptor fd.\n\ ! A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration\n\ ! has a system dependent meaning."; static PyObject * *************** *** 197,201 **** int fd, duration; ! if (!PyArg_Parse(args, "(ii)", &fd, &duration)) return NULL; if (tcsendbreak(fd, duration) == -1) --- 225,232 ---- int fd, duration; ! fname = "tcsendbreak"; ! ! if (!PyArg_ParseTuple(args, "O&i:tcsendbreak", ! fdconv, &fd, &duration)) return NULL; if (tcsendbreak(fd, duration) == -1) *************** *** 206,216 **** } - /* tcdrain(fd) - Wait until all queued output to the terminal has been - transmitted. */ - static char termios_tcdrain__doc__[] = "\ tcdrain(fd) -> None\n\ ! Wait until all output written to file descriptor fd has been transmitted. "; static PyObject * --- 237,244 ---- } static char termios_tcdrain__doc__[] = "\ tcdrain(fd) -> None\n\ ! \n\ ! Wait until all output written to file descriptor fd has been transmitted."; static PyObject * *************** *** 218,223 **** { int fd; ! if (!PyArg_Parse(args, "i", &fd)) return NULL; if (tcdrain(fd) == -1) --- 246,254 ---- { int fd; + + fname = "tcdrain"; ! if (!PyArg_ParseTuple(args, "O&:tcdrain", ! fdconv, &fd)) return NULL; if (tcdrain(fd) == -1) *************** *** 228,237 **** } - /* tcflush(fd, queue) - Clear the input and/or output queues associated with - the terminal. */ - static char termios_tcflush__doc__[] = "\ tcflush(fd, queue) -> None\n\ Discard queued data on file descriptor fd.\n\ The queue selector specifies which queue: termios.TCIFLUSH for the input\n\ --- 259,265 ---- } static char termios_tcflush__doc__[] = "\ tcflush(fd, queue) -> None\n\ + \n\ Discard queued data on file descriptor fd.\n\ The queue selector specifies which queue: termios.TCIFLUSH for the input\n\ *************** *** 244,248 **** int fd, queue; ! if (!PyArg_Parse(args, "(ii)", &fd, &queue)) return NULL; if (tcflush(fd, queue) == -1) --- 272,279 ---- int fd, queue; ! fname = "tcflush"; ! ! if (!PyArg_ParseTuple(args, "O&i:tcflush", ! fdconv, &fd, &queue)) return NULL; if (tcflush(fd, queue) == -1) *************** *** 253,262 **** } - /* tcflow(fd, action) - Perform operations relating to XON/XOFF flow control on - the terminal. */ - static char termios_tcflow__doc__[] = "\ tcflow(fd, action) -> None\n\ Suspend or resume input or output on file descriptor fd.\n\ The action argument can be termios.TCOOFF to suspend output,\n\ --- 284,290 ---- } static char termios_tcflow__doc__[] = "\ tcflow(fd, action) -> None\n\ + \n\ Suspend or resume input or output on file descriptor fd.\n\ The action argument can be termios.TCOOFF to suspend output,\n\ *************** *** 268,273 **** { int fd, action; ! if (!PyArg_Parse(args, "(ii)", &fd, &action)) return NULL; if (tcflow(fd, action) == -1) --- 296,304 ---- { int fd, action; + + fname = "tcflow"; ! if (!PyArg_ParseTuple(args, "O&i:tcflow", ! fdconv, &fd, &action)) return NULL; if (tcflow(fd, action) == -1) *************** *** 281,295 **** { {"tcgetattr", termios_tcgetattr, ! METH_OLDARGS, termios_tcgetattr__doc__}, {"tcsetattr", termios_tcsetattr, ! METH_OLDARGS, termios_tcsetattr__doc__}, {"tcsendbreak", termios_tcsendbreak, ! METH_OLDARGS, termios_tcsendbreak__doc__}, {"tcdrain", termios_tcdrain, ! METH_OLDARGS, termios_tcdrain__doc__}, {"tcflush", termios_tcflush, ! METH_OLDARGS, termios_tcflush__doc__}, {"tcflow", termios_tcflow, ! METH_OLDARGS, termios_tcflow__doc__}, {NULL, NULL} }; --- 312,326 ---- { {"tcgetattr", termios_tcgetattr, ! METH_VARARGS, termios_tcgetattr__doc__}, {"tcsetattr", termios_tcsetattr, ! METH_VARARGS, termios_tcsetattr__doc__}, {"tcsendbreak", termios_tcsendbreak, ! METH_VARARGS, termios_tcsendbreak__doc__}, {"tcdrain", termios_tcdrain, ! METH_VARARGS, termios_tcdrain__doc__}, {"tcflush", termios_tcflush, ! METH_VARARGS, termios_tcflush__doc__}, {"tcflow", termios_tcflow, ! METH_VARARGS, termios_tcflow__doc__}, {NULL, NULL} }; From gvwilson@users.sourceforge.net Mon May 7 20:51:12 2001 From: gvwilson@users.sourceforge.net (Greg Wilson) Date: Mon, 07 May 2001 12:51:12 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0218.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv28802 Modified Files: pep-0218.txt Log Message: Updating PEP to reflect prototype implementation Index: pep-0218.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0218.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** pep-0218.txt 2000/12/14 17:11:17 1.4 --- pep-0218.txt 2001/05/07 19:51:10 1.5 *************** *** 2,9 **** Title: Adding a Built-In Set Object Type Version: $Revision$ ! Author: gvwilson@nevex.com (Greg Wilson) Status: Draft Type: Standards Track ! Python-Version: 2.1 Created: 31-Jul-2000 Post-History: --- 2,9 ---- Title: Adding a Built-In Set Object Type Version: $Revision$ ! Author: gvwilson@ddj.com (Greg Wilson) Status: Draft Type: Standards Track ! Python-Version: 2.2 Created: 31-Jul-2000 Post-History: *************** *** 12,26 **** Introduction ! This PEP proposes adding sets as a built-in type in Python. Rationale - One of Python's greatest strengths as a teaching language is its - clarity. Its syntax and object model are so clean, and so simple, - that it can serve as "executable pseudocode". Anything that makes - it even better suited for this role will help increase its use in - school and college courses. - Sets are a fundamental mathematical structure, and are very commonly used in algorithm specifications. They are much less --- 12,29 ---- Introduction ! This PEP proposes adding a Set module to the standard Python ! library, and to then make sets a built-in Python type if that ! module is widely used. After explaining why sets are desirable, ! and why the common idiom of using dictionaries in their place is ! inadequate, we describe how we intend built-in sets to work, and ! then how the preliminary Set module will behave. The penultimate ! section discusses the mutability (or otherwise) of sets and set ! elements, and the solution which the Set module will implement. ! The last section then looks at alternatives that were considered, ! but discarded. Rationale Sets are a fundamental mathematical structure, and are very commonly used in algorithm specifications. They are much less *************** *** 43,59 **** ! Proposal ! We propose adding a set type to Python. This type will be an ! unordered collection of unique values, just as a dictionary is an ! unordered collection of key/value pairs. Constant sets will be ! represented using the usual mathematical notation, so that ! "{1, 2, 3}" will be a set of three integers. ! In order to avoid ambiguity, the empty set will be written "{,}", rather than "{}" (which is already used to represent empty dictionaries). We feel that this notation is as reasonable as the use of "(3,)" to represent single-element tuples; a more radical ! strategy is discussed in the "Alternatives" section. Iteration and comprehension will be implemented in the obvious --- 46,64 ---- ! Long-Term Proposal ! The long-term goal of this PEP is to add a built-in set type to ! Python. This type will be an unordered collection of unique ! values, just as a dictionary is an unordered collection of ! key/value pairs. Constant sets will be represented using the ! usual mathematical notation, so that "{1, 2, 3}" will be a set of ! three integers. ! In order to avoid ambiguity, the empty set will be written "{-}", rather than "{}" (which is already used to represent empty dictionaries). We feel that this notation is as reasonable as the use of "(3,)" to represent single-element tuples; a more radical ! strategy is discussed in the "Alternatives" section, and more ! readable than the earlier proposal "{,}". Iteration and comprehension will be implemented in the obvious *************** *** 67,170 **** will produce a set containing the squares of all elements in S, ! ! Membership will be tested using "in" and "not in". ! ! The binary operators '|', '&', '-', and "^" will implement set ! union, intersection, difference, and symmetric difference. Their ! in-place equivalents will have the obvious semantics. (We feel ! that it is more sensible to overload the bitwise operators '|' and ! '&', rather than the arithmetic operators '+' and "*', because ! there is no arithmetic equivalent of '^'.) ! ! The method "add" will add an element to a set. This is different ! from set union, as the following example shows: ! ! >>> {1, 2, 3} | {4, 5, 6} ! {1, 2, 3, 4, 5, 6} ! ! >>> {1, 2, 3}.add({4, 5, 6}) ! {1, 2, 3, {4, 5, 6}} ! ! Note that we expect that items can also be added to sets using ! in-place union of temporaries, i.e. "S |= {x}" instead of ! "S.add(x)". ! ! Elements will be deleted from sets using a "remove" method, or ! using "del": ! ! >>> S = {1, 2, 3} ! >>> S.remove(3) ! >>> S ! {1, 2} ! >>> del S[1] ! >>> S ! {2} ! ! The "KeyError" exception will be raised if an attempt is made to ! remove an element which is not in a set. This definition of "del" ! is consistent with that used for dictionaries: ! ! >>> D = {1:2, 3:4} ! >>> del D[1] ! >>> D ! {3:4} ! ! A new method "dict.keyset" will return the keys of a dictionary as ! a set. A corresponding method "dict.valueset" will return the ! dictionary's values as a set. ! ! A built-in converter "set()" will convert any sequence type to a ! set; converters such as "list()" and "tuple()" will be extended to ! handle sets as input. ! ! ! Open Issues ! ! One major issue remains to be resolved: will sets be allowed to ! contain mutable values, or will their values be required to ! immutable (as dictionary keys are)? The disadvantages of allowing ! only immutable values are clear --- if nothing else, it would ! prevent users from creating sets of sets. ! ! However, no efficient implementation of sets of mutable values has ! yet been suggested. Hashing approaches will obviously fail (which ! is why mutable values are not allowed to be dictionary keys). ! Even simple-minded implementations, such as storing the set's ! values in a list, can give incorrect results, as the following ! example shows: ! ! >>> a = [1, 2] ! >>> b = [3, 4] ! >>> S = [a, b] ! >>> a[0:2] = [3, 4] ! >>> S ! [[3, 4], [3, 4]] ! ! One way to solve this problem would be to add observer/observable ! functionality to every data structure in Python, so that ! structures would know to update themselves when their contained ! values mutated. This is clearly impractical given the current ! code base, and the performance penalties (in both memory and ! execution time) would probably be unacceptable anyway. Alternatives ! A more conservative alternative to this proposal would be to add a ! new built-in class "Set", rather than adding new syntax for direct ! expression of sets. On the positive side, this would not require ! any changes to the Python language definition. On the negative ! side, people would then not be able to write Python programs using ! the same notation as they would use on a whiteboard. We feel that ! the more Python supports standard pre-existing notation, the ! greater the chances of it being adopted as a teaching language. ! ! A radical alternative to the (admittedly clumsy) notation "{,}" is ! to re-define "{}" to be the empty collection, rather than the ! empty dictionary. Operations which made this object non-empty ! would silently convert it to either a dictionary or a set; it ! would then retain that type for the rest of its existence. This ! idea was rejected because of its potential impact on existing ! Python programs. A similar proposal to modify "dict.keys" and "dict.values" to return sets, rather than lists, was rejected for the same reasons. --- 72,188 ---- will produce a set containing the squares of all elements in S, ! Membership will be tested using "in" and "not in", and basic set ! operations will be implemented by a mixture of overloaded ! operators: ! ! | union ! & intersection ! ^ symmetric difference ! - asymmetric difference ! ! and methods: ! ! S.add(x) Add "x" to the set. ! ! S.update(s) Add all elements of sequence "s" to the set. ! ! S.remove(x) Remove "x" from the set. If "x" is not ! present, this method raises a LookupError ! exception. ! ! S.discard(x) Remove "x" from the set if it is present, or ! do nothing if it is not. ! ! S.popitem() Remove and return an arbitrary element, ! raising a LookupError if the element is not ! present. ! ! and one new built-in conversion function: ! ! set(x) Create a set containing the elements of the ! collection "x". ! ! Notes: ! ! 1. We propose using the bitwise operators "|&" for intersection ! and union. While "+" for union would be intuitive, "*" for ! intersection is not (very few of the people asked guessed what ! it did correctly). ! ! 2. We considered using "+" to add elements to a set, rather than ! "add". However, Guido van Rossum pointed out that "+" is ! symmetric for other built-in types (although "*" is not). Use ! of "add" will also avoid confusion between that operation and ! set union. ! ! 3. Sets raise "LookupError" exceptions, rather than "KeyError" or ! "ValueError", because set elements are neither keys nor values. ! ! Short-Term Proposal ! ! In order to determine whether there is enough demand for sets to ! justify making them a built-in type, and to give users a chance to ! try out the semantics we propose for sets, our short-term proposal ! is to add a "Set" class to the standard Python library. This ! class will have the operators and methods described above; it will ! also have named methods corresponding to all of the operations: a ! "union" method for "|", and a "union_update" method for "|=", and ! so on. ! ! This class will use a dictionary internally to contain set values. ! In order to avoid having to duplicate values (e.g. for iteration ! through the set), the class will rely on the iterators which are ! scheduled to appear in Python 2.2. ! ! Tim Peters believes that the class's constructor should take a ! single sequence as an argument, and populate the set with that ! sequence's elements. His argument is that in most cases, ! programmers will be created sets from pre-existing sequences, so ! that common case should be usual. However, this would require ! users to remember an extra set of parentheses when initializing a ! set with known values: ! ! >>> Set((1, 2, 3, 4)) # case 1 ! ! On the other hand, feedback from a small number of novice Python ! users (all of whom were very experienced with other languages) ! indicates that people will find a "parenthesis-free" syntax more ! natural: ! ! >>> Set(1, 2, 3, 4) # case 2 ! ! On the other, other hand, if Python does adopt a dictionary-like ! notation for sets in the future, then case 2 will become ! redundant. We have therefore adopted the first strategy, in which ! the initializer takes a single sequence argument. ! ! ! Mutability ! ! The most difficult question to resolve in this proposal was ! whether sets ought to be able to contain mutable elements. A ! dictionary's keys must be immutable in order to support fast, ! reliable lookup. While it would be easy to require set elements ! to be immutable, this would preclude sets of sets (which are ! widely used in graph algorithms and other applications). ! ! At Tim Peters' suggestion, we will implement the following ! compromise. A set may only contain immutable elements, but is ! itself mutable *until* its hash code is calculated. As soon as ! that happens, the set is "frozen", i.e. becomes immutable. Thus, ! a set may be used as a dictionary key, or as a set element, but ! cannot be updated after this is done. Peters reports that this ! behavior rarely causes problems in practice. Alternatives ! An alternative to the notation "{-}" for the empty set would be to ! re-define "{}" to be the empty collection, rather than the empty ! dictionary. Operations which made this object non-empty would ! silently convert it to either a dictionary or a set; it would then ! retain that type for the rest of its existence. This idea was ! rejected because of its potential impact on existing Python ! programs. A similar proposal to modify "dict.keys" and "dict.values" to return sets, rather than lists, was rejected for the same reasons. From tim_one@users.sourceforge.net Mon May 7 21:53:53 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 07 May 2001 13:53:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.129,2.130 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12135/python/dist/src/objects Modified Files: object.c Log Message: SF bug #422108 - Error in rich comparisons. 2.1.1 bugfix candidate too. Fix a bad (albeit unlikely) return value in try_rich_to_3way_compare(). Also document do_cmp()'s return values. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.129 retrieving revision 2.130 diff -C2 -r2.129 -r2.130 *** object.c 2001/05/05 10:06:17 2.129 --- object.c 2001/05/07 20:53:51 2.130 *************** *** 448,452 **** switch (try_rich_compare_bool(v, w, tries[i].op)) { case -1: ! return -1; case 1: return tries[i].outcome; --- 448,452 ---- switch (try_rich_compare_bool(v, w, tries[i].op)) { case -1: ! return -2; case 1: return tries[i].outcome; *************** *** 586,589 **** --- 586,595 ---- #define CHECK_TYPES(o) PyType_HasFeature((o)->ob_type, Py_TPFLAGS_CHECKTYPES) + /* Do a 3-way comparison, by hook or by crook. Return: + -2 for an exception; + -1 if v < w; + 0 if v == w; + 1 if v > w; + */ static int do_cmp(PyObject *v, PyObject *w) From gvanrossum@users.sourceforge.net Tue May 8 00:19:26 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 07 May 2001 16:19:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.12,2.16.8.13 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18783 Modified Files: Tag: descr-branch typeobject.c Log Message: Implement overriding of special operations slots by __foo__ methods. I had to create a *lot* of little wrapper functions for this; haven't had the time to test them all yet. Next step (maybe tomorrow): Python subclass instances should have a __dict__ (unless they specify something else). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.12 retrieving revision 2.16.8.13 diff -C2 -r2.16.8.12 -r2.16.8.13 *** typeobject.c 2001/05/06 02:52:04 2.16.8.12 --- typeobject.c 2001/05/07 23:19:24 2.16.8.13 *************** *** 149,157 **** } /* TypeType's constructor is called when a type is subclassed */ static PyObject * type_construct(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! PyObject *name, *bases, *dict, *x; PyTypeObject *base; char *dummy = NULL; --- 149,169 ---- } + staticforward void override_slots(PyTypeObject *type, PyObject *dict); + + typedef struct { + PyTypeObject type; + PyNumberMethods as_number; + PySequenceMethods as_sequence; + PyMappingMethods as_mapping; + PyBufferProcs as_buffer; + char name[1]; + } etype; + /* TypeType's constructor is called when a type is subclassed */ static PyObject * type_construct(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! char *name; ! PyObject *bases, *dict, *x; PyTypeObject *base; char *dummy = NULL; *************** *** 162,166 **** return NULL; } ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "SOO", &dummy, &name, &bases, &dict)) return NULL; --- 174,178 ---- return NULL; } ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "sOO", &dummy, &name, &bases, &dict)) return NULL; *************** *** 186,195 **** return NULL; } ! type = PyObject_New(PyTypeObject, &PyType_Type); if (type == NULL) return NULL; ! memset(((char *)type) + offsetof(PyTypeObject, tp_name), '\0', ! sizeof(PyTypeObject) - offsetof(PyTypeObject, tp_name)); ! type->tp_name = PyString_AS_STRING(name); type->tp_flags = Py_TPFLAGS_DEFAULT; Py_INCREF(base); --- 198,211 ---- return NULL; } ! type = PyObject_MALLOC(sizeof(etype) + strlen(name)); if (type == NULL) return NULL; ! memset(type, '\0', sizeof(etype)); ! PyObject_INIT(type, &PyType_Type); ! type->tp_as_number = & (((etype *)type)->as_number); ! type->tp_as_sequence = & (((etype *)type)->as_sequence); ! type->tp_as_mapping = & (((etype *)type)->as_mapping); ! type->tp_as_buffer = & (((etype *)type)->as_buffer); ! type->tp_name = strcpy(((etype *)type)->name, name); type->tp_flags = Py_TPFLAGS_DEFAULT; Py_INCREF(base); *************** *** 209,213 **** } Py_DECREF(x); /* throw away None */ ! PyDict_SetItemString(type->tp_dict, "__name__", name); return (PyObject *)type; } --- 225,229 ---- } Py_DECREF(x); /* throw away None */ ! override_slots(type, dict); return (PyObject *)type; } *************** *** 1117,1119 **** --- 1133,1443 ---- return 0; + } + + /* Slot wrappers that call the corresponding __foo__ slot */ + + #define SLOT0(SLOTNAME, OPNAME) \ + static PyObject * \ + slot_##SLOTNAME(PyObject *self) \ + { \ + return PyObject_CallMethod(self, "__" #OPNAME "__", ""); \ + } + + #define SLOT1(SLOTNAME, OPNAME, ARG1TYPE, ARGCODES) \ + static PyObject * \ + slot_##SLOTNAME(PyObject *self, ARG1TYPE arg1) \ + { \ + return PyObject_CallMethod(self, "__" #OPNAME "__", #ARGCODES, arg1); \ + } + + #define SLOT2(SLOTNAME, OPNAME, ARG1TYPE, ARG2TYPE, ARGCODES) \ + static PyObject * \ + slot_##SLOTNAME(PyObject *self, ARG1TYPE arg1, ARG2TYPE arg2) \ + { \ + return PyObject_CallMethod(self, "__" #OPNAME "__", \ + #ARGCODES, arg1, arg2); \ + } + + static int + slot_sq_length(PyObject *self) + { + PyObject *res = PyObject_CallMethod(self, "__len__", ""); + + if (res == NULL) + return -1; + return (int)PyInt_AsLong(res); + } + + SLOT1(sq_concat, add, PyObject *, O); + SLOT1(sq_repeat, mul, int, i); + SLOT1(sq_item, getitem, int, i); + SLOT2(sq_slice, getslice, int, int, ii); + + static int + slot_sq_ass_item(PyObject *self, int index, PyObject *value) + { + PyObject *res = PyObject_CallMethod(self, "__setitem__", + "iO", index, value); + if (res == NULL) + return -1; + Py_DECREF(res); + return 0; + } + + static int + slot_sq_ass_slice(PyObject *self, int i, int j, PyObject *value) + { + PyObject *res = PyObject_CallMethod(self, "__setitem__", + "iiO", i, j, value); + if (res == NULL) + return -1; + Py_DECREF(res); + return 0; + } + + static int + slot_sq_contains(PyObject *self, PyObject *value) + { + PyObject *res = PyObject_CallMethod(self, "__contains__", "O", value); + int r; + + if (res == NULL) + return -1; + r = PyInt_AsLong(res); + Py_DECREF(res); + return r; + } + + SLOT1(sq_inplace_concat, iadd, PyObject *, O); + SLOT1(sq_inplace_repeat, imul, int, i); + + #define slot_mp_length slot_sq_length + + SLOT1(mp_subscript, getitem, PyObject *, O); + + static int + slot_mp_ass_subscript(PyObject *self, PyObject *key, PyObject *value) + { + PyObject *res = PyObject_CallMethod(self, "__setitem__", + "OO", key, value); + if (res == NULL) + return -1; + Py_DECREF(res); + return 0; + } + + SLOT1(nb_add, add, PyObject *, O); + SLOT1(nb_subtract, sub, PyObject *, O); + SLOT1(nb_multiply, mul, PyObject *, O); + SLOT1(nb_divide, div, PyObject *, O); + SLOT1(nb_remainder, mod, PyObject *, O); + SLOT1(nb_divmod, divmod, PyObject *, O); + SLOT2(nb_power, pow, PyObject *, PyObject *, OO); + SLOT0(nb_negative, neg); + SLOT0(nb_positive, pos); + SLOT0(nb_absolute, abs); + + static int + slot_nb_nonzero(PyObject *self) + { + PyObject *res = PyObject_CallMethod(self, "__nonzero__", ""); + + if (res == NULL) + return -1; + return (int)PyInt_AsLong(res); + } + + SLOT0(nb_invert, invert); + SLOT1(nb_lshift, lshift, PyObject *, O); + SLOT1(nb_rshift, rshift, PyObject *, O); + SLOT1(nb_and, and, PyObject *, O); + SLOT1(nb_xor, xor, PyObject *, O); + SLOT1(nb_or, or, PyObject *, O); + /* Not coerce() */ + SLOT0(nb_int, int); + SLOT0(nb_long, long); + SLOT0(nb_float, float); + SLOT0(nb_oct, oct); + SLOT0(nb_hex, hex); + SLOT1(nb_inplace_add, iadd, PyObject *, O); + SLOT1(nb_inplace_subtract, isub, PyObject *, O); + SLOT1(nb_inplace_multiply, imul, PyObject *, O); + SLOT1(nb_inplace_divide, idiv, PyObject *, O); + SLOT1(nb_inplace_remainder, imod, PyObject *, O); + SLOT2(nb_inplace_power, ipow, PyObject *, PyObject *, OO); + SLOT1(nb_inplace_lshift, ilshift, PyObject *, O); + SLOT1(nb_inplace_rshift, irshift, PyObject *, O); + SLOT1(nb_inplace_and, iand, PyObject *, O); + SLOT1(nb_inplace_xor, ixor, PyObject *, O); + SLOT1(nb_inplace_or, ior, PyObject *, O); + + static int + slot_tp_compare(PyObject *self, PyObject *other) + { + PyObject *res = PyObject_CallMethod(self, "__cmp__", "O", other); + long r; + + if (res == NULL) + return -1; + r = PyInt_AsLong(res); + Py_DECREF(res); + return (int)r; + } + + SLOT0(tp_repr, repr); + + static long + slot_tp_hash(PyObject *self) + { + PyObject *res = PyObject_CallMethod(self, "__hash__", ""); + long h; + + if (res == NULL) + return -1; + h = PyInt_AsLong(res); + if (h == -1 && !PyErr_Occurred()) + h = -2; + return h; + } + + static PyObject * + slot_tp_call(PyObject *self, PyObject *args, PyObject *kwds) + { + PyObject *meth = PyObject_GetAttrString(self, "__call__"); + PyObject *res; + + if (meth == NULL) + return NULL; + res = PyObject_Call(meth, args, kwds); + Py_DECREF(meth); + return res; + } + + SLOT0(tp_str, str); + + /* Map rich comparison operators to their __xx__ namesakes */ + static char *name_op[] = { + "__lt__", + "__le__", + "__eq__", + "__ne__", + "__gt__", + "__ge__", + }; + + static PyObject * + slot_tp_richcompare(PyObject *self, PyObject *other, int op) + { + PyObject *meth = PyObject_GetAttrString(self, name_op[op]); + PyObject *res; + + if (meth == NULL) + return NULL; + res = PyObject_CallFunction(meth, "O", other); + Py_DECREF(meth); + return res; + } + + SLOT0(tp_iter, iter); + + static PyObject * + slot_tp_iternext(PyObject *self) + { + return PyObject_CallMethod(self, "next", ""); + } + + static void + override_slots(PyTypeObject *type, PyObject *dict) + { + PySequenceMethods *sq = type->tp_as_sequence; + PyMappingMethods *mp = type->tp_as_mapping; + PyNumberMethods *nb = type->tp_as_number; + + #define SQSLOT(OPNAME, SLOTNAME) \ + if (PyDict_GetItemString(dict, "__" #OPNAME "__")) { \ + sq->SLOTNAME = slot_##SLOTNAME; \ + } + + #define MPSLOT(OPNAME, SLOTNAME) \ + if (PyDict_GetItemString(dict, "__" #OPNAME "__")) { \ + mp->SLOTNAME = slot_##SLOTNAME; \ + } + + #define NBSLOT(OPNAME, SLOTNAME) \ + if (PyDict_GetItemString(dict, "__" #OPNAME "__")) { \ + nb->SLOTNAME = slot_##SLOTNAME; \ + } + + #define TPSLOT(OPNAME, SLOTNAME) \ + if (PyDict_GetItemString(dict, "__" #OPNAME "__")) { \ + type->SLOTNAME = slot_##SLOTNAME; \ + } + + SQSLOT(len, sq_length); + SQSLOT(add, sq_concat); + SQSLOT(mul, sq_repeat); + SQSLOT(getitem, sq_item); + SQSLOT(getslice, sq_slice); + SQSLOT(setitem, sq_ass_item); + SQSLOT(setslice, sq_ass_slice); + SQSLOT(contains, sq_contains); + SQSLOT(iadd, sq_inplace_concat); + SQSLOT(imul, sq_inplace_repeat); + + MPSLOT(len, mp_length); + MPSLOT(getitem, mp_subscript); + MPSLOT(setitem, mp_ass_subscript); + + NBSLOT(add, nb_add); + NBSLOT(sub, nb_subtract); + NBSLOT(mul, nb_multiply); + NBSLOT(div, nb_divide); + NBSLOT(mod, nb_remainder); + NBSLOT(divmod, nb_divmod); + NBSLOT(pow, nb_power); + NBSLOT(neg, nb_negative); + NBSLOT(pos, nb_positive); + NBSLOT(abs, nb_absolute); + NBSLOT(nonzero, nb_nonzero); + NBSLOT(invert, nb_invert); + NBSLOT(lshift, nb_lshift); + NBSLOT(rshift, nb_rshift); + NBSLOT(and, nb_and); + NBSLOT(xor, nb_xor); + NBSLOT(or, nb_or); + /* Not coerce() */ + NBSLOT(int, nb_int); + NBSLOT(long, nb_long); + NBSLOT(float, nb_float); + NBSLOT(oct, nb_oct); + NBSLOT(hex, nb_hex); + NBSLOT(iadd, nb_inplace_add); + NBSLOT(isub, nb_inplace_subtract); + NBSLOT(imul, nb_inplace_multiply); + NBSLOT(idiv, nb_inplace_divide); + NBSLOT(imod, nb_inplace_remainder); + NBSLOT(ipow, nb_inplace_power); + NBSLOT(ilshift, nb_inplace_lshift); + NBSLOT(irshift, nb_inplace_rshift); + NBSLOT(iand, nb_inplace_and); + NBSLOT(ixor, nb_inplace_xor); + NBSLOT(ior, nb_inplace_or); + + if (PyDict_GetItemString(dict, "__str__") || + PyDict_GetItemString(dict, "__repr__")) + type->tp_print = NULL; + + TPSLOT(cmp, tp_compare); + TPSLOT(repr, tp_repr); + TPSLOT(hash, tp_hash); + TPSLOT(call, tp_call); + TPSLOT(str, tp_str); + TPSLOT(lt, tp_richcompare); + TPSLOT(le, tp_richcompare); + TPSLOT(eq, tp_richcompare); + TPSLOT(ne, tp_richcompare); + TPSLOT(gt, tp_richcompare); + TPSLOT(ge, tp_richcompare); + TPSLOT(iter, tp_iter); + TPSLOT(next, tp_iternext); } From tim_one@users.sourceforge.net Tue May 8 04:58:03 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 07 May 2001 20:58:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test double_const.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv20117/lib/test Added Files: double_const.py Log Message: This is a test showing SF bug 422177. It won't trigger until I check in another change (to test_import.py, which simply imports the new file). I'm checking this piece in now, though, to make it easier to distribute a patch for x-platform checking. --- NEW FILE: double_const.py --- from test_support import TestFailed # A test for SF bug 422177: manifest float constants varied way too much in # precision depending on whether Python was loading a module for the first # time, or reloading it from a precompiled .pyc. The "expected" failure # mode is that when test_import imports this after all .pyc files have been # erased, it passes, but when test_import imports this from # double_const.pyc, it fails. This indicates a woeful loss of precision in # the marshal format for doubles. It's also possible that repr() doesn't # produce enough digits to get reasonable precision for this box. PI = 3.14159265358979324 TWOPI = 6.28318530717958648 PI_str = "3.14159265358979324" TWOPI_str = "6.28318530717958648" # Verify that the double x is within a few bits of eval(x_str). def check_ok(x, x_str): assert x > 0.0 x2 = eval(x_str) assert x2 > 0.0 diff = abs(x - x2) # If diff is no larger than 3 ULP (wrt x2), then diff/8 is no larger # than 0.375 ULP, so adding diff/8 to x2 should have no effect. if x2 + (diff / 8.) != x2: raise TestFailed("Manifest const %s lost too much precision " % x_str) check_ok(PI, PI_str) check_ok(TWOPI, TWOPI_str) From jhylton@users.sourceforge.net Tue May 8 05:00:48 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 07 May 2001 21:00:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.89,2.90 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv20860 Modified Files: unicodeobject.c Log Message: Remove unused variable Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.89 retrieving revision 2.90 diff -C2 -r2.89 -r2.90 *** unicodeobject.c 2001/05/05 05:36:48 2.89 --- unicodeobject.c 2001/05/08 04:00:45 2.90 *************** *** 2722,2726 **** int reslen = 0; Py_UNICODE *p; - int seqlen = 0; int sz = 100; int i; --- 2722,2725 ---- From jhylton@users.sourceforge.net Tue May 8 05:08:18 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 07 May 2001 21:08:18 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_scope.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv22026 Modified Files: test_scope.py Log Message: SF patch 419176 from MvL; fixed bug 418977 Two errors in dict_to_map() helper used by PyFrame_LocalsToFast(). Index: test_scope.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** test_scope.py 2001/04/27 02:29:18 1.15 --- test_scope.py 2001/05/08 04:08:16 1.16 *************** *** 448,449 **** --- 448,469 ---- inst = f(3)() verify(inst.a == inst.m()) + + print "20. interaction with trace function" + + import sys + def tracer(a,b,c): + return tracer + + def adaptgetter(name, klass, getter): + kind, des = getter + if kind == 1: # AV happens when stepping from this line to next + if des == "": + des = "_%s__%s" % (klass.__name__, name) + return lambda obj: getattr(obj, des) + + class TestClass: + pass + + sys.settrace(tracer) + adaptgetter("foo", TestClass, (1, "")) + sys.settrace(None) From jhylton@users.sourceforge.net Tue May 8 05:08:22 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 07 May 2001 21:08:22 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects frameobject.c,2.49,2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22044 Modified Files: frameobject.c Log Message: SF patch 419176 from MvL; fixed bug 418977 Two errors in dict_to_map() helper used by PyFrame_LocalsToFast(). Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -r2.49 -r2.50 *** frameobject.c 2001/04/14 17:55:41 2.49 --- frameobject.c 2001/05/08 04:08:20 2.50 *************** *** 284,293 **** Py_XINCREF(value); if (deref) { ! if (value) { if (PyCell_Set(values[j], value) < 0) PyErr_Clear(); - } else if (clear) { - Py_XDECREF(values[j]); - values[j] = value; } } else if (value != NULL || clear) { --- 284,290 ---- Py_XINCREF(value); if (deref) { ! if (value || clear) { if (PyCell_Set(values[j], value) < 0) PyErr_Clear(); } } else if (value != NULL || clear) { *************** *** 371,378 **** dict_to_map(f->f_code->co_cellvars, PyTuple_GET_SIZE(f->f_code->co_cellvars), ! locals, fast, 1, clear); dict_to_map(f->f_code->co_freevars, PyTuple_GET_SIZE(f->f_code->co_freevars), ! locals, fast, 1, clear); } PyErr_Restore(error_type, error_value, error_traceback); --- 368,375 ---- dict_to_map(f->f_code->co_cellvars, PyTuple_GET_SIZE(f->f_code->co_cellvars), ! locals, fast + f->f_nlocals, 1, clear); dict_to_map(f->f_code->co_freevars, PyTuple_GET_SIZE(f->f_code->co_freevars), ! locals, fast + f->f_nlocals + f->f_ncells, 1, clear); } PyErr_Restore(error_type, error_value, error_traceback); From jhylton@users.sourceforge.net Tue May 8 05:09:01 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 07 May 2001 21:09:01 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_scope,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv22100 Modified Files: test_scope Log Message: SF patch 419176 from MvL; fixed bug 418977 Two errors in dict_to_map() helper used by PyFrame_LocalsToFast(). Index: test_scope =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_scope,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** test_scope 2001/04/27 02:29:27 1.7 --- test_scope 2001/05/08 04:08:59 1.8 *************** *** 19,20 **** --- 19,21 ---- 18. verify that locals() works 19. var is bound and free in class + 20. interaction with trace function From jhylton@users.sourceforge.net Tue May 8 05:12:36 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 07 May 2001 21:12:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.198,2.199 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv22456 Modified Files: compile.c Log Message: Several small changes. Mostly reformatting, adding parens. Check for free in class and method only if nested scopes are enabled. Add assertion to verify that no free variables occur when nested scopes are disabled. XXX When should nested scopes by made non-optional on the trunk? Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.198 retrieving revision 2.199 diff -C2 -r2.198 -r2.199 *** compile.c 2001/04/27 02:29:40 2.198 --- compile.c 2001/05/08 04:12:34 2.199 *************** *** 4079,4083 **** */ if (is_free(flags ^ DEF_FREE_CLASS) ! || flags == DEF_FREE_CLASS) return 0; v = PyInt_FromLong(si->si_nfrees++); --- 4079,4083 ---- */ if (is_free(flags ^ DEF_FREE_CLASS) ! || (flags == DEF_FREE_CLASS)) return 0; v = PyInt_FromLong(si->si_nfrees++); *************** *** 4261,4264 **** --- 4261,4265 ---- if (!(flags & DEF_BOUND)) return 0; + /* The semantics of this code will change with nested scopes. It is defined in the current scope and referenced in a *************** *** 4365,4370 **** variables or declared global. */ ! if (flags & (DEF_FREE | DEF_FREE_CLASS)) { symtable_resolve_free(c, name, flags, &si); } --- 4366,4373 ---- variables or declared global. */ ! if (st->st_nested_scopes) { ! if (flags & (DEF_FREE | DEF_FREE_CLASS)) { symtable_resolve_free(c, name, flags, &si); + } } *************** *** 4426,4438 **** } - /* - fprintf(stderr, - "cells %d: %s\n" - "frees %d: %s\n", - si.si_ncells, PyObject_REPR(c->c_cellvars), - si.si_nfrees, PyObject_REPR(c->c_freevars)); - */ assert(PyDict_Size(c->c_freevars) == si.si_nfrees); if (si.si_ncells > 1) { /* one cell is always in order */ if (symtable_cellvar_offsets(&c->c_cellvars, c->c_argcount, --- 4429,4437 ---- } assert(PyDict_Size(c->c_freevars) == si.si_nfrees); + if (st->st_nested_scopes == 0) + assert(si.si_nfrees == 0); + if (si.si_ncells > 1) { /* one cell is always in order */ if (symtable_cellvar_offsets(&c->c_cellvars, c->c_argcount, *************** *** 4539,4543 **** indirectly) in A and there are no scopes with bindings for N between B and A, then N ! is global in B. */ if (v && (ste->ste_type != TYPE_CLASS)) { --- 4538,4544 ---- indirectly) in A and there are no scopes with bindings for N between B and A, then N ! is global in B. Unless A is a class scope, ! because class scopes are not considered for ! nested scopes. */ if (v && (ste->ste_type != TYPE_CLASS)) { From jhylton@users.sourceforge.net Tue May 8 05:20:54 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Mon, 07 May 2001 21:20:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/scripts trace.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv24404 Modified Files: trace.py Log Message: Fix several bugs and add two features. Assertion error message had typos in arguments to string format. .cover files for modules in packages are now put in the right place. The code that generate .cover files seemed to prepend a "./" to many absolute paths, causing them to fail. The code now checks explicitly for absolute paths and leaves them alone. In trace/coverage code, recover from case where module has no __name__ attribute, when e.g. it is executed by PyRun_String(). In this case, assign modulename to None and hope for the best. There isn't anywhere to write out coverage data for this code anyway. Also, replace several sys.stderr.writes with print >> sys.stderr. New features: -C/--coverdir dir: Generate .cover files in specified directory instead of in the directory where the .py file is. -s: Print a short summary of files coverred (# lines, % coverage, name) Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/trace.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** trace.py 2001/01/17 08:48:39 1.3 --- trace.py 2001/05/08 04:20:52 1.4 *************** *** 75,78 **** --- 75,80 ---- execute any code. (One of `-t', `-c' or `-r' must be specified) + -s,--summary Generate a brief summary for each file. (Can only + be used with -c or -r.) I/O: *************** *** 86,89 **** --- 88,92 ---- -R,--no-report Do not generate the annotated reports. Useful if you want to accumulate several over tests. + -C,--coverdir= Generate .cover files in this directory Selection: Do not trace or log lines from ... *************** *** 198,203 **** # make sure they point to the same file assert modules[key] == other_modules[key], \ ! "Strange! filename %s has two different module names" % \ ! (key, modules[key], other_module[key]) else: modules[key] = other_modules[key] --- 201,207 ---- # make sure they point to the same file assert modules[key] == other_modules[key], \ ! "Strange! filename %s has two different module " \ ! "names: %s and %s" % \ ! (key, modules[key], other_modules[key]) else: modules[key] = other_modules[key] *************** *** 255,258 **** --- 259,264 ---- import parser + assert filename.endswith('.py') + prog = open(filename).read() ast = parser.suite(prog) *************** *** 282,286 **** def create_results_log(results, dirname = ".", show_missing = 1, ! save_counts = 0): import re # turn the counts data ("(filename, lineno) = count") into something --- 288,292 ---- def create_results_log(results, dirname = ".", show_missing = 1, ! save_counts = 0, summary = 0, coverdir = None): import re # turn the counts data ("(filename, lineno) = count") into something *************** *** 303,306 **** --- 309,315 ---- blank = re.compile(r'^\s*(#.*)?$') + # accumulate summary info, if needed + sums = {} + # generate file paths for the coverage files we are going to write... fnlist = [] *************** *** 316,349 **** continue ! # XXX this is almost certainly not portable!!! ! fndir = os.path.dirname(filename) ! if filename[:1] == os.sep: ! coverpath = os.path.join(dirname, "."+fndir) ! else: ! coverpath = os.path.join(dirname, fndir) if filename.endswith(".pyc") or filename.endswith(".pyo"): filename = filename[:-1] # Get the original lines from the .py file try: lines = open(filename, 'r').readlines() except IOError, err: ! sys.stderr.write("%s: Could not open %s for reading " \ ! "because: %s - skipping\n" % \ ! ("trace", `filename`, err.strerror)) continue - modulename = os.path.split(results.modules[key])[1] - - # build list file name by appending a ".cover" to the module name - # and sticking it into the specified directory - listfilename = os.path.join(coverpath, modulename + ".cover") - #sys.stderr.write("modulename: %(modulename)s\n" - # "filename: %(filename)s\n" - # "coverpath: %(coverpath)s\n" - # "listfilename: %(listfilename)s\n" - # "dirname: %(dirname)s\n" - # % locals()) try: outfile = open(listfilename, 'w') --- 325,360 ---- continue ! modulename = os.path.split(results.modules[key])[1] if filename.endswith(".pyc") or filename.endswith(".pyo"): filename = filename[:-1] + if coverdir: + listfilename = os.path.join(coverdir, modulename + ".cover") + else: + # XXX this is almost certainly not portable!!! + fndir = os.path.dirname(filename) + if os.path.isabs(filename): + coverpath = fndir + else: + coverpath = os.path.join(dirname, fndir) + + # build list file name by appending a ".cover" to the module name + # and sticking it into the specified directory + if "." in modulename: + # A module in a package + finalname = modulename.split(".")[-1] + listfilename = os.path.join(coverpath, finalname + ".cover") + else: + listfilename = os.path.join(coverpath, modulename + ".cover") + # Get the original lines from the .py file try: lines = open(filename, 'r').readlines() except IOError, err: ! print >> sys.stderr, "trace: Could not open %s for reading " \ ! "because: %s - skipping" % (`filename`, err.strerror) continue try: outfile = open(listfilename, 'w') *************** *** 361,364 **** --- 372,377 ---- executable_linenos = {} + n_lines = 0 + n_hits = 0 lines_hit = per_file[key] for i in range(len(lines)): *************** *** 370,373 **** --- 383,388 ---- # count precedes the lines that we captured outfile.write('%5d: ' % lines_hit[i+1]) + n_hits = n_hits + 1 + n_lines = n_lines + 1 elif blank.match(line): # blank lines and comments are preceded by dots *************** *** 384,391 **** --- 399,411 ---- else: outfile.write(' '*7) + n_lines = n_lines + 1 outfile.write(string.expandtabs(lines[i], 8)) outfile.close() + if summary and n_lines: + percent = int(100 * n_hits / n_lines) + sums[modulename] = n_lines, percent, modulename, filename + if save_counts: # try and store counts and module info into dirname *************** *** 399,402 **** --- 419,430 ---- "files because %s" % err.strerror) + if summary and sums: + mods = sums.keys() + mods.sort() + print "lines cov% module (path)" + for m in mods: + n_lines, percent, modulename, filename = sums[m] + print "%5d %3d%% %s (%s)" % sums[m] + # There is a lot of code shared between these two classes even though # it is straightforward to make a super class to share code. However, *************** *** 420,424 **** if filename is None: filename = frame.f_code.co_filename ! modulename = frame.f_globals["__name__"] # We do this next block to keep from having to make methods --- 448,457 ---- if filename is None: filename = frame.f_code.co_filename ! try: ! modulename = frame.f_globals["__name__"] ! except KeyError: ! # PyRun_String() for example ! # XXX what to do? ! modulename = None # We do this next block to keep from having to make methods *************** *** 450,459 **** self.ignore_names = ignore._ignore # access ignore's cache (speed hack) ! self.files = {'': None} # stores lines from the .py file, or None def trace(self, frame, why, arg): if why == 'line': filename = frame.f_code.co_filename ! modulename = frame.f_globals["__name__"] # We do this next block to keep from having to make methods --- 483,498 ---- self.ignore_names = ignore._ignore # access ignore's cache (speed hack) ! self.files = {'': None} # stores lines from the .py file, ! # or None def trace(self, frame, why, arg): if why == 'line': filename = frame.f_code.co_filename ! try: ! modulename = frame.f_globals["__name__"] ! except KeyError: ! # PyRun_String() for example ! # XXX what to do? ! modulename = None # We do this next block to keep from having to make methods *************** *** 475,479 **** # If you want to see filenames (the original behaviour), try: # modulename = filename ! # or, prettier but confusing when several files have the same name # modulename = os.path.basename(filename) --- 514,519 ---- # If you want to see filenames (the original behaviour), try: # modulename = filename ! # or, prettier but confusing when several files have the ! # same name # modulename = os.path.basename(filename) *************** *** 488,492 **** def _err_exit(msg): ! sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) sys.exit(1) --- 528,532 ---- def _err_exit(msg): ! print >> sys.stderr, "%s: %s" % (sys.argv[0], msg) sys.exit(1) *************** *** 497,509 **** argv = sys.argv try: ! opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:m", ["help", "version", "trace", "count", "report", "no-report", "file=", "logdir=", "missing", ! "ignore-module=", "ignore-dir="]) except getopt.error, msg: ! sys.stderr.write("%s: %s\n" % (sys.argv[0], msg)) ! sys.stderr.write("Try `%s --help' for more information\n" % sys.argv[0]) sys.exit(1) --- 537,551 ---- argv = sys.argv try: ! opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:msC:", ["help", "version", "trace", "count", "report", "no-report", "file=", "logdir=", "missing", ! "ignore-module=", "ignore-dir=", ! "coverdir="]) except getopt.error, msg: ! print >> sys.stderr, "%s: %s" % (sys.argv[0], msg) ! print >> sys.stderr, "Try `%s --help' for more information" \ ! % sys.argv[0] sys.exit(1) *************** *** 517,520 **** --- 559,564 ---- ignore_modules = [] ignore_dirs = [] + coverdir = None + summary = 0 for opt, val in opts: *************** *** 555,558 **** --- 599,610 ---- continue + if opt == "-C" or opt == "--coverdir": + coverdir = val + continue + + if opt == "-s" or opt == "--summary": + summary = 1 + continue + if opt == "--ignore-module": ignore_modules.append(val) *************** *** 639,643 **** if not no_report: ! create_results_log(results, logdir, missing) if counts_file: --- 691,696 ---- if not no_report: ! create_results_log(results, logdir, missing, ! summary=summary, coverdir=coverdir) if counts_file: *************** *** 652,656 **** old_counts, old_modules = marshal.load(open(counts_file, 'rb')) results = CoverageResults(old_counts, old_modules) ! create_results_log(results, logdir, missing) else: --- 705,710 ---- old_counts, old_modules = marshal.load(open(counts_file, 'rb')) results = CoverageResults(old_counts, old_modules) ! create_results_log(results, logdir, missing, ! summary=summary, coverdir=coverdir) else: From tim_one@users.sourceforge.net Tue May 8 05:38:31 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 07 May 2001 21:38:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_richcmp.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv27260/lib/test Modified Files: test_richcmp.py Log Message: SF patch #421922: Implement rich comparison for dicts. d1 == d2 and d1 != d2 now work even if the keys and values in d1 and d2 don't support comparisons other than ==, and testing dicts for equality is faster now (especially when inequality obtains). Index: test_richcmp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_richcmp.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** test_richcmp.py 2001/01/19 06:12:17 1.5 --- test_richcmp.py 2001/05/08 04:38:29 1.6 *************** *** 222,225 **** --- 222,252 ---- if verbose: print "recursion tests ok" + def dicts(): + # Verify that __eq__ and __ne__ work for dicts even if the keys and + # values don't support anything other than __eq__ and __ne__. Complex + # numbers are a fine example of that. + import random + imag1a = {} + for i in range(50): + imag1a[random.randrange(100)*1j] = random.randrange(100)*1j + items = imag1a.items() + random.shuffle(items) + imag1b = {} + for k, v in items: + imag1b[k] = v + imag2 = imag1b.copy() + imag2[k] = v + 1.0 + verify(imag1a == imag1a, "imag1a == imag1a should have worked") + verify(imag1a == imag1b, "imag1a == imag1b should have worked") + verify(imag2 == imag2, "imag2 == imag2 should have worked") + verify(imag1a != imag2, "imag1a != imag2 should have worked") + for op in "<", "<=", ">", ">=": + try: + eval("imag1a %s imag2" % op) + except TypeError: + pass + else: + raise TestFailed("expected TypeError from imag1a %s imag2" % op) + def main(): basic() *************** *** 230,233 **** --- 257,261 ---- misbehavin() recursion() + dicts() main() From tim_one@users.sourceforge.net Tue May 8 05:38:31 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 07 May 2001 21:38:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.82,2.83 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv27260/objects Modified Files: dictobject.c Log Message: SF patch #421922: Implement rich comparison for dicts. d1 == d2 and d1 != d2 now work even if the keys and values in d1 and d2 don't support comparisons other than ==, and testing dicts for equality is faster now (especially when inequality obtains). Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.82 retrieving revision 2.83 diff -C2 -r2.82 -r2.83 *** dictobject.c 2001/05/02 15:13:44 2.82 --- dictobject.c 2001/05/08 04:38:29 2.83 *************** *** 1048,1051 **** --- 1048,1121 ---- } + /* Return 1 if dicts equal, 0 if not, -1 if error. + * Gets out as soon as any difference is detected. + * Uses only Py_EQ comparison. + */ + static int + dict_equal(dictobject *a, dictobject *b) + { + int i; + + if (a->ma_used != b->ma_used) + /* can't be equal if # of entries differ */ + return 0; + + /* Same # of entries -- check all of 'em. Exit early on any diff. */ + for (i = 0; i < a->ma_size; i++) { + PyObject *aval = a->ma_table[i].me_value; + if (aval != NULL) { + int cmp; + PyObject *bval; + PyObject *key = a->ma_table[i].me_key; + /* temporarily bump aval's refcount to ensure it stays + alive until we're done with it */ + Py_INCREF(aval); + bval = PyDict_GetItem((PyObject *)b, key); + if (bval == NULL) { + Py_DECREF(aval); + return 0; + } + cmp = PyObject_RichCompareBool(aval, bval, Py_EQ); + Py_DECREF(aval); + if (cmp <= 0) /* error or not equal */ + return cmp; + } + } + return 1; + } + + static PyObject * + dict_richcompare(PyObject *v, PyObject *w, int op) + { + int cmp; + PyObject *res; + + if (!PyDict_Check(v) || !PyDict_Check(w)) { + res = Py_NotImplemented; + } + else if (op == Py_EQ || op == Py_NE) { + cmp = dict_equal((dictobject *)v, (dictobject *)w); + if (cmp < 0) + return NULL; + res = (cmp == (op == Py_EQ)) ? Py_True : Py_False; + } + else { + cmp = dict_compare((dictobject *)v, (dictobject *)w); + if (cmp < 0 && PyErr_Occurred()) + return NULL; + switch (op) { + case Py_LT: cmp = cmp < 0; break; + case Py_LE: cmp = cmp <= 0; break; + case Py_GT: cmp = cmp > 0; break; + case Py_GE: cmp = cmp >= 0; break; + default: + assert(!"op unexpected"); + } + res = cmp ? Py_True : Py_False; + } + Py_INCREF(res); + return res; + } + static PyObject * dict_has_key(register dictobject *mp, PyObject *args) *************** *** 1411,1415 **** (getattrfunc)dict_getattr, /* tp_getattr */ 0, /* tp_setattr */ ! (cmpfunc)dict_compare, /* tp_compare */ (reprfunc)dict_repr, /* tp_repr */ 0, /* tp_as_number */ --- 1481,1485 ---- (getattrfunc)dict_getattr, /* tp_getattr */ 0, /* tp_setattr */ ! 0, /* tp_compare */ (reprfunc)dict_repr, /* tp_repr */ 0, /* tp_as_number */ *************** *** 1426,1430 **** (traverseproc)dict_traverse, /* tp_traverse */ (inquiry)dict_tp_clear, /* tp_clear */ ! 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ (getiterfunc)dict_iter, /* tp_iter */ --- 1496,1500 ---- (traverseproc)dict_traverse, /* tp_traverse */ (inquiry)dict_tp_clear, /* tp_clear */ ! dict_richcompare, /* tp_richcompare */ 0, /* tp_weaklistoffset */ (getiterfunc)dict_iter, /* tp_iter */ From tim_one@users.sourceforge.net Tue May 8 05:38:31 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 07 May 2001 21:38:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.161,1.162 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv27260/misc Modified Files: NEWS Log Message: SF patch #421922: Implement rich comparison for dicts. d1 == d2 and d1 != d2 now work even if the keys and values in d1 and d2 don't support comparisons other than ==, and testing dicts for equality is faster now (especially when inequality obtains). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -r1.161 -r1.162 *** NEWS 2001/05/06 01:05:01 1.161 --- NEWS 2001/05/08 04:38:29 1.162 *************** *** 18,28 **** - The following functions were generalized to work nicely with iterator arguments: ! map(), filter(), reduce() list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API) max(), min() - zip() .join() method of strings 'x in y' and 'x not in y' (PySequence_Contains() in C API) operator.countOf() (PySequence_Count() in C API) --- 18,30 ---- - The following functions were generalized to work nicely with iterator arguments: ! map(), filter(), reduce(), zip() list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API) max(), min() .join() method of strings 'x in y' and 'x not in y' (PySequence_Contains() in C API) operator.countOf() (PySequence_Count() in C API) + + - Comparing dictionary objects via == and != is faster, and now works even + if the keys and values don't support comparisons other than ==. From fdrake@users.sourceforge.net Tue May 8 06:37:54 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 07 May 2001 22:37:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libtermios.tex,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv3445/Doc/lib Modified Files: libtermios.tex Log Message: Michael Hudson : Documentation update to reflect changes to the termios module (noting that the termios functions can take a file object as well as a file descriptor). This closes the documentation portion of SF patch #417081. Index: libtermios.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtermios.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** libtermios.tex 2001/02/27 22:01:15 1.19 --- libtermios.tex 2001/05/08 05:37:52 1.20 *************** *** 17,22 **** All functions in this module take a file descriptor \var{fd} as their ! first argument. This must be an integer file descriptor, such as ! returned by \code{sys.stdin.fileno()}. This module also defines all the constants needed to work with the --- 17,23 ---- All functions in this module take a file descriptor \var{fd} as their ! first argument. This can be an integer file descriptor, such as ! returned by \code{sys.stdin.fileno()}, or a file object, such as ! \code{sys.stdin} itself. This module also defines all the constants needed to work with the From fdrake@acm.org Tue May 8 06:45:10 2001 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Tue, 8 May 2001 01:45:10 -0400 (EDT) Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.198,2.199 In-Reply-To: References: Message-ID: <15095.34790.566136.71209@cj42289-a.reston1.va.home.com> Jeremy Hylton writes: > XXX When should nested scopes by made non-optional on the trunk? Immediately! We've said it will be mandatory for 2.2, and 2.1 maintenance is done on a branch. There's no reason to delay. -Fred -- Fred L. Drake, Jr. PythonLabs at Digital Creations From tim_one@users.sourceforge.net Tue May 8 16:19:59 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 08 May 2001 08:19:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include floatobject.h,2.17,2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv5500/python/dist/src/Include Modified Files: floatobject.h Log Message: SF bug #422177: Results from .pyc differs from .py Store floats and doubles to full precision in marshal. Test that floats read from .pyc/.pyo closely match those read from .py. Declare PyFloat_AsString() in floatobject header file. Add new PyFloat_AsReprString() API function. Document the functions declared in floatobject.h. Index: floatobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/floatobject.h,v retrieving revision 2.17 retrieving revision 2.18 diff -C2 -r2.17 -r2.18 *** floatobject.h 2000/09/01 23:29:26 2.17 --- floatobject.h 2001/05/08 15:19:57 2.18 *************** *** 21,30 **** #define PyFloat_Check(op) ((op)->ob_type == &PyFloat_Type) ! extern DL_IMPORT(PyObject *) PyFloat_FromString(PyObject*, char**); extern DL_IMPORT(PyObject *) PyFloat_FromDouble(double); - extern DL_IMPORT(double) PyFloat_AsDouble(PyObject *); ! /* Macro, trading safety for speed */ #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) #ifdef __cplusplus --- 21,49 ---- #define PyFloat_Check(op) ((op)->ob_type == &PyFloat_Type) ! /* Return Python float from string PyObject. Second argument ignored on ! input, and, if non-NULL, NULL is stored into *junk (this tried to serve a ! purpose once but can't be made to work as intended). */ ! extern DL_IMPORT(PyObject *) PyFloat_FromString(PyObject*, char** junk); ! ! /* Return Python float from C double. */ extern DL_IMPORT(PyObject *) PyFloat_FromDouble(double); ! /* Extract C double from Python float. The macro version trades safety for ! speed. */ ! extern DL_IMPORT(double) PyFloat_AsDouble(PyObject *); #define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) + + /* Write repr(v) into the char buffer argument, followed by null byte. The + buffer must be "big enough"; >= 100 is very safe. + PyFloat_AsReprString(buf, x) strives to print enough digits so that + PyFloat_FromString(buf) then reproduces x exactly. */ + extern DL_IMPORT(void) PyFloat_AsReprString(char*, PyFloatObject *v); + + /* Write str(v) into the char buffer argument, followed by null byte. The + buffer must be "big enough"; >= 100 is very safe. Note that it's + unusual to be able to get back the float you started with from + PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to + preserve precision across conversions. */ + extern DL_IMPORT(void) PyFloat_AsString(char*, PyFloatObject *v); #ifdef __cplusplus From tim_one@users.sourceforge.net Tue May 8 16:19:59 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 08 May 2001 08:19:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python marshal.c,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv5500/python/dist/src/Python Modified Files: marshal.c Log Message: SF bug #422177: Results from .pyc differs from .py Store floats and doubles to full precision in marshal. Test that floats read from .pyc/.pyo closely match those read from .py. Declare PyFloat_AsString() in floatobject header file. Add new PyFloat_AsReprString() API function. Document the functions declared in floatobject.h. Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -r1.62 -r1.63 *** marshal.c 2001/04/10 05:02:52 1.62 --- marshal.c 2001/05/08 15:19:57 1.63 *************** *** 150,156 **** } else if (PyFloat_Check(v)) { - extern void PyFloat_AsString(char *, PyFloatObject *); char buf[256]; /* Plenty to format any double */ ! PyFloat_AsString(buf, (PyFloatObject *)v); n = strlen(buf); w_byte(TYPE_FLOAT, p); --- 150,155 ---- } else if (PyFloat_Check(v)) { char buf[256]; /* Plenty to format any double */ ! PyFloat_AsReprString(buf, (PyFloatObject *)v); n = strlen(buf); w_byte(TYPE_FLOAT, p); *************** *** 160,164 **** #ifndef WITHOUT_COMPLEX else if (PyComplex_Check(v)) { - extern void PyFloat_AsString(char *, PyFloatObject *); char buf[256]; /* Plenty to format any double */ PyFloatObject *temp; --- 159,162 ---- *************** *** 166,170 **** temp = (PyFloatObject*)PyFloat_FromDouble( PyComplex_RealAsDouble(v)); ! PyFloat_AsString(buf, temp); Py_DECREF(temp); n = strlen(buf); --- 164,168 ---- temp = (PyFloatObject*)PyFloat_FromDouble( PyComplex_RealAsDouble(v)); ! PyFloat_AsReprString(buf, temp); Py_DECREF(temp); n = strlen(buf); *************** *** 173,177 **** temp = (PyFloatObject*)PyFloat_FromDouble( PyComplex_ImagAsDouble(v)); ! PyFloat_AsString(buf, temp); Py_DECREF(temp); n = strlen(buf); --- 171,175 ---- temp = (PyFloatObject*)PyFloat_FromDouble( PyComplex_ImagAsDouble(v)); ! PyFloat_AsReprString(buf, temp); Py_DECREF(temp); n = strlen(buf); From tim_one@users.sourceforge.net Tue May 8 16:19:59 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 08 May 2001 08:19:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_import.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5500/python/dist/src/Lib/test Modified Files: test_import.py Log Message: SF bug #422177: Results from .pyc differs from .py Store floats and doubles to full precision in marshal. Test that floats read from .pyc/.pyo closely match those read from .py. Declare PyFloat_AsString() in floatobject header file. Add new PyFloat_AsReprString() API function. Document the functions declared in floatobject.h. Index: test_import.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_import.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_import.py 2001/03/21 03:58:16 1.3 --- test_import.py 2001/05/08 15:19:57 1.4 *************** *** 14,17 **** --- 14,20 ---- raise TestFailed("import of RAnDoM should have failed (case mismatch)") + # Another brief digression to test the accuracy of manifest float constants. + import double_const # don't blink -- that *was* the test + sys.path.insert(0, os.curdir) From tim_one@users.sourceforge.net Tue May 8 16:19:59 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 08 May 2001 08:19:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects floatobject.c,2.81,2.82 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5500/python/dist/src/Objects Modified Files: floatobject.c Log Message: SF bug #422177: Results from .pyc differs from .py Store floats and doubles to full precision in marshal. Test that floats read from .pyc/.pyo closely match those read from .py. Declare PyFloat_AsString() in floatobject header file. Add new PyFloat_AsReprString() API function. Document the functions declared in floatobject.h. Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.81 retrieving revision 2.82 diff -C2 -r2.81 -r2.82 *** floatobject.c 2001/03/11 08:37:29 2.81 --- floatobject.c 2001/05/08 15:19:57 2.82 *************** *** 312,315 **** --- 312,321 ---- } + void + PyFloat_AsReprString(char *buf, PyFloatObject *v) + { + PyFloat_AsStringEx(buf, v, PREC_REPR); + } + /* ARGSUSED */ static int From tim_one@users.sourceforge.net Tue May 8 16:43:40 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 08 May 2001 08:43:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.162,1.163 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv10822/python/dist/src/Misc Modified Files: NEWS Log Message: Blurb about the increased precision of float literals in .pyc/.pyo files. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.162 retrieving revision 1.163 diff -C2 -r1.162 -r1.163 *** NEWS 2001/05/08 04:38:29 1.162 --- NEWS 2001/05/08 15:43:37 1.163 *************** *** 4,7 **** --- 4,27 ---- Core + - Float (and complex) literals in source code were evaluated to full + precision only when running from a .py file; the same code loaded from a + .pyc (or .pyo) file could suffer numeric differences starting at about the + 12th significant decimal digit. For example, on a machine with IEEE-754 + floating arithmetic, + + x = 9007199254740992.0 + print long(x) + + printed 9007199254740992 if run directly from .py, but 9007199254740000 + if from a compiled (.pyc or .pyo) file. This was due to marshal using + str(float) instead of repr(float) when building code objects. marshal + now uses repr(float) instead, which should reproduce floats to full + machine precision (assuming the platform C float<->string I/O conversion + functions are of good quality). + + This may cause floating-point results to change in some cases, and + usually for the better, but may also cause numerically unstable + algorithms to break. + - Dictionary objects now support the "in" operator: "x in dict" means the same as dict.has_key(x). From fdrake@users.sourceforge.net Tue May 8 19:55:59 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 08 May 2001 11:55:59 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0006.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv17180 Modified Files: pep-0006.txt Log Message: Go ahead and list Thomas Wouters as patch czar for Python 2.1.1; this should have been added a while ago! Index: pep-0006.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0006.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** pep-0006.txt 2001/04/17 16:55:11 1.3 --- pep-0006.txt 2001/05/08 18:55:57 1.4 *************** *** 100,103 **** --- 100,105 ---- Patch Czar History + Thomas Wouters (thomas@xs4all.net) is the Patch Czar for 2.1.1. + Moshe Zadka (moshez@zadka.site.co.il) is the Patch Czar for 2.0.1. From fdrake@users.sourceforge.net Tue May 8 20:02:29 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 08 May 2001 12:02:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include patchlevel.h,2.42,2.42.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv18793/Include Modified Files: Tag: release20-maint patchlevel.h Log Message: Fix the version information to reflect that this is the maintenance branch. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.42 retrieving revision 2.42.2.1 diff -C2 -r2.42 -r2.42.2.1 *** patchlevel.h 2000/10/13 23:05:44 2.42 --- patchlevel.h 2001/05/08 19:02:27 2.42.2.1 *************** *** 22,34 **** #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 0 ! #define PY_MICRO_VERSION 0 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL #define PY_RELEASE_SERIAL 1 /* Version as a string */ ! #define PY_VERSION "2.0" /* Historic */ ! #define PATCHLEVEL "2.0" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 22,34 ---- #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 0 ! #define PY_MICRO_VERSION 1 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA #define PY_RELEASE_SERIAL 1 /* Version as a string */ ! #define PY_VERSION "2.0.1a1" /* Historic */ ! #define PATCHLEVEL "2.0.1a1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From tim_one@users.sourceforge.net Tue May 8 23:33:53 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 08 May 2001 15:33:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.107,2.108 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv979/python/dist/src/Objects Modified Files: stringobject.c Log Message: Intern 1-character strings as soon as they're created. As-is, they aren't interned when created, so the cached versions generally aren't ever interned. With the patch, the Py_INCREF(t); *p = t; Py_DECREF(s); return; indirection block in PyString_InternInPlace() is never executed during a full run of the test suite, but was executed very many times before. So I'm trading more work when creating one-character strings for doing less work later. Note that the "more work" here can happen at most 256 times per program run, so it's trivial. The same reasoning accounts for the patch's simplification of string_item (the new version can call PyString_FromStringAndSize() no more than 256 times per run, so there's no point to inlining that stuff -- if we were serious about saving time here, we'd pre-initialize the characters vector so that no runtime testing at all was needed!). Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.107 retrieving revision 2.108 diff -C2 -r2.107 -r2.108 *** stringobject.c 2001/05/05 05:36:48 2.107 --- stringobject.c 2001/05/08 22:33:50 2.108 *************** *** 37,41 **** PyString_FromStringAndSize(const char *str, int size) { ! register PyStringObject *op; #ifndef DONT_SHARE_SHORT_STRINGS if (size == 0 && (op = nullstring) != NULL) { --- 37,41 ---- PyString_FromStringAndSize(const char *str, int size) { ! PyStringObject *op; #ifndef DONT_SHARE_SHORT_STRINGS if (size == 0 && (op = nullstring) != NULL) { *************** *** 74,80 **** --- 74,82 ---- #ifndef DONT_SHARE_SHORT_STRINGS if (size == 0) { + PyString_InternInPlace(&(PyObject *)op); nullstring = op; Py_INCREF(op); } else if (size == 1 && str != NULL) { + PyString_InternInPlace(&(PyObject *)op); characters[*str & UCHAR_MAX] = op; Py_INCREF(op); *************** *** 88,92 **** { register size_t size = strlen(str); ! register PyStringObject *op; if (size > INT_MAX) { PyErr_SetString(PyExc_OverflowError, --- 90,94 ---- { register size_t size = strlen(str); ! PyStringObject *op; if (size > INT_MAX) { PyErr_SetString(PyExc_OverflowError, *************** *** 126,132 **** --- 128,136 ---- #ifndef DONT_SHARE_SHORT_STRINGS if (size == 0) { + PyString_InternInPlace(&(PyObject *)op); nullstring = op; Py_INCREF(op); } else if (size == 1) { + PyString_InternInPlace(&(PyObject *)op); characters[*str & UCHAR_MAX] = op; Py_INCREF(op); *************** *** 552,573 **** int c; PyObject *v; if (i < 0 || i >= a->ob_size) { PyErr_SetString(PyExc_IndexError, "string index out of range"); return NULL; } ! c = a->ob_sval[i] & UCHAR_MAX; v = (PyObject *) characters[c]; ! #ifdef COUNT_ALLOCS ! if (v != NULL) ! one_strings++; ! #endif ! if (v == NULL) { ! v = PyString_FromStringAndSize((char *)NULL, 1); ! if (v == NULL) ! return NULL; ! characters[c] = (PyStringObject *) v; ! ((PyStringObject *)v)->ob_sval[0] = c; ! } ! Py_INCREF(v); return v; } --- 556,570 ---- int c; PyObject *v; + char *pchar; if (i < 0 || i >= a->ob_size) { PyErr_SetString(PyExc_IndexError, "string index out of range"); return NULL; } ! pchar = a->ob_sval + i; ! c = *pchar & UCHAR_MAX; v = (PyObject *) characters[c]; ! if (v == NULL) ! v = PyString_FromStringAndSize(pchar, 1); ! Py_XINCREF(v); return v; } From tim_one@users.sourceforge.net Wed May 9 01:24:57 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 08 May 2001 17:24:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.108,2.109 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22208/python/dist/src/Objects Modified Files: stringobject.c Log Message: My change to string_item() left an extra reference to each 1-character interned string created by "string"[i]. Since they're immortal anyway, this was hard to notice, but it was still wrong . Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.108 retrieving revision 2.109 diff -C2 -r2.108 -r2.109 *** stringobject.c 2001/05/08 22:33:50 2.108 --- stringobject.c 2001/05/09 00:24:55 2.109 *************** *** 554,558 **** string_item(PyStringObject *a, register int i) { - int c; PyObject *v; char *pchar; --- 554,557 ---- *************** *** 562,570 **** } pchar = a->ob_sval + i; ! c = *pchar & UCHAR_MAX; ! v = (PyObject *) characters[c]; if (v == NULL) v = PyString_FromStringAndSize(pchar, 1); ! Py_XINCREF(v); return v; } --- 561,569 ---- } pchar = a->ob_sval + i; ! v = (PyObject *)characters[*pchar & UCHAR_MAX]; if (v == NULL) v = PyString_FromStringAndSize(pchar, 1); ! else ! Py_INCREF(v); return v; } From tim_one@users.sourceforge.net Wed May 9 01:31:42 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 08 May 2001 17:31:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.109,2.110 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv23579/python/dist/src/Objects Modified Files: stringobject.c Log Message: Ack! Restore the COUNT_ALLOCS one_strings code. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.109 retrieving revision 2.110 diff -C2 -r2.109 -r2.110 *** stringobject.c 2001/05/09 00:24:55 2.109 --- stringobject.c 2001/05/09 00:31:40 2.110 *************** *** 564,569 **** if (v == NULL) v = PyString_FromStringAndSize(pchar, 1); ! else Py_INCREF(v); return v; } --- 564,573 ---- if (v == NULL) v = PyString_FromStringAndSize(pchar, 1); ! else { ! #ifdef COUNT_ALLOCS ! one_strings++; ! #endif Py_INCREF(v); + } return v; } From mhammond@users.sourceforge.net Wed May 9 01:51:01 2001 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Tue, 08 May 2001 17:51:01 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python dynload_win.c,2.7,2.8 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv26993 Modified Files: dynload_win.c Log Message: Always pass a full path name to LoadLibraryEx(). Fixes some Windows 9x problems. As discussed on python-dev Index: dynload_win.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/dynload_win.c,v retrieving revision 2.7 retrieving revision 2.8 diff -C2 -r2.7 -r2.8 *** dynload_win.c 2000/10/05 10:54:45 2.7 --- dynload_win.c 2001/05/09 00:50:59 2.8 *************** *** 164,185 **** #ifdef MS_WIN32 { ! HINSTANCE hDLL; char pathbuf[260]; ! if (strchr(pathname, '\\') == NULL && ! strchr(pathname, '/') == NULL) ! { ! /* Prefix bare filename with ".\" */ ! char *p = pathbuf; ! *p = '\0'; ! _getcwd(pathbuf, sizeof pathbuf); ! if (*p != '\0' && p[1] == ':') ! p += 2; ! sprintf(p, ".\\%-.255s", pathname); ! pathname = pathbuf; ! } ! /* Look for dependent DLLs in directory of pathname first */ ! /* XXX This call doesn't exist in Windows CE */ ! hDLL = LoadLibraryEx(pathname, NULL, ! LOAD_WITH_ALTERED_SEARCH_PATH); if (hDLL==NULL){ char errBuf[256]; --- 164,182 ---- #ifdef MS_WIN32 { ! HINSTANCE hDLL = NULL; char pathbuf[260]; ! LPTSTR dummy; ! /* We use LoadLibraryEx so Windows looks for dependent DLLs ! in directory of pathname first. However, Windows95 ! can sometimes not work correctly unless the absolute ! path is used. If GetFullPathName() fails, the LoadLibrary ! will certainly fail too, so use its error code */ ! if (GetFullPathName(pathname, ! sizeof(pathbuf), ! pathbuf, ! &dummy)) ! /* XXX This call doesn't exist in Windows CE */ ! hDLL = LoadLibraryEx(pathname, NULL, ! LOAD_WITH_ALTERED_SEARCH_PATH); if (hDLL==NULL){ char errBuf[256]; From fdrake@users.sourceforge.net Wed May 9 04:24:57 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 08 May 2001 20:24:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libfileinput.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv24927/lib Modified Files: libfileinput.tex Log Message: Note that when inplace=1 existing backup files will be removed silently. Closes SF bug #420230. Index: libfileinput.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfileinput.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** libfileinput.tex 2000/04/03 20:13:53 1.5 --- libfileinput.tex 2001/05/09 03:24:55 1.6 *************** *** 48,52 **** Create an instance of the \class{FileInput} class. The instance will be used as global state for the functions of this module, and ! is also returned to use during iteration. \end{funcdesc} --- 48,54 ---- Create an instance of the \class{FileInput} class. The instance will be used as global state for the functions of this module, and ! is also returned to use during iteration. The parameters to this ! function will be passed along to the constructor of the ! \class{FileInput} class. \end{funcdesc} *************** *** 119,123 **** \code{\var{inplace}=1} is passed to \function{input()} or to the \class{FileInput} constructor, the file is moved to a backup file and ! standard output is directed to the input file. This makes it possible to write a filter that rewrites its input file in place. If the keyword argument \code{\var{backup}='. Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv19891/perl Modified Files: SynopsisTable.pm Log Message: Minor adjustments to HTML for the module synopsis tables. Index: SynopsisTable.pm =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/SynopsisTable.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** SynopsisTable.pm 2000/09/09 05:53:41 1.6 --- SynopsisTable.pm 2001/05/09 15:32:14 1.7 *************** *** 53,64 **** sub tohtml{ my $self = shift; ! my $data = "\n"; my $name; foreach $name (split /,/, $self->{names}) { my($key,$type,$synopsis) = $self->get($name); my $link = ""; ! $data .= (' ' . "\n" . " \n"); } $data .= "
$link$name$synopsis
\n"; --- 53,68 ---- sub tohtml{ my $self = shift; ! my $oddrow = 1; ! my $data = "\n"; my $name; foreach $name (split /,/, $self->{names}) { my($key,$type,$synopsis) = $self->get($name); my $link = ""; ! $data .= (' \n " : '>') . "\n" + . " \n" . " \n"); + $oddrow = !$oddrow; } $data .= "
$link$name$synopsis
\n"; From jhylton@users.sourceforge.net Wed May 9 16:49:26 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 09 May 2001 08:49:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib urllib2.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23729 Modified Files: urllib2.py Log Message: Raise useful exception when called with URL for which request type cannot be determined. Pseudo-fix for SF bug #420724 Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** urllib2.py 2001/04/15 13:08:01 1.13 --- urllib2.py 2001/05/09 15:49:24 1.14 *************** *** 218,222 **** if self.type is None: self.type, self.__r_type = splittype(self.__original) ! assert self.type is not None, self.__original return self.type --- 218,223 ---- if self.type is None: self.type, self.__r_type = splittype(self.__original) ! if self.type is None: ! raise ValueError, "unknown url type: %s" % self.__original return self.type From fdrake@users.sourceforge.net Wed May 9 16:50:20 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 08:50:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libascii.tex,1.7,1.8 libbinascii.tex,1.19,1.20 libcalendar.tex,1.9,1.10 libcrypt.tex,1.15,1.16 libpipes.tex,1.4,1.5 libposix.tex,1.56,1.57 libshlex.tex,1.11,1.12 libsyslog.tex,1.14,1.15 libtermios.tex,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv23883/lib Modified Files: libascii.tex libbinascii.tex libcalendar.tex libcrypt.tex libpipes.tex libposix.tex libshlex.tex libsyslog.tex libtermios.tex Log Message: Work around limitations of the module synopsis table generation to avoid leaking LaTeX2HTML's internal string munging. This fixes SF bug #420399. Index: libascii.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libascii.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** libascii.tex 2001/01/10 19:34:52 1.7 --- libascii.tex 2001/05/09 15:50:17 1.8 *************** *** 4,8 **** \declaremodule{standard}{curses.ascii} \modulesynopsis{Constants and set-membership functions for ! \ASCII{} characters.} \moduleauthor{Eric S. Raymond}{esr@thyrsus.com} \sectionauthor{Eric S. Raymond}{esr@thyrsus.com} --- 4,8 ---- \declaremodule{standard}{curses.ascii} \modulesynopsis{Constants and set-membership functions for ! \ASCII\ characters.} \moduleauthor{Eric S. Raymond}{esr@thyrsus.com} \sectionauthor{Eric S. Raymond}{esr@thyrsus.com} Index: libbinascii.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbinascii.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** libbinascii.tex 2000/08/15 17:47:09 1.19 --- libbinascii.tex 2001/05/09 15:50:17 1.20 *************** *** 4,8 **** \declaremodule{builtin}{binascii} \modulesynopsis{Tools for converting between binary and various ! \ASCII{}-encoded binary representations.} --- 4,8 ---- \declaremodule{builtin}{binascii} \modulesynopsis{Tools for converting between binary and various ! \ASCII-encoded binary representations.} Index: libcalendar.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcalendar.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** libcalendar.tex 2000/10/09 15:27:31 1.9 --- libcalendar.tex 2001/05/09 15:50:17 1.10 *************** *** 4,8 **** \declaremodule{standard}{calendar} \modulesynopsis{General functions for working with the calendar, ! including some emulation of the \UNIX{} \program{cal} program.} \sectionauthor{Drew Csillag}{drew_csillag@geocities.com} --- 4,8 ---- \declaremodule{standard}{calendar} \modulesynopsis{General functions for working with the calendar, ! including some emulation of the \UNIX\ \program{cal} program.} \sectionauthor{Drew Csillag}{drew_csillag@geocities.com} Index: libcrypt.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcrypt.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** libcrypt.tex 2000/04/03 20:13:53 1.15 --- libcrypt.tex 2001/05/09 15:50:17 1.16 *************** *** 5,9 **** \platform{Unix} \modulesynopsis{The \cfunction{crypt()} function used to check ! \UNIX{} passwords.} \moduleauthor{Steven D. Majewski}{sdm7g@virginia.edu} \sectionauthor{Steven D. Majewski}{sdm7g@virginia.edu} --- 5,9 ---- \platform{Unix} \modulesynopsis{The \cfunction{crypt()} function used to check ! \UNIX\ passwords.} \moduleauthor{Steven D. Majewski}{sdm7g@virginia.edu} \sectionauthor{Steven D. Majewski}{sdm7g@virginia.edu} Index: libpipes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpipes.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** libpipes.tex 2000/12/01 15:25:23 1.4 --- libpipes.tex 2001/05/09 15:50:17 1.5 *************** *** 5,9 **** \platform{Unix} \sectionauthor{Moshe Zadka}{moshez@zadka.site.co.il} ! \modulesynopsis{A Python interface to \UNIX{} shell pipelines.} --- 5,9 ---- \platform{Unix} \sectionauthor{Moshe Zadka}{moshez@zadka.site.co.il} ! \modulesynopsis{A Python interface to \UNIX\ shell pipelines.} Index: libposix.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposix.tex,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -r1.56 -r1.57 *** libposix.tex 2001/03/01 18:29:57 1.56 --- libposix.tex 2001/05/09 15:50:17 1.57 *************** *** 4,8 **** \declaremodule{builtin}{posix} \platform{Unix} ! \modulesynopsis{The most common \POSIX{} system calls (normally used via module \refmodule{os}).} --- 4,8 ---- \declaremodule{builtin}{posix} \platform{Unix} ! \modulesynopsis{The most common \POSIX\ system calls (normally used via module \refmodule{os}).} Index: libshlex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshlex.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** libshlex.tex 2001/01/16 20:52:41 1.11 --- libshlex.tex 2001/05/09 15:50:17 1.12 *************** *** 3,7 **** \declaremodule{standard}{shlex} ! \modulesynopsis{Simple lexical analysis for \UNIX{} shell-like languages.} \moduleauthor{Eric S. Raymond}{esr@snark.thyrsus.com} \sectionauthor{Eric S. Raymond}{esr@snark.thyrsus.com} --- 3,7 ---- \declaremodule{standard}{shlex} ! \modulesynopsis{Simple lexical analysis for \UNIX\ shell-like languages.} \moduleauthor{Eric S. Raymond}{esr@snark.thyrsus.com} \sectionauthor{Eric S. Raymond}{esr@snark.thyrsus.com} Index: libsyslog.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsyslog.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** libsyslog.tex 1999/03/02 17:03:41 1.14 --- libsyslog.tex 2001/05/09 15:50:17 1.15 *************** *** 4,8 **** \declaremodule{builtin}{syslog} \platform{Unix} ! \modulesynopsis{An interface to the \UNIX{} syslog library routines.} --- 4,8 ---- \declaremodule{builtin}{syslog} \platform{Unix} ! \modulesynopsis{An interface to the \UNIX\ syslog library routines.} Index: libtermios.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtermios.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** libtermios.tex 2001/05/08 05:37:52 1.20 --- libtermios.tex 2001/05/09 15:50:17 1.21 *************** *** 4,8 **** \declaremodule{builtin}{termios} \platform{Unix} ! \modulesynopsis{\POSIX{} style tty control.} \indexii{\POSIX{}}{I/O control} --- 4,8 ---- \declaremodule{builtin}{termios} \platform{Unix} ! \modulesynopsis{\POSIX\ style tty control.} \indexii{\POSIX{}}{I/O control} From jhylton@users.sourceforge.net Wed May 9 16:50:20 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 09 May 2001 08:50:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_urllib2.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23894 Added Files: test_urllib2.py Log Message: Trivial tests of urllib2 for recent SF bug --- NEW FILE: test_urllib2.py --- from test_support import verify import urllib2 # A couple trivial tests try: urllib2.urlopen('bogus url') except ValueError: pass else: verify(0) file_url = "file://%s" % urllib2.__file__ f = urllib2.urlopen(file_url) buf = f.read() f.close() From jhylton@users.sourceforge.net Wed May 9 16:50:27 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Wed, 09 May 2001 08:50:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_urllib2,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv23937 Added Files: test_urllib2 Log Message: Trivial tests of urllib2 for recent SF bug --- NEW FILE: test_urllib2 --- test_urllib2 From fdrake@users.sourceforge.net Wed May 9 16:52:58 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 08:52:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libascii.tex,1.7,1.7.4.1 libbinascii.tex,1.19,1.19.6.1 libcalendar.tex,1.9,1.9.6.1 libcrypt.tex,1.15,1.15.8.1 libpipes.tex,1.4,1.4.4.1 libposix.tex,1.56,1.56.4.1 libshlex.tex,1.11,1.11.4.1 libsyslog.tex,1.14,1.14.12.1 libtermios.tex,1.19,1.19.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv24517/lib Modified Files: Tag: release21-maint libascii.tex libbinascii.tex libcalendar.tex libcrypt.tex libpipes.tex libposix.tex libshlex.tex libsyslog.tex libtermios.tex Log Message: Work around limitations of the module synopsis table generation to avoid leaking LaTeX2HTML's internal string munging. This fixes SF bug #420399. Index: libascii.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libascii.tex,v retrieving revision 1.7 retrieving revision 1.7.4.1 diff -C2 -r1.7 -r1.7.4.1 *** libascii.tex 2001/01/10 19:34:52 1.7 --- libascii.tex 2001/05/09 15:52:56 1.7.4.1 *************** *** 4,8 **** \declaremodule{standard}{curses.ascii} \modulesynopsis{Constants and set-membership functions for ! \ASCII{} characters.} \moduleauthor{Eric S. Raymond}{esr@thyrsus.com} \sectionauthor{Eric S. Raymond}{esr@thyrsus.com} --- 4,8 ---- \declaremodule{standard}{curses.ascii} \modulesynopsis{Constants and set-membership functions for ! \ASCII\ characters.} \moduleauthor{Eric S. Raymond}{esr@thyrsus.com} \sectionauthor{Eric S. Raymond}{esr@thyrsus.com} Index: libbinascii.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbinascii.tex,v retrieving revision 1.19 retrieving revision 1.19.6.1 diff -C2 -r1.19 -r1.19.6.1 *** libbinascii.tex 2000/08/15 17:47:09 1.19 --- libbinascii.tex 2001/05/09 15:52:56 1.19.6.1 *************** *** 4,8 **** \declaremodule{builtin}{binascii} \modulesynopsis{Tools for converting between binary and various ! \ASCII{}-encoded binary representations.} --- 4,8 ---- \declaremodule{builtin}{binascii} \modulesynopsis{Tools for converting between binary and various ! \ASCII-encoded binary representations.} Index: libcalendar.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcalendar.tex,v retrieving revision 1.9 retrieving revision 1.9.6.1 diff -C2 -r1.9 -r1.9.6.1 *** libcalendar.tex 2000/10/09 15:27:31 1.9 --- libcalendar.tex 2001/05/09 15:52:56 1.9.6.1 *************** *** 4,8 **** \declaremodule{standard}{calendar} \modulesynopsis{General functions for working with the calendar, ! including some emulation of the \UNIX{} \program{cal} program.} \sectionauthor{Drew Csillag}{drew_csillag@geocities.com} --- 4,8 ---- \declaremodule{standard}{calendar} \modulesynopsis{General functions for working with the calendar, ! including some emulation of the \UNIX\ \program{cal} program.} \sectionauthor{Drew Csillag}{drew_csillag@geocities.com} Index: libcrypt.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcrypt.tex,v retrieving revision 1.15 retrieving revision 1.15.8.1 diff -C2 -r1.15 -r1.15.8.1 *** libcrypt.tex 2000/04/03 20:13:53 1.15 --- libcrypt.tex 2001/05/09 15:52:56 1.15.8.1 *************** *** 5,9 **** \platform{Unix} \modulesynopsis{The \cfunction{crypt()} function used to check ! \UNIX{} passwords.} \moduleauthor{Steven D. Majewski}{sdm7g@virginia.edu} \sectionauthor{Steven D. Majewski}{sdm7g@virginia.edu} --- 5,9 ---- \platform{Unix} \modulesynopsis{The \cfunction{crypt()} function used to check ! \UNIX\ passwords.} \moduleauthor{Steven D. Majewski}{sdm7g@virginia.edu} \sectionauthor{Steven D. Majewski}{sdm7g@virginia.edu} Index: libpipes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpipes.tex,v retrieving revision 1.4 retrieving revision 1.4.4.1 diff -C2 -r1.4 -r1.4.4.1 *** libpipes.tex 2000/12/01 15:25:23 1.4 --- libpipes.tex 2001/05/09 15:52:56 1.4.4.1 *************** *** 5,9 **** \platform{Unix} \sectionauthor{Moshe Zadka}{moshez@zadka.site.co.il} ! \modulesynopsis{A Python interface to \UNIX{} shell pipelines.} --- 5,9 ---- \platform{Unix} \sectionauthor{Moshe Zadka}{moshez@zadka.site.co.il} ! \modulesynopsis{A Python interface to \UNIX\ shell pipelines.} Index: libposix.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposix.tex,v retrieving revision 1.56 retrieving revision 1.56.4.1 diff -C2 -r1.56 -r1.56.4.1 *** libposix.tex 2001/03/01 18:29:57 1.56 --- libposix.tex 2001/05/09 15:52:56 1.56.4.1 *************** *** 4,8 **** \declaremodule{builtin}{posix} \platform{Unix} ! \modulesynopsis{The most common \POSIX{} system calls (normally used via module \refmodule{os}).} --- 4,8 ---- \declaremodule{builtin}{posix} \platform{Unix} ! \modulesynopsis{The most common \POSIX\ system calls (normally used via module \refmodule{os}).} Index: libshlex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshlex.tex,v retrieving revision 1.11 retrieving revision 1.11.4.1 diff -C2 -r1.11 -r1.11.4.1 *** libshlex.tex 2001/01/16 20:52:41 1.11 --- libshlex.tex 2001/05/09 15:52:56 1.11.4.1 *************** *** 3,7 **** \declaremodule{standard}{shlex} ! \modulesynopsis{Simple lexical analysis for \UNIX{} shell-like languages.} \moduleauthor{Eric S. Raymond}{esr@snark.thyrsus.com} \sectionauthor{Eric S. Raymond}{esr@snark.thyrsus.com} --- 3,7 ---- \declaremodule{standard}{shlex} ! \modulesynopsis{Simple lexical analysis for \UNIX\ shell-like languages.} \moduleauthor{Eric S. Raymond}{esr@snark.thyrsus.com} \sectionauthor{Eric S. Raymond}{esr@snark.thyrsus.com} Index: libsyslog.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsyslog.tex,v retrieving revision 1.14 retrieving revision 1.14.12.1 diff -C2 -r1.14 -r1.14.12.1 *** libsyslog.tex 1999/03/02 17:03:41 1.14 --- libsyslog.tex 2001/05/09 15:52:56 1.14.12.1 *************** *** 4,8 **** \declaremodule{builtin}{syslog} \platform{Unix} ! \modulesynopsis{An interface to the \UNIX{} syslog library routines.} --- 4,8 ---- \declaremodule{builtin}{syslog} \platform{Unix} ! \modulesynopsis{An interface to the \UNIX\ syslog library routines.} Index: libtermios.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtermios.tex,v retrieving revision 1.19 retrieving revision 1.19.4.1 diff -C2 -r1.19 -r1.19.4.1 *** libtermios.tex 2001/02/27 22:01:15 1.19 --- libtermios.tex 2001/05/09 15:52:56 1.19.4.1 *************** *** 4,8 **** \declaremodule{builtin}{termios} \platform{Unix} ! \modulesynopsis{\POSIX{} style tty control.} \indexii{\POSIX{}}{I/O control} --- 4,8 ---- \declaremodule{builtin}{termios} \platform{Unix} ! \modulesynopsis{\POSIX\ style tty control.} \indexii{\POSIX{}}{I/O control} From fdrake@users.sourceforge.net Wed May 9 17:26:38 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 09:26:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.6.2.1,1.6.2.2 update-docs.sh,1.6.2.1,1.6.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv30707/tools Modified Files: Tag: release21-maint push-docs.sh update-docs.sh Log Message: Update the directory names to match changes at SourceForge. Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -r1.6.2.1 -r1.6.2.2 *** push-docs.sh 2001/04/22 06:19:29 1.6.2.1 --- push-docs.sh 2001/05/09 16:26:36 1.6.2.2 *************** *** 4,8 **** # update-docs.sh script unpacks them into their final destination. ! TARGET=python.sourceforge.net:/home/users/fdrake/tmp ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' --- 4,8 ---- # update-docs.sh script unpacks them into their final destination. ! TARGET=python.sourceforge.net:/home/users/f/fd/fdrake/tmp ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' Index: update-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/update-docs.sh,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -r1.6.2.1 -r1.6.2.2 *** update-docs.sh 2001/04/22 06:19:29 1.6.2.1 --- update-docs.sh 2001/05/09 16:26:36 1.6.2.2 *************** *** 17,21 **** TMPDIR="$$-docs" ! cd /home/groups/python/htdocs || exit $? mkdir $TMPDIR || exit $? cd $TMPDIR || exit $? --- 17,21 ---- TMPDIR="$$-docs" ! cd /home/groups/p/py/python/htdocs || exit $? mkdir $TMPDIR || exit $? cd $TMPDIR || exit $? From fdrake@users.sourceforge.net Wed May 9 17:33:36 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 09:33:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools push-docs.sh,1.7,1.8 update-docs.sh,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv32058/tools Modified Files: push-docs.sh update-docs.sh Log Message: Update the directory names to match changes at SourceForge. Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** push-docs.sh 2001/04/22 06:20:31 1.7 --- push-docs.sh 2001/05/09 16:33:34 1.8 *************** *** 4,8 **** # update-docs.sh script unpacks them into their final destination. ! TARGET=python.sourceforge.net:/home/users/fdrake/tmp ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' --- 4,8 ---- # update-docs.sh script unpacks them into their final destination. ! TARGET=python.sourceforge.net:/home/users/f/fd/fdrake/tmp ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' Index: update-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/update-docs.sh,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** update-docs.sh 2001/04/22 06:20:31 1.7 --- update-docs.sh 2001/05/09 16:33:34 1.8 *************** *** 17,21 **** TMPDIR="$$-docs" ! cd /home/groups/python/htdocs || exit $? mkdir $TMPDIR || exit $? cd $TMPDIR || exit $? --- 17,21 ---- TMPDIR="$$-docs" ! cd /home/groups/p/py/python/htdocs || exit $? mkdir $TMPDIR || exit $? cd $TMPDIR || exit $? From fdrake@users.sourceforge.net Wed May 9 17:43:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 09:43:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc TODO,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv1500 Modified Files: TODO Log Message: Remove items that have been done or are being tracked in the SourceForge bug tracker. Index: TODO =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/TODO,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** TODO 2000/09/07 21:11:45 1.33 --- TODO 2001/05/09 16:43:47 1.34 *************** *** 7,15 **** * Figure out HTMLHelp generation for the Windows world. - * Straighten out random/whrandom. Things are generally in the right - place, but need to respond to comments in email from Jan Kim - . - Python/C API ------------ --- 7,11 ---- *************** *** 46,56 **** library ref.? (cmp() function). [Jeremy Hylton] - * Augmented assignment. [Thomas Wouters] - Library Reference ----------------- - * urllib2 module reference. [Jeremy Hylton] - * Update the pickle documentation to describe all of the current behavior; only a subset is described. __reduce__, etc. Partial --- 42,48 ---- *************** *** 59,64 **** * Update the httplib documentation to match Greg Stein's HTTP/1.1 support and new classes. (Greg, this is yours!) - - * SSL support in the socket module is not documented. Tutorial --- 51,54 ---- From fdrake@users.sourceforge.net Wed May 9 17:51:52 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 09:51:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref5.tex,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv3153/ref Modified Files: ref5.tex Log Message: Fix the operator precedence table: exponentiation binds tighter than negation. This closes SF bug #421999. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -r1.44 -r1.45 *** ref5.tex 2001/04/20 16:50:40 1.44 --- ref5.tex 2001/05/09 16:51:49 1.45 *************** *** 941,948 **** {Multiplication, division, remainder} \hline - \lineii{\code{**}} {Exponentiation} - \hline \lineii{\code{+\var{x}}, \code{-\var{x}}} {Positive, negative} \lineii{\code{\~\var{x}}} {Bitwise not} \hline \lineii{\code{\var{x}.\var{attribute}}} {Attribute reference} --- 941,948 ---- {Multiplication, division, remainder} \hline \lineii{\code{+\var{x}}, \code{-\var{x}}} {Positive, negative} \lineii{\code{\~\var{x}}} {Bitwise not} + \hline + \lineii{\code{**}} {Exponentiation} \hline \lineii{\code{\var{x}.\var{attribute}}} {Attribute reference} From fdrake@users.sourceforge.net Wed May 9 17:53:21 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 09:53:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref5.tex,1.43,1.43.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv3384/ref Modified Files: Tag: release21-maint ref5.tex Log Message: Fix the operator precedence table: exponentiation binds tighter than negation. This closes SF bug #421999. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.43 retrieving revision 1.43.2.1 diff -C2 -r1.43 -r1.43.2.1 *** ref5.tex 2001/04/12 12:37:03 1.43 --- ref5.tex 2001/05/09 16:53:19 1.43.2.1 *************** *** 939,946 **** {Multiplication, division, remainder} \hline - \lineii{\code{**}} {Exponentiation} - \hline \lineii{\code{+\var{x}}, \code{-\var{x}}} {Positive, negative} \lineii{\code{\~\var{x}}} {Bitwise not} \hline \lineii{\code{\var{x}.\var{attribute}}} {Attribute reference} --- 939,946 ---- {Multiplication, division, remainder} \hline \lineii{\code{+\var{x}}, \code{-\var{x}}} {Positive, negative} \lineii{\code{\~\var{x}}} {Bitwise not} + \hline + \lineii{\code{**}} {Exponentiation} \hline \lineii{\code{\var{x}.\var{attribute}}} {Attribute reference} From fdrake@users.sourceforge.net Wed May 9 18:53:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 10:53:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.25,2.26 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv15383/Modules Modified Files: termios.c Log Message: Only import termio.h on OSF, and add a comment about why it is needed there. This header does not exist on all Unix flavors; FreeBSD in particular does not include it. This closes SF bug #422320. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -r2.25 -r2.26 *** termios.c 2001/05/07 17:55:35 2.25 --- termios.c 2001/05/09 17:53:06 2.26 *************** *** 6,10 **** --- 6,14 ---- #include + #ifdef __osf__ + /* On OSF, sys/ioctl.h requires that struct termio already be defined, + * so this needs to be included first on that platform. */ #include + #endif #include From fdrake@users.sourceforge.net Wed May 9 19:13:31 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 11:13:31 -0700 Subject: [Python-checkins] CVS: python/dist/src README,1.122,1.122.2.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv19293 Modified Files: Tag: release21-maint README Log Message: Update build notes for Mac OS X 10.0. This closes SF bug #416530. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.122 retrieving revision 1.122.2.1 diff -C2 -r1.122 -r1.122.2.1 *** README 2001/04/16 02:07:08 1.122 --- README 2001/05/09 18:13:29 1.122.2.1 *************** *** 387,400 **** future release. ! Mac OS X: You need to add the "-traditional-cpp" option to the ! compiler command line for the Mac OS X Public Beta. This is ! appearantly a bug in the default pre-processor, and is ! expected not to be a problem with future versions. Run ! configure with "OPT='-g -traditional-cpp' ./configure ! --with-suffix=.exe --with-dyld" to add this ! option. One of the regular expression tests fails due to the ! small stack size used by default (how to change this?), and ! the test_largefile test is only expected to work on a Unix UFS ! filesystem (how to check for this on Mac OS X?). Cygwin: Cygwin Python builds OOTB when configured as follows: --- 387,400 ---- future release. ! Mac OS X 10.0: Run configure with "OPT='-no-cpp-precomp' ./configure ! --with-suffix=.exe --with-dyld". This generates executable ! file: 'python.exe' (it cannot be named 'python' on an HFS or ! HFS+ disk as the file name clashes with directory 'Python'). ! The '-no-cpp-precomp' option prevents a large number of ! compilation warnings. One of the regular expression tests ! fails with a SEGV due to the small stack size used by default ! (how to change this?), and the test_largefile test is only ! expected to work on a Unix UFS filesystem (how to check for ! this on Mac OS X?). Cygwin: Cygwin Python builds OOTB when configured as follows: From fdrake@users.sourceforge.net Wed May 9 19:13:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 11:13:49 -0700 Subject: [Python-checkins] CVS: python/dist/src README,1.123,1.124 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv19357 Modified Files: README Log Message: Update build notes for Mac OS X 10.0. This closes SF bug #416530. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -r1.123 -r1.124 *** README 2001/04/18 04:37:57 1.123 --- README 2001/05/09 18:13:47 1.124 *************** *** 387,400 **** future release. ! Mac OS X: You need to add the "-traditional-cpp" option to the ! compiler command line for the Mac OS X Public Beta. This is ! appearantly a bug in the default pre-processor, and is ! expected not to be a problem with future versions. Run ! configure with "OPT='-g -traditional-cpp' ./configure ! --with-suffix=.exe --with-dyld" to add this ! option. One of the regular expression tests fails due to the ! small stack size used by default (how to change this?), and ! the test_largefile test is only expected to work on a Unix UFS ! filesystem (how to check for this on Mac OS X?). Cygwin: Cygwin Python builds OOTB when configured as follows: --- 387,400 ---- future release. ! Mac OS X 10.0: Run configure with "OPT='-no-cpp-precomp' ./configure ! --with-suffix=.exe --with-dyld". This generates executable ! file: 'python.exe' (it cannot be named 'python' on an HFS or ! HFS+ disk as the file name clashes with directory 'Python'). ! The '-no-cpp-precomp' option prevents a large number of ! compilation warnings. One of the regular expression tests ! fails with a SEGV due to the small stack size used by default ! (how to change this?), and the test_largefile test is only ! expected to work on a Unix UFS filesystem (how to check for ! this on Mac OS X?). Cygwin: Cygwin Python builds OOTB when configured as follows: From tim_one@users.sourceforge.net Wed May 9 19:48:28 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 11:48:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules mmapmodule.c,2.28,2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25475/python/dist/src/Modules Modified Files: mmapmodule.c Log Message: Minor fiddling related to SF patch 416251 2.1c1 mmapmodule: unused vrbl cleanup Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -r2.28 -r2.29 *** mmapmodule.c 2001/04/21 02:46:11 2.28 --- mmapmodule.c 2001/05/09 18:48:26 2.29 *************** *** 164,177 **** PyObject *args) { - char value; - char *where; CHECK_VALID(NULL); if (!PyArg_ParseTuple(args, ":read_byte")) return NULL; if (self->pos < self->size) { ! where = self->data + self->pos; ! value = (char) *(where); self->pos += 1; ! return Py_BuildValue("c", (char) *(where)); } else { PyErr_SetString (PyExc_ValueError, "read byte out of range"); --- 164,174 ---- PyObject *args) { CHECK_VALID(NULL); if (!PyArg_ParseTuple(args, ":read_byte")) return NULL; if (self->pos < self->size) { ! char value = self->data[self->pos]; self->pos += 1; ! return Py_BuildValue("c", value); } else { PyErr_SetString (PyExc_ValueError, "read byte out of range"); From tim_one@users.sourceforge.net Wed May 9 19:53:54 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 11:53:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.199,2.200 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv26843/python/dist/src/Python Modified Files: compile.c Log Message: SF patch #416249, from Mark Favas: 2.1c1 compile: unused vrbl cleanup Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.199 retrieving revision 2.200 diff -C2 -r2.199 -r2.200 *** compile.c 2001/05/08 04:12:34 2.199 --- compile.c 2001/05/09 18:53:51 2.200 *************** *** 3540,3544 **** node *ch = CHILD(n, i); node *fp; - char *name; if (TYPE(ch) == STAR || TYPE(ch) == DOUBLESTAR) break; --- 3540,3543 ---- *************** *** 3546,3550 **** fp = CHILD(ch, 0); if (TYPE(fp) != NAME) { - name = nbuf; sprintf(nbuf, ".%d", i); complex = 1; --- 3545,3548 ---- From fdrake@users.sourceforge.net Wed May 9 20:11:35 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 12:11:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.141,1.142 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30687/Modules Modified Files: socketmodule.c Log Message: Three uses of makesockaddr() used sockaddr buffers that had not be cleared; this could cause invalid paths to be returned for AF_UNIX sockets on some platforms (including FreeBSD 4.2-RELEASE), appearantly because there is no assurance that the address will be nul-terminated when filled in by the kernel. PySocketSock_recvfrom(): Use PyString_AS_STRING() to get the data pointer of a string we create ourselves; there is no need for the extra type check from PyString_AsString(). This closes SF bug #416573. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.141 retrieving revision 1.142 diff -C2 -r1.141 -r1.142 *** socketmodule.c 2001/04/16 00:21:33 1.141 --- socketmodule.c 2001/05/09 19:11:33 1.142 *************** *** 791,794 **** --- 791,795 ---- if (!getsockaddrlen(s, &addrlen)) return NULL; + memset(addrbuf, 0, addrlen); Py_BEGIN_ALLOW_THREADS newfd = accept(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); *************** *** 1213,1216 **** --- 1214,1218 ---- if (!getsockaddrlen(s, &addrlen)) return NULL; + memset(addrbuf, 0, addrlen); Py_BEGIN_ALLOW_THREADS res = getpeername(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); *************** *** 1361,1365 **** return NULL; Py_BEGIN_ALLOW_THREADS ! n = recvfrom(s->sock_fd, PyString_AsString(buf), len, flags, #ifndef MS_WINDOWS #if defined(PYOS_OS2) --- 1363,1368 ---- return NULL; Py_BEGIN_ALLOW_THREADS ! memset(addrbuf, 0, addrlen); ! n = recvfrom(s->sock_fd, PyString_AS_STRING(buf), len, flags, #ifndef MS_WINDOWS #if defined(PYOS_OS2) From fdrake@users.sourceforge.net Wed May 9 20:13:43 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 12:13:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.141,1.141.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31146/Modules Modified Files: Tag: release21-maint socketmodule.c Log Message: Three uses of makesockaddr() used sockaddr buffers that had not be cleared; this could cause invalid paths to be returned for AF_UNIX sockets on some platforms (including FreeBSD 4.2-RELEASE), appearantly because there is no assurance that the address will be nul-terminated when filled in by the kernel. This closes SF bug #416573. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.141 retrieving revision 1.141.2.1 diff -C2 -r1.141 -r1.141.2.1 *** socketmodule.c 2001/04/16 00:21:33 1.141 --- socketmodule.c 2001/05/09 19:13:40 1.141.2.1 *************** *** 791,794 **** --- 791,795 ---- if (!getsockaddrlen(s, &addrlen)) return NULL; + memset(addrbuf, 0, addrlen); Py_BEGIN_ALLOW_THREADS newfd = accept(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); *************** *** 1213,1216 **** --- 1214,1218 ---- if (!getsockaddrlen(s, &addrlen)) return NULL; + memset(addrbuf, 0, addrlen); Py_BEGIN_ALLOW_THREADS res = getpeername(s->sock_fd, (struct sockaddr *) addrbuf, &addrlen); *************** *** 1361,1364 **** --- 1363,1367 ---- return NULL; Py_BEGIN_ALLOW_THREADS + memset(addrbuf, 0, addrlen); n = recvfrom(s->sock_fd, PyString_AsString(buf), len, flags, #ifndef MS_WINDOWS From fdrake@users.sourceforge.net Wed May 9 20:57:40 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 12:57:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libzipfile.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv9140/Doc/lib Modified Files: libzipfile.tex Log Message: Itamar Shtull-Trauring : Updates zipfile.ZipFile docs to mention the fact that you can create a ZipFile instance from an arbitrary file-like object. This closes patch #418011. Index: libzipfile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libzipfile.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** libzipfile.tex 2000/10/11 18:56:00 1.8 --- libzipfile.tex 2001/05/09 19:57:37 1.9 *************** *** 78,88 **** \subsection{ZipFile Objects \label{zipfile-objects}} ! \begin{classdesc}{ZipFile}{filename\optional{, mode\optional{, compression}}} ! Open a ZIP file named \var{filename}. The \var{mode} parameter should be \code{'r'} to read an existing file, \code{'w'} to truncate and write a new file, or \code{'a'} to append to an ! existing file. For \var{mode} is \code{'a'} and \var{filename} refers to an existing ZIP file, then additional files are added to ! it. If \var{filename} does not refer to a ZIP file, then a new ZIP archive is appended to the file. This is meant for adding a ZIP archive to another file, such as \file{python.exe}. Using --- 78,89 ---- \subsection{ZipFile Objects \label{zipfile-objects}} ! \begin{classdesc}{ZipFile}{file\optional{, mode\optional{, compression}}} ! Open a ZIP file, where \var{file} can be either a path to a file ! (i.e. a string) or a file-like object. The \var{mode} parameter should be \code{'r'} to read an existing file, \code{'w'} to truncate and write a new file, or \code{'a'} to append to an ! existing file. For \var{mode} is \code{'a'} and \var{file} refers to an existing ZIP file, then additional files are added to ! it. If \var{file} does not refer to a ZIP file, then a new ZIP archive is appended to the file. This is meant for adding a ZIP archive to another file, such as \file{python.exe}. Using From fdrake@users.sourceforge.net Wed May 9 20:57:52 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 12:57:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libzipfile.tex,1.8,1.8.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv9217/Doc/lib Modified Files: Tag: release21-maint libzipfile.tex Log Message: Itamar Shtull-Trauring : Updates zipfile.ZipFile docs to mention the fact that you can create a ZipFile instance from an arbitrary file-like object. This closes patch #418011. Index: libzipfile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libzipfile.tex,v retrieving revision 1.8 retrieving revision 1.8.6.1 diff -C2 -r1.8 -r1.8.6.1 *** libzipfile.tex 2000/10/11 18:56:00 1.8 --- libzipfile.tex 2001/05/09 19:57:50 1.8.6.1 *************** *** 78,88 **** \subsection{ZipFile Objects \label{zipfile-objects}} ! \begin{classdesc}{ZipFile}{filename\optional{, mode\optional{, compression}}} ! Open a ZIP file named \var{filename}. The \var{mode} parameter should be \code{'r'} to read an existing file, \code{'w'} to truncate and write a new file, or \code{'a'} to append to an ! existing file. For \var{mode} is \code{'a'} and \var{filename} refers to an existing ZIP file, then additional files are added to ! it. If \var{filename} does not refer to a ZIP file, then a new ZIP archive is appended to the file. This is meant for adding a ZIP archive to another file, such as \file{python.exe}. Using --- 78,89 ---- \subsection{ZipFile Objects \label{zipfile-objects}} ! \begin{classdesc}{ZipFile}{file\optional{, mode\optional{, compression}}} ! Open a ZIP file, where \var{file} can be either a path to a file ! (i.e. a string) or a file-like object. The \var{mode} parameter should be \code{'r'} to read an existing file, \code{'w'} to truncate and write a new file, or \code{'a'} to append to an ! existing file. For \var{mode} is \code{'a'} and \var{file} refers to an existing ZIP file, then additional files are added to ! it. If \var{file} does not refer to a ZIP file, then a new ZIP archive is appended to the file. This is meant for adding a ZIP archive to another file, such as \file{python.exe}. Using From tim_one@users.sourceforge.net Wed May 9 21:06:03 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 13:06:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.112,2.113 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv11618/python/dist/src/Objects Modified Files: stringobject.c Log Message: SF patch #416247 2.1c1 stringobject: unused vrbl cleanup. Thanks to Mark Favas. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.112 retrieving revision 2.113 diff -C2 -r2.112 -r2.113 *** stringobject.c 2001/05/09 08:43:21 2.112 --- stringobject.c 2001/05/09 20:06:00 2.113 *************** *** 2787,2791 **** int width = -1; int prec = -1; - int size = 0; int c = '\0'; int fill; --- 2787,2790 ---- *************** *** 2925,2929 **** if (fmtcnt >= 0) { if (c == 'h' || c == 'l' || c == 'L') { - size = c; if (--fmtcnt >= 0) c = *fmt++; --- 2924,2927 ---- From fdrake@users.sourceforge.net Wed May 9 21:14:11 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 13:14:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv13546/Modules Modified Files: termios.c Log Message: fdconv(): Do not second guess the error condition returned by PyObject_AsFileDescriptor() -- it does the same thing everywhere, so use it the same way everyone else does so that exceptions are consistent. This means we have less code here, and we do not need to resort to hackish ways of getting the Python-visible function name to fdconv(). Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -r2.26 -r2.27 *** termios.c 2001/05/09 17:53:06 2.26 --- termios.c 2001/05/09 20:14:09 2.27 *************** *** 29,34 **** static PyObject *TermiosError; - static char* fname; - static int fdconv(PyObject* obj, void* p) { --- 29,32 ---- *************** *** 36,63 **** fd = PyObject_AsFileDescriptor(obj); ! if (fd == -1) { ! if (PyInt_Check(obj)) { ! fd = PyInt_AS_LONG(obj); ! } ! else { ! char* tname; ! ! if (PyInstance_Check(obj)) { ! tname = PyString_AS_STRING( ! ((PyInstanceObject*)obj)->in_class->cl_name); ! } ! else { ! tname = obj->ob_type->tp_name; ! } ! ! PyErr_Format(PyExc_TypeError, ! "%s, arg 1: can't extract file descriptor from \"%.500s\"", ! fname, tname); ! return 0; ! } } ! ! *(int*)p = fd; ! return 1; } --- 34,42 ---- fd = PyObject_AsFileDescriptor(obj); ! if (fd >= 0) { ! *(int*)p = fd; ! return 1; } ! return 0; } *************** *** 84,89 **** char ch; - fname = "tcgetattr"; - if (!PyArg_ParseTuple(args, "O&:tcgetattr", fdconv, (void*)&fd)) --- 63,66 ---- *************** *** 161,166 **** int i; - fname = "tcsetattr"; - if (!PyArg_ParseTuple(args, "O&iO:tcsetattr", fdconv, &fd, &when, &term)) --- 138,141 ---- *************** *** 229,234 **** int fd, duration; - fname = "tcsendbreak"; - if (!PyArg_ParseTuple(args, "O&i:tcsendbreak", fdconv, &fd, &duration)) --- 204,207 ---- *************** *** 251,256 **** int fd; - fname = "tcdrain"; - if (!PyArg_ParseTuple(args, "O&:tcdrain", fdconv, &fd)) --- 224,227 ---- *************** *** 276,281 **** int fd, queue; - fname = "tcflush"; - if (!PyArg_ParseTuple(args, "O&i:tcflush", fdconv, &fd, &queue)) --- 247,250 ---- *************** *** 300,305 **** { int fd, action; - - fname = "tcflow"; if (!PyArg_ParseTuple(args, "O&i:tcflow", --- 269,272 ---- From fdrake@users.sourceforge.net Wed May 9 22:02:04 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:02:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules fcntlmodule.c,2.28,2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv23294/Modules Modified Files: fcntlmodule.c Log Message: Modify to allow file objects wherever file descriptors are needed. This closes SF bug #231328. Added all constants needed to use the functions defined in this module that are not defined elsewhere (the O_* symbols are available in the os module). No additonal modules are needed to use this now. Index: fcntlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fcntlmodule.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -r2.28 -r2.29 *** fcntlmodule.c 2001/01/25 10:10:39 2.28 --- fcntlmodule.c 2001/05/09 21:02:02 2.29 *************** *** 16,19 **** --- 16,31 ---- + static int + conv_descriptor(PyObject *object, int *target) + { + int fd = PyObject_AsFileDescriptor(object); + + if (fd < 0) + return 0; + *target = fd; + return 1; + } + + /* fcntl(fd, opt, [arg]) */ *************** *** 29,33 **** char buf[1024]; ! if (PyArg_ParseTuple(args, "iis#:fcntl", &fd, &code, &str, &len)) { if (len > sizeof buf) { PyErr_SetString(PyExc_ValueError, --- 41,46 ---- char buf[1024]; ! if (PyArg_ParseTuple(args, "O&is#:fcntl", ! conv_descriptor, &fd, &code, &str, &len)) { if (len > sizeof buf) { PyErr_SetString(PyExc_ValueError, *************** *** 48,53 **** PyErr_Clear(); arg = 0; ! if (!PyArg_ParseTuple(args, "ii|i;fcntl requires 2 integers and optionally a third integer or a string", ! &fd, &code, &arg)) { return NULL; } --- 61,68 ---- PyErr_Clear(); arg = 0; ! if (!PyArg_ParseTuple(args, ! "O&i|i;fcntl requires a file or file descriptor," ! " an integer and optionally a third integer or a string", ! conv_descriptor, &fd, &code, &arg)) { return NULL; } *************** *** 90,94 **** char buf[1024]; ! if (PyArg_ParseTuple(args, "iis#:ioctl", &fd, &code, &str, &len)) { if (len > sizeof buf) { PyErr_SetString(PyExc_ValueError, --- 105,110 ---- char buf[1024]; ! if (PyArg_ParseTuple(args, "O&is#:ioctl", ! conv_descriptor, &fd, &code, &str, &len)) { if (len > sizeof buf) { PyErr_SetString(PyExc_ValueError, *************** *** 109,114 **** PyErr_Clear(); arg = 0; ! if (!PyArg_ParseTuple(args, "ii|i;ioctl requires 2 integers and optionally a third integer or a string", ! &fd, &code, &arg)) { return NULL; } --- 125,130 ---- PyErr_Clear(); arg = 0; ! if (!PyArg_ParseTuple(args, "O&i|i;ioctl requires 2 integers and optionally a third integer or a string", ! conv_descriptor, &fd, &code, &arg)) { return NULL; } *************** *** 146,150 **** int ret; ! if (!PyArg_ParseTuple(args, "ii:flock", &fd, &code)) return NULL; --- 162,167 ---- int ret; ! if (!PyArg_ParseTuple(args, "O&i:flock", ! conv_descriptor, &fd, &code)) return NULL; *************** *** 203,207 **** PyObject *lenobj = NULL, *startobj = NULL; ! if (!PyArg_ParseTuple(args, "ii|OOi:lockf", &fd, &code, &lenobj, &startobj, &whence)) return NULL; --- 220,225 ---- PyObject *lenobj = NULL, *startobj = NULL; ! if (!PyArg_ParseTuple(args, "O&i|OOi:lockf", ! conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) return NULL; *************** *** 325,328 **** --- 343,391 ---- if (ins(d, "LOCK_NB", (long)LOCK_NB)) return -1; if (ins(d, "LOCK_UN", (long)LOCK_UN)) return -1; + #ifdef F_DUPFD + if (ins(d, "F_DUPFD", (long)F_DUPFD)) return -1; + #endif + #ifdef F_GETFD + if (ins(d, "F_GETFD", (long)F_GETFD)) return -1; + #endif + #ifdef F_SETFD + if (ins(d, "F_SETFD", (long)F_SETFD)) return -1; + #endif + #ifdef F_GETFL + if (ins(d, "F_GETFL", (long)F_GETFL)) return -1; + #endif + #ifdef F_SETFL + if (ins(d, "F_SETFL", (long)F_SETFL)) return -1; + #endif + #ifdef F_GETLK + if (ins(d, "F_GETLK", (long)F_GETLK)) return -1; + #endif + #ifdef F_SETLK + if (ins(d, "F_SETLK", (long)F_SETLK)) return -1; + #endif + #ifdef F_SETLKW + if (ins(d, "F_SETLKW", (long)F_SETLKW)) return -1; + #endif + #ifdef F_GETOWN + if (ins(d, "F_GETOWN", (long)F_GETOWN)) return -1; + #endif + #ifdef F_SETOWN + if (ins(d, "F_SETOWN", (long)F_SETOWN)) return -1; + #endif + #ifdef F_GETSIG + if (ins(d, "F_GETSIG", (long)F_GETSIG)) return -1; + #endif + #ifdef F_SETSIG + if (ins(d, "F_SETSIG", (long)F_SETSIG)) return -1; + #endif + #ifdef F_RDLCK + if (ins(d, "F_RDLCK", (long)F_RDLCK)) return -1; + #endif + #ifdef F_WRLCK + if (ins(d, "F_WRLCK", (long)F_WRLCK)) return -1; + #endif + #ifdef F_UNLCK + if (ins(d, "F_UNLCK", (long)F_UNLCK)) return -1; + #endif return 0; } From fdrake@users.sourceforge.net Wed May 9 22:09:59 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:09:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libfcntl.tex,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv24908/Doc/lib Modified Files: libfcntl.tex Log Message: Update the fcntl module documentation. Index: libfcntl.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfcntl.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** libfcntl.tex 2001/04/11 21:33:47 1.25 --- libfcntl.tex 2001/05/09 21:09:57 1.26 *************** *** 12,18 **** This module performs file control and I/O control on file descriptors. It is an interface to the \cfunction{fcntl()} and \cfunction{ioctl()} ! \UNIX{} routines. File descriptors can be obtained with the ! \method{fileno()} method of a file or socket object. The module defines the following functions: --- 12,22 ---- This module performs file control and I/O control on file descriptors. It is an interface to the \cfunction{fcntl()} and \cfunction{ioctl()} ! \UNIX{} routines. + All functions in this module take a file descriptor \var{fd} as their + first argument. This can be an integer file descriptor, such as + returned by \code{sys.stdin.fileno()}, or a file object, such as + \code{sys.stdin} itself. + The module defines the following functions: *************** *** 21,40 **** Perform the requested operation on file descriptor \var{fd}. The operation is defined by \var{op} and is operating system ! dependent. Typically these codes can be retrieved from the library ! module \module{FCNTL}\refstmodindex{FCNTL}. The argument \var{arg} ! is optional, and defaults to the integer value \code{0}. When ! present, it can either be an integer value, or a string. With ! the argument missing or an integer value, the return value of this ! function is the integer return value of the C \cfunction{fcntl()} ! call. When the argument is a string it represents a binary ! structure, e.g.\ created by \function{struct.pack()}. The binary ! data is copied to a buffer whose address is passed to the C ! \cfunction{fcntl()} call. The return value after a successful call ! is the contents of the buffer, converted to a string object. The length ! of the returned string will be the same as the length of the \var{arg} ! argument. This is limited to 1024 bytes. If the information returned ! in the buffer by the operating system is larger than 1024 bytes, ! this is most likely to result in a segmentation violation or a more ! subtle data corruption. If the \cfunction{fcntl()} fails, an \exception{IOError} is --- 25,44 ---- Perform the requested operation on file descriptor \var{fd}. The operation is defined by \var{op} and is operating system ! dependent. These codes are also found in the \module{fcntl} ! module. The argument \var{arg} is optional, and defaults to the ! integer value \code{0}. When present, it can either be an integer ! value, or a string. With the argument missing or an integer value, ! the return value of this function is the integer return value of the ! C \cfunction{fcntl()} call. When the argument is a string it ! represents a binary structure, e.g.\ created by ! \function{struct.pack()}. The binary data is copied to a buffer ! whose address is passed to the C \cfunction{fcntl()} call. The ! return value after a successful call is the contents of the buffer, ! converted to a string object. The length of the returned string ! will be the same as the length of the \var{arg} argument. This is ! limited to 1024 bytes. If the information returned in the buffer by ! the operating system is larger than 1024 bytes, this is most likely ! to result in a segmentation violation or a more subtle data ! corruption. If the \cfunction{fcntl()} fails, an \exception{IOError} is *************** *** 91,114 **** to lock to the end of the file. The default for \var{whence} is also 0. - \end{funcdesc} - If the library modules \module{FCNTL}\refstmodindex{FCNTL} or - \module{IOCTL}\refstmodindex{IOCTL} are missing, you can find the - opcodes in the C include files \code{} and - \code{}. You can create the modules yourself with the - \program{h2py} script, found in the \file{Tools/scripts/} directory. - - Examples (all on a SVR4 compliant system): \begin{verbatim} ! import struct, fcntl, FCNTL file = open(...) ! rv = fcntl(file.fileno(), FCNTL.F_SETFL, FCNTL.O_NDELAY) ! lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0) ! rv = fcntl.fcntl(file.fileno(), FCNTL.F_SETLKW, lockdata) \end{verbatim} --- 95,110 ---- to lock to the end of the file. The default for \var{whence} is also 0. \end{funcdesc} Examples (all on a SVR4 compliant system): \begin{verbatim} ! import struct, fcntl file = open(...) ! rv = fcntl(file, fcntl.F_SETFL, os.O_NDELAY) ! lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0) ! rv = fcntl.fcntl(file, fcntl.F_SETLKW, lockdata) \end{verbatim} From fdrake@users.sourceforge.net Wed May 9 22:12:01 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:12:01 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_fcntl.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25491/test Modified Files: test_fcntl.py Log Message: Update the tests for the fcntl module to check passing in file objects, and using the constants defined there instead of FCNTL. Index: test_fcntl.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fcntl.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** test_fcntl.py 2001/04/11 20:58:20 1.17 --- test_fcntl.py 2001/05/09 21:11:59 1.18 *************** *** 5,9 **** import struct import fcntl - import FCNTL import os, sys from test_support import verbose, TESTFN --- 5,8 ---- *************** *** 11,35 **** filename = TESTFN - # the example from the library docs - f = open(filename, 'w') - rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, os.O_NONBLOCK) - if verbose: - print 'Status from fnctl with O_NONBLOCK: ', rv - if sys.platform in ('netbsd1', 'Darwin1.2', 'darwin1', 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5', 'bsdos2', 'bsdos3', 'bsdos4', 'openbsd', 'openbsd2'): ! lockdata = struct.pack('lxxxxlxxxxlhh', 0, 0, 0, FCNTL.F_WRLCK, 0) elif sys.platform in ['aix3', 'aix4', 'hp-uxB', 'unixware7']: ! lockdata = struct.pack('hhlllii', FCNTL.F_WRLCK, 0, 0, 0, 0, 0, 0) else: ! lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0) if verbose: print 'struct.pack: ', `lockdata` ! rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETLKW, lockdata) if verbose: print 'String from fcntl with F_SETLKW: ', `rv` f.close() --- 10,45 ---- filename = TESTFN if sys.platform in ('netbsd1', 'Darwin1.2', 'darwin1', 'freebsd2', 'freebsd3', 'freebsd4', 'freebsd5', 'bsdos2', 'bsdos3', 'bsdos4', 'openbsd', 'openbsd2'): ! lockdata = struct.pack('lxxxxlxxxxlhh', 0, 0, 0, fcntl.F_WRLCK, 0) elif sys.platform in ['aix3', 'aix4', 'hp-uxB', 'unixware7']: ! lockdata = struct.pack('hhlllii', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0) else: ! lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0) if verbose: print 'struct.pack: ', `lockdata` + + + # the example from the library docs + f = open(filename, 'w') + rv = fcntl.fcntl(f.fileno(), fcntl.F_SETFL, os.O_NONBLOCK) + if verbose: + print 'Status from fnctl with O_NONBLOCK: ', rv ! rv = fcntl.fcntl(f.fileno(), fcntl.F_SETLKW, lockdata) if verbose: print 'String from fcntl with F_SETLKW: ', `rv` + + f.close() + os.unlink(filename) + + + # Again, but pass the file rather than numeric descriptor: + f = open(filename, 'w') + rv = fcntl.fcntl(f, fcntl.F_SETFL, os.O_NONBLOCK) + + rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata) f.close() From fdrake@users.sourceforge.net Wed May 9 22:13:25 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:13:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib FCNTL.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25827 Added Files: FCNTL.py Log Message: Add a new FCNTL.py backward compatibility module that issues a deprecation warning. This is similar to the TERMIOS backward compatbility module. --- NEW FILE: FCNTL.py --- """Backward-compatibility version of FCNTL; export constants exported by fcntl, and issue a deprecation warning. """ import warnings warnings.warn("the FCNTL module is deprecated; please use fcntl", DeprecationWarning) # Export the constants known to the fcntl module: from fcntl import * # and *only* the constants: __all__ = [s for s in dir() if s[0] in "ABCDEFGHIJKLMNOPQRSTUVWXYZ"] From fdrake@users.sourceforge.net Wed May 9 22:15:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-aix3 FCNTL.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-aix3 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-aix3 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:06 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-aix4 FCNTL.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-aix4 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-aix4 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:06 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-beos5 FCNTL.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-beos5 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-beos5 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-freebsd3 FCNTL.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-freebsd3 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-freebsd3 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:06 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-freebsd2 FCNTL.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-freebsd2 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-freebsd2 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-freebsd4 FCNTL.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-freebsd4 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-freebsd4 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-freebsd5 FCNTL.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-freebsd5 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-freebsd5 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-linux2 FCNTL.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-linux2 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-linux2 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-irix5 FCNTL.py,1.3,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-irix5 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-irix5 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-sunos4 FCNTL.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-sunos4 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-sunos4 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-linux1 FCNTL.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-linux1 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-linux1 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-irix6 FCNTL.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-irix6 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-irix6 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-unixware7 FCNTL.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-unixware7 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-unixware7 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-netbsd1 FCNTL.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-netbsd1 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-netbsd1 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From fdrake@users.sourceforge.net Wed May 9 22:15:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 14:15:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-sunos5 FCNTL.py,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-sunos5 In directory usw-pr-cvs1:/tmp/cvs-serv26093/plat-sunos5 Removed Files: FCNTL.py Log Message: Remove the old platform-specific FCNTL.py modules; these are no longer needed now that fcntl exports the constants. --- FCNTL.py DELETED --- From tim_one@users.sourceforge.net Wed May 9 23:15:05 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 15:15:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules stropmodule.c,2.75,2.76 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv7124/python/dist/src/Modules Modified Files: stropmodule.c Log Message: Mechanical changes for easier edits. Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.75 retrieving revision 2.76 diff -C2 -r2.75 -r2.76 *** stropmodule.c 2000/09/26 05:46:01 2.75 --- stropmodule.c 2001/05/09 22:15:03 2.76 *************** *** 1,10 **** - /* strop module */ static char strop_module__doc__[] = ! "Common string manipulations, optimized for speed.\n\ ! \n\ ! Always use \"import string\" rather than referencing\n\ ! this module directly."; #include "Python.h" --- 1,9 ---- /* strop module */ static char strop_module__doc__[] = ! "Common string manipulations, optimized for speed.\n" ! "\n" ! "Always use \"import string\" rather than referencing\n" ! "this module directly."; #include "Python.h" *************** *** 79,91 **** static char splitfields__doc__[] = ! "split(s [,sep [,maxsplit]]) -> list of strings\n\ ! splitfields(s [,sep [,maxsplit]]) -> list of strings\n\ ! \n\ ! Return a list of the words in the string s, using sep as the\n\ ! delimiter string. If maxsplit is nonzero, splits into at most\n\ ! maxsplit words. If sep is not specified, any whitespace string\n\ ! is a separator. Maxsplit defaults to 0.\n\ ! \n\ ! (split and splitfields are synonymous)"; static PyObject * --- 78,90 ---- static char splitfields__doc__[] = ! "split(s [,sep [,maxsplit]]) -> list of strings\n" ! "splitfields(s [,sep [,maxsplit]]) -> list of strings\n" ! "\n" ! "Return a list of the words in the string s, using sep as the\n" ! "delimiter string. If maxsplit is nonzero, splits into at most\n" ! "maxsplit words. If sep is not specified, any whitespace string\n" ! "is a separator. Maxsplit defaults to 0.\n" ! "\n" ! "(split and splitfields are synonymous)"; static PyObject * *************** *** 149,160 **** static char joinfields__doc__[] = ! "join(list [,sep]) -> string\n\ ! joinfields(list [,sep]) -> string\n\ ! \n\ ! Return a string composed of the words in list, with\n\ ! intervening occurrences of sep. Sep defaults to a single\n\ ! space.\n\ ! \n\ ! (join and joinfields are synonymous)"; static PyObject * --- 148,159 ---- static char joinfields__doc__[] = ! "join(list [,sep]) -> string\n" ! "joinfields(list [,sep]) -> string\n" ! "\n" ! "Return a string composed of the words in list, with\n" ! "intervening occurrences of sep. Sep defaults to a single\n" ! "space.\n" ! "\n" ! "(join and joinfields are synonymous)"; static PyObject * *************** *** 280,290 **** static char find__doc__[] = ! "find(s, sub [,start [,end]]) -> in\n\ ! \n\ ! Return the lowest index in s where substring sub is found,\n\ ! such that sub is contained within s[start,end]. Optional\n\ ! arguments start and end are interpreted as in slice notation.\n\ ! \n\ ! Return -1 on failure."; static PyObject * --- 279,289 ---- static char find__doc__[] = ! "find(s, sub [,start [,end]]) -> in\n" ! "\n" ! "Return the lowest index in s where substring sub is found,\n" ! "such that sub is contained within s[start,end]. Optional\n" ! "arguments start and end are interpreted as in slice notation.\n" ! "\n" ! "Return -1 on failure."; static PyObject * *************** *** 322,332 **** static char rfind__doc__[] = ! "rfind(s, sub [,start [,end]]) -> int\n\ ! \n\ ! Return the highest index in s where substring sub is found,\n\ ! such that sub is contained within s[start,end]. Optional\n\ ! arguments start and end are interpreted as in slice notation.\n\ ! \n\ ! Return -1 on failure."; static PyObject * --- 321,331 ---- static char rfind__doc__[] = ! "rfind(s, sub [,start [,end]]) -> int\n" ! "\n" ! "Return the highest index in s where substring sub is found,\n" ! "such that sub is contained within s[start,end]. Optional\n" ! "arguments start and end are interpreted as in slice notation.\n" ! "\n" ! "Return -1 on failure."; static PyObject * *************** *** 398,405 **** static char strip__doc__[] = ! "strip(s) -> string\n\ ! \n\ ! Return a copy of the string s with leading and trailing\n\ ! whitespace removed."; static PyObject * --- 397,404 ---- static char strip__doc__[] = ! "strip(s) -> string\n" ! "\n" ! "Return a copy of the string s with leading and trailing\n" ! "whitespace removed."; static PyObject * *************** *** 411,417 **** static char lstrip__doc__[] = ! "lstrip(s) -> string\n\ ! \n\ ! Return a copy of the string s with leading whitespace removed."; static PyObject * --- 410,416 ---- static char lstrip__doc__[] = ! "lstrip(s) -> string\n" ! "\n" ! "Return a copy of the string s with leading whitespace removed."; static PyObject * *************** *** 423,429 **** static char rstrip__doc__[] = ! "rstrip(s) -> string\n\ ! \n\ ! Return a copy of the string s with trailing whitespace removed."; static PyObject * --- 422,428 ---- static char rstrip__doc__[] = ! "rstrip(s) -> string\n" ! "\n" ! "Return a copy of the string s with trailing whitespace removed."; static PyObject * *************** *** 435,441 **** static char lower__doc__[] = ! "lower(s) -> string\n\ ! \n\ ! Return a copy of the string s converted to lowercase."; static PyObject * --- 434,440 ---- static char lower__doc__[] = ! "lower(s) -> string\n" ! "\n" ! "Return a copy of the string s converted to lowercase."; static PyObject * *************** *** 473,479 **** static char upper__doc__[] = ! "upper(s) -> string\n\ ! \n\ ! Return a copy of the string s converted to uppercase."; static PyObject * --- 472,478 ---- static char upper__doc__[] = ! "upper(s) -> string\n" ! "\n" ! "Return a copy of the string s converted to uppercase."; static PyObject * *************** *** 511,518 **** static char capitalize__doc__[] = ! "capitalize(s) -> string\n\ ! \n\ ! Return a copy of the string s with only its first character\n\ ! capitalized."; static PyObject * --- 510,517 ---- static char capitalize__doc__[] = ! "capitalize(s) -> string\n" ! "\n" ! "Return a copy of the string s with only its first character\n" ! "capitalized."; static PyObject * *************** *** 559,568 **** static char expandtabs__doc__[] = ! "expandtabs(string, [tabsize]) -> string\n\ ! \n\ ! Expand tabs in a string, i.e. replace them by one or more spaces,\n\ ! depending on the current column and the given tab size (default 8).\n\ ! The column number is reset to zero after each newline occurring in the\n\ ! string. This doesn't understand other non-printing characters."; static PyObject * --- 558,567 ---- static char expandtabs__doc__[] = ! "expandtabs(string, [tabsize]) -> string\n" ! "\n" ! "Expand tabs in a string, i.e. replace them by one or more spaces,\n" ! "depending on the current column and the given tab size (default 8).\n" ! "The column number is reset to zero after each newline occurring in the\n" ! "string. This doesn't understand other non-printing characters."; static PyObject * *************** *** 630,638 **** static char count__doc__[] = ! "count(s, sub[, start[, end]]) -> int\n\ ! \n\ ! Return the number of occurrences of substring sub in string\n\ ! s[start:end]. Optional arguments start and end are\n\ ! interpreted as in slice notation."; static PyObject * --- 629,637 ---- static char count__doc__[] = ! "count(s, sub[, start[, end]]) -> int\n" ! "\n" ! "Return the number of occurrences of substring sub in string\n" ! "s[start:end]. Optional arguments start and end are\n" ! "interpreted as in slice notation."; static PyObject * *************** *** 674,681 **** static char swapcase__doc__[] = ! "swapcase(s) -> string\n\ ! \n\ ! Return a copy of the string s with upper case characters\n\ ! converted to lowercase and vice versa."; static PyObject * --- 673,680 ---- static char swapcase__doc__[] = ! "swapcase(s) -> string\n" ! "\n" ! "Return a copy of the string s with upper case characters\n" ! "converted to lowercase and vice versa."; static PyObject * *************** *** 718,729 **** static char atoi__doc__[] = ! "atoi(s [,base]) -> int\n\ ! \n\ ! Return the integer represented by the string s in the given\n\ ! base, which defaults to 10. The string s must consist of one\n\ ! or more digits, possibly preceded by a sign. If base is 0, it\n\ ! is chosen from the leading characters of s, 0 for octal, 0x or\n\ ! 0X for hexadecimal. If base is 16, a preceding 0x or 0X is\n\ ! accepted."; static PyObject * --- 717,728 ---- static char atoi__doc__[] = ! "atoi(s [,base]) -> int\n" ! "\n" ! "Return the integer represented by the string s in the given\n" ! "base, which defaults to 10. The string s must consist of one\n" ! "or more digits, possibly preceded by a sign. If base is 0, it\n" ! "is chosen from the leading characters of s, 0 for octal, 0x or\n" ! "0X for hexadecimal. If base is 16, a preceding 0x or 0X is\n" ! "accepted."; static PyObject * *************** *** 770,782 **** static char atol__doc__[] = ! "atol(s [,base]) -> long\n\ ! \n\ ! Return the long integer represented by the string s in the\n\ ! given base, which defaults to 10. The string s must consist\n\ ! of one or more digits, possibly preceded by a sign. If base\n\ ! is 0, it is chosen from the leading characters of s, 0 for\n\ ! octal, 0x or 0X for hexadecimal. If base is 16, a preceding\n\ ! 0x or 0X is accepted. A trailing L or l is not accepted,\n\ ! unless base is 0."; static PyObject * --- 769,781 ---- static char atol__doc__[] = ! "atol(s [,base]) -> long\n" ! "\n" ! "Return the long integer represented by the string s in the\n" ! "given base, which defaults to 10. The string s must consist\n" ! "of one or more digits, possibly preceded by a sign. If base\n" ! "is 0, it is chosen from the leading characters of s, 0 for\n" ! "octal, 0x or 0X for hexadecimal. If base is 16, a preceding\n" ! "0x or 0X is accepted. A trailing L or l is not accepted,\n" ! "unless base is 0."; static PyObject * *************** *** 820,826 **** static char atof__doc__[] = ! "atof(s) -> float\n\ ! \n\ ! Return the floating point number represented by the string s."; static PyObject * --- 819,825 ---- static char atof__doc__[] = ! "atof(s) -> float\n" ! "\n" ! "Return the floating point number represented by the string s."; static PyObject * *************** *** 861,869 **** static char maketrans__doc__[] = ! "maketrans(frm, to) -> string\n\ ! \n\ ! Return a translation table (a string of 256 bytes long)\n\ ! suitable for use in string.translate. The strings frm and to\n\ ! must be of the same length."; static PyObject * --- 860,868 ---- static char maketrans__doc__[] = ! "maketrans(frm, to) -> string\n" ! "\n" ! "Return a translation table (a string of 256 bytes long)\n" ! "suitable for use in string.translate. The strings frm and to\n" ! "must be of the same length."; static PyObject * *************** *** 897,906 **** static char translate__doc__[] = ! "translate(s,table [,deletechars]) -> string\n\ ! \n\ ! Return a copy of the string s, where all characters occurring\n\ ! in the optional argument deletechars are removed, and the\n\ ! remaining characters have been mapped through the given\n\ ! translation table, which must be a string of length 256."; static PyObject * --- 896,905 ---- static char translate__doc__[] = ! "translate(s,table [,deletechars]) -> string\n" ! "\n" ! "Return a copy of the string s, where all characters occurring\n" ! "in the optional argument deletechars are removed, and the\n" ! "remaining characters have been mapped through the given\n" ! "translation table, which must be a string of length 256."; static PyObject * *************** *** 983,987 **** MEM, the function returns -1. */ ! static int mymemfind(char *mem, int len, char *pat, int pat_len) { register int ii; --- 982,987 ---- MEM, the function returns -1. */ ! static int ! mymemfind(char *mem, int len, char *pat, int pat_len) { register int ii; *************** *** 1007,1011 **** mem=11111 and pat==11 also return 2. */ ! static int mymemcnt(char *mem, int len, char *pat, int pat_len) { register int offset = 0; --- 1007,1012 ---- mem=11111 and pat==11 also return 2. */ ! static int ! mymemcnt(char *mem, int len, char *pat, int pat_len) { register int offset = 0; *************** *** 1042,1046 **** NULL if an error occurred. */ ! static char *mymemreplace(char *str, int len, char *pat, int pat_len, char *sub, int sub_len, int count, int *out_len) { char *out_s; --- 1043,1051 ---- NULL if an error occurred. */ ! static char * ! mymemreplace(char *str, int len, ! char *pat, int pat_len, ! char *sub, int sub_len, ! int count, int *out_len) { char *out_s; *************** *** 1096,1104 **** static char replace__doc__[] = ! "replace (str, old, new[, maxsplit]) -> string\n\ ! \n\ ! Return a copy of string str with all occurrences of substring\n\ ! old replaced by new. If the optional argument maxsplit is\n\ ! given, only the first maxsplit occurrences are replaced."; static PyObject * --- 1101,1109 ---- static char replace__doc__[] = ! "replace (str, old, new[, maxsplit]) -> string\n" ! "\n" ! "Return a copy of string str with all occurrences of substring\n" ! "old replaced by new. If the optional argument maxsplit is\n" ! "given, only the first maxsplit occurrences are replaced."; static PyObject * *************** *** 1140,1185 **** static PyMethodDef strop_methods[] = { ! {"atof", strop_atof, ! METH_VARARGS, atof__doc__}, ! {"atoi", strop_atoi, ! METH_VARARGS, atoi__doc__}, ! {"atol", strop_atol, ! METH_VARARGS, atol__doc__}, ! {"capitalize", strop_capitalize, ! METH_OLDARGS, capitalize__doc__}, ! {"count", strop_count, ! METH_VARARGS, count__doc__}, ! {"expandtabs", strop_expandtabs, ! METH_VARARGS, expandtabs__doc__}, ! {"find", strop_find, ! METH_VARARGS, find__doc__}, ! {"join", strop_joinfields, ! METH_VARARGS, joinfields__doc__}, ! {"joinfields", strop_joinfields, ! METH_VARARGS, joinfields__doc__}, ! {"lstrip", strop_lstrip, ! METH_OLDARGS, lstrip__doc__}, ! {"lower", strop_lower, ! METH_OLDARGS, lower__doc__}, ! {"maketrans", strop_maketrans, ! METH_VARARGS, maketrans__doc__}, ! {"replace", strop_replace, ! METH_VARARGS, replace__doc__}, ! {"rfind", strop_rfind, ! METH_VARARGS, rfind__doc__}, ! {"rstrip", strop_rstrip, ! METH_OLDARGS, rstrip__doc__}, ! {"split", strop_splitfields, ! METH_VARARGS, splitfields__doc__}, ! {"splitfields", strop_splitfields, ! METH_VARARGS, splitfields__doc__}, ! {"strip", strop_strip, ! METH_OLDARGS, strip__doc__}, ! {"swapcase", strop_swapcase, ! METH_OLDARGS, swapcase__doc__}, ! {"translate", strop_translate, ! METH_VARARGS, translate__doc__}, ! {"upper", strop_upper, ! METH_OLDARGS, upper__doc__}, {NULL, NULL} /* sentinel */ }; --- 1145,1169 ---- static PyMethodDef strop_methods[] = { ! {"atof", strop_atof, METH_VARARGS, atof__doc__}, ! {"atoi", strop_atoi, METH_VARARGS, atoi__doc__}, ! {"atol", strop_atol, METH_VARARGS, atol__doc__}, ! {"capitalize", strop_capitalize, METH_OLDARGS, capitalize__doc__}, ! {"count", strop_count, METH_VARARGS, count__doc__}, ! {"expandtabs", strop_expandtabs, METH_VARARGS, expandtabs__doc__}, ! {"find", strop_find, METH_VARARGS, find__doc__}, ! {"join", strop_joinfields, METH_VARARGS, joinfields__doc__}, ! {"joinfields", strop_joinfields, METH_VARARGS, joinfields__doc__}, ! {"lstrip", strop_lstrip, METH_OLDARGS, lstrip__doc__}, ! {"lower", strop_lower, METH_OLDARGS, lower__doc__}, ! {"maketrans", strop_maketrans, METH_VARARGS, maketrans__doc__}, ! {"replace", strop_replace, METH_VARARGS, replace__doc__}, ! {"rfind", strop_rfind, METH_VARARGS, rfind__doc__}, ! {"rstrip", strop_rstrip, METH_OLDARGS, rstrip__doc__}, ! {"split", strop_splitfields, METH_VARARGS, splitfields__doc__}, ! {"splitfields", strop_splitfields, METH_VARARGS, splitfields__doc__}, ! {"strip", strop_strip, METH_OLDARGS, strip__doc__}, ! {"swapcase", strop_swapcase, METH_OLDARGS, swapcase__doc__}, ! {"translate", strop_translate, METH_VARARGS, translate__doc__}, ! {"upper", strop_upper, METH_OLDARGS, upper__doc__}, {NULL, NULL} /* sentinel */ }; From mwh@python.net Wed May 9 23:28:12 2001 From: mwh@python.net (Michael Hudson) Date: 09 May 2001 23:28:12 +0100 Subject: [Python-checkins] CVS: python/dist/src/Modules fcntlmodule.c,2.28,2.29 References: Message-ID: "Fred L. Drake" writes: > Update of /cvsroot/python/python/dist/src/Modules > In directory usw-pr-cvs1:/tmp/cvs-serv23294/Modules > > Modified Files: > fcntlmodule.c > Log Message: > > Modify to allow file objects wherever file descriptors are needed. [...] > ! if (!PyArg_ParseTuple(args, "O&i|i;ioctl requires 2 integers and optionally a third integer or a string", > ! conv_descriptor, &fd, &code, &arg)) { The error message is now out of date! You did the fcntl one, so I'm assuming you just forgot this one? Cheers, M. -- Considering that this thread is completely on-topic in the way only c.l.py threads can be, I think I can say that you should replace "Oblivion" with "Gravity", and increase your Radiohead quotient. -- Ben Wolfson, comp.lang.python From tim_one@users.sourceforge.net Thu May 10 00:00:28 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 16:00:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules stropmodule.c,2.76,2.77 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv15893/python/dist/src/Modules Modified Files: stropmodule.c Log Message: SF bug #422088: [OSF1 alpha] string.replace(). Platform blew up on "123".replace("123", ""). Michael Hudson pinned the blame on platform malloc(0) returning NULL. This is a candidate for all bugfix releases. Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.76 retrieving revision 2.77 diff -C2 -r2.76 -r2.77 *** stropmodule.c 2001/05/09 22:15:03 2.76 --- stropmodule.c 2001/05/09 23:00:26 2.77 *************** *** 1062,1095 **** if (nfound == 0) goto return_same; - new_len = len + nfound*(sub_len - pat_len); - - new_s = (char *)PyMem_MALLOC(new_len); - if (new_s == NULL) return NULL; - - *out_len = new_len; - out_s = new_s; - - while (len > 0) { - /* find index of next instance of pattern */ - offset = mymemfind(str, len, pat, pat_len); - /* if not found, break out of loop */ - if (offset == -1) break; ! /* copy non matching part of input string */ ! memcpy(new_s, str, offset); /* copy part of str before pat */ ! str += offset + pat_len; /* move str past pattern */ ! len -= offset + pat_len; /* reduce length of str remaining */ ! ! /* copy substitute into the output string */ ! new_s += offset; /* move new_s to dest for sub string */ ! memcpy(new_s, sub, sub_len); /* copy substring into new_s */ ! new_s += sub_len; /* offset new_s past sub string */ ! ! /* break when we've done count replacements */ ! if (--count == 0) break; } ! /* copy any remaining values into output string */ ! if (len > 0) ! memcpy(new_s, str, len); return out_s; --- 1062,1102 ---- if (nfound == 0) goto return_same; ! new_len = len + nfound*(sub_len - pat_len); ! if (new_len == 0) { ! out_s = ""; } ! else { ! assert(new_len > 0); ! new_s = (char *)PyMem_MALLOC(new_len); ! if (new_s == NULL) ! return NULL; ! out_s = new_s; ! ! while (len > 0) { ! /* find index of next instance of pattern */ ! offset = mymemfind(str, len, pat, pat_len); ! if (offset == -1) ! break; ! ! /* copy non matching part of input string */ ! memcpy(new_s, str, offset); ! str += offset + pat_len; ! len -= offset + pat_len; ! ! /* copy substitute into the output string */ ! new_s += offset; ! memcpy(new_s, sub, sub_len); ! new_s += sub_len; ! ! /* note count==0 is effectively infinity */ ! if (--count == 0) ! break; ! } ! /* copy any remaining values into output string */ ! if (len > 0) ! memcpy(new_s, str, len); ! } ! *out_len = new_len; return out_s; From tim_one@users.sourceforge.net Thu May 10 00:00:28 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 16:00:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test string_tests.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv15893/python/dist/src/Lib/test Modified Files: string_tests.py Log Message: SF bug #422088: [OSF1 alpha] string.replace(). Platform blew up on "123".replace("123", ""). Michael Hudson pinned the blame on platform malloc(0) returning NULL. This is a candidate for all bugfix releases. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** string_tests.py 2001/02/09 11:43:35 1.7 --- string_tests.py 2001/05/09 23:00:26 1.8 *************** *** 178,181 **** --- 178,187 ---- test('replace', 'one!two!three!', 'one!two!three!', 'x', '@') test('replace', 'one!two!three!', 'one!two!three!', 'x', '@', 2) + # Next three for SF bug 422088: [OSF1 alpha] string.replace(); died with + # MemoryError due to empty result (platform malloc issue when requesting + # 0 bytes). + test('replace', '123', '', '123', '') + test('replace', '123123', '', '123', '') + test('replace', '123x123', 'x', '123', '') test('startswith', 'hello', 1, 'he') From tim_one@users.sourceforge.net Thu May 10 01:05:35 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 17:05:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules stropmodule.c,2.77,2.78 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25582/python/dist/src/Modules Modified Files: stropmodule.c Log Message: Fudge. stropmodule and stringobject both had copies of the buggy mymemXXX stuff, and they were already out of synch. Fix the remaining bugs in both and get them back in synch. Bugfix release candidate. Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.77 retrieving revision 2.78 diff -C2 -r2.77 -r2.78 *** stropmodule.c 2001/05/09 23:00:26 2.77 --- stropmodule.c 2001/05/10 00:05:33 2.78 *************** *** 983,987 **** */ static int ! mymemfind(char *mem, int len, char *pat, int pat_len) { register int ii; --- 983,987 ---- */ static int ! mymemfind(const char *mem, int len, const char *pat, int pat_len) { register int ii; *************** *** 1008,1012 **** */ static int ! mymemcnt(char *mem, int len, char *pat, int pat_len) { register int offset = 0; --- 1008,1012 ---- */ static int ! mymemcnt(const char *mem, int len, const char *pat, int pat_len) { register int offset = 0; *************** *** 1044,1051 **** */ static char * ! mymemreplace(char *str, int len, ! char *pat, int pat_len, ! char *sub, int sub_len, ! int count, int *out_len) { char *out_s; --- 1044,1052 ---- */ static char * ! mymemreplace(const char *str, int len, /* input string */ ! const char *pat, int pat_len, /* pattern string to find */ ! const char *sub, int sub_len, /* substitution string */ ! int count, /* number of replacements */ ! int *out_len) { char *out_s; *************** *** 1065,1069 **** new_len = len + nfound*(sub_len - pat_len); if (new_len == 0) { ! out_s = ""; } else { --- 1066,1074 ---- new_len = len + nfound*(sub_len - pat_len); if (new_len == 0) { ! /* Have to allocate something for the caller to free(). */ ! out_s = (char *)PyMem_MALLOC(1); ! if (out_s = NULL) ! return NULL; ! out_s[0] = '\0'; } else { *************** *** 1103,1107 **** return_same: *out_len = -1; ! return str; } --- 1108,1112 ---- return_same: *out_len = -1; ! return (char *)str; /* cast away const */ } From tim_one@users.sourceforge.net Thu May 10 01:05:35 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 17:05:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.113,2.114 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25582/python/dist/src/Objects Modified Files: stringobject.c Log Message: Fudge. stropmodule and stringobject both had copies of the buggy mymemXXX stuff, and they were already out of synch. Fix the remaining bugs in both and get them back in synch. Bugfix release candidate. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.113 retrieving revision 2.114 diff -C2 -r2.113 -r2.114 *** stringobject.c 2001/05/09 20:06:00 2.113 --- stringobject.c 2001/05/10 00:05:33 2.114 *************** *** 1547,1551 **** const char *sub, int sub_len, /* substitution string */ int count, /* number of replacements */ ! int *out_len) { char *out_s; --- 1547,1551 ---- const char *sub, int sub_len, /* substitution string */ int count, /* number of replacements */ ! int *out_len) { char *out_s; *************** *** 1558,1602 **** /* find length of output string */ nfound = mymemcnt(str, len, pat, pat_len); ! if (count < 0) ! count = INT_MAX; ! else if (nfound > count) ! nfound = count; if (nfound == 0) goto return_same; - new_len = len + nfound*(sub_len - pat_len); - - new_s = (char *)PyMem_MALLOC(new_len); - if (new_s == NULL) return NULL; - - *out_len = new_len; - out_s = new_s; ! while (len > 0) { ! /* find index of next instance of pattern */ ! offset = mymemfind(str, len, pat, pat_len); ! /* if not found, break out of loop */ ! if (offset == -1) break; ! ! /* copy non matching part of input string */ ! memcpy(new_s, str, offset); /* copy part of str before pat */ ! str += offset + pat_len; /* move str past pattern */ ! len -= offset + pat_len; /* reduce length of str remaining */ ! ! /* copy substitute into the output string */ ! new_s += offset; /* move new_s to dest for sub string */ ! memcpy(new_s, sub, sub_len); /* copy substring into new_s */ ! new_s += sub_len; /* offset new_s past sub string */ ! ! /* break when we've done count replacements */ ! if (--count == 0) break; } ! /* copy any remaining values into output string */ ! if (len > 0) ! memcpy(new_s, str, len); return out_s; return_same: *out_len = -1; ! return (char*)str; /* have to cast away constness here */ } --- 1558,1611 ---- /* find length of output string */ nfound = mymemcnt(str, len, pat, pat_len); ! if (count > 0) ! nfound = nfound > count ? count : nfound; if (nfound == 0) goto return_same; ! new_len = len + nfound*(sub_len - pat_len); ! if (new_len == 0) { ! /* Have to allocate something for the caller to free(). */ ! out_s = (char *)PyMem_MALLOC(1); ! if (out_s = NULL) ! return NULL; ! out_s[0] = '\0'; } ! else { ! assert(new_len > 0); ! new_s = (char *)PyMem_MALLOC(new_len); ! if (new_s == NULL) ! return NULL; ! out_s = new_s; ! ! while (len > 0) { ! /* find index of next instance of pattern */ ! offset = mymemfind(str, len, pat, pat_len); ! if (offset == -1) ! break; ! ! /* copy non matching part of input string */ ! memcpy(new_s, str, offset); ! str += offset + pat_len; ! len -= offset + pat_len; ! ! /* copy substitute into the output string */ ! new_s += offset; ! memcpy(new_s, sub, sub_len); ! new_s += sub_len; ! ! /* note count==0 is effectively infinity */ ! if (--count == 0) ! break; ! } ! /* copy any remaining values into output string */ ! if (len > 0) ! memcpy(new_s, str, len); ! } ! *out_len = new_len; return out_s; return_same: *out_len = -1; ! return (char *)str; /* cast away const */ } From tim_one@users.sourceforge.net Thu May 10 01:32:59 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 17:32:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules stropmodule.c,2.78,2.79 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv29092/python/dist/src/Modules Modified Files: stropmodule.c Log Message: Heh. I need a break. After this: stropmodule & stringobject were more out of synch than I realized, and I managed to break replace's "count" argument when it was 0. All is well again. Maybe. Bugfix candidate. Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.78 retrieving revision 2.79 diff -C2 -r2.78 -r2.79 *** stropmodule.c 2001/05/10 00:05:33 2.78 --- stropmodule.c 2001/05/10 00:32:57 2.79 *************** *** 1059,1064 **** /* find length of output string */ nfound = mymemcnt(str, len, pat, pat_len); ! if (count > 0) ! nfound = nfound > count ? count : nfound; if (nfound == 0) goto return_same; --- 1059,1066 ---- /* find length of output string */ nfound = mymemcnt(str, len, pat, pat_len); ! if (count < 0) ! count = INT_MAX; ! else if (nfound > count) ! nfound = count; if (nfound == 0) goto return_same; *************** *** 1068,1072 **** /* Have to allocate something for the caller to free(). */ out_s = (char *)PyMem_MALLOC(1); ! if (out_s = NULL) return NULL; out_s[0] = '\0'; --- 1070,1074 ---- /* Have to allocate something for the caller to free(). */ out_s = (char *)PyMem_MALLOC(1); ! if (out_s == NULL) return NULL; out_s[0] = '\0'; *************** *** 1079,1083 **** out_s = new_s; ! while (len > 0) { /* find index of next instance of pattern */ offset = mymemfind(str, len, pat, pat_len); --- 1081,1085 ---- out_s = new_s; ! for (; count > 0 && len > 0; --count) { /* find index of next instance of pattern */ offset = mymemfind(str, len, pat, pat_len); *************** *** 1094,1101 **** memcpy(new_s, sub, sub_len); new_s += sub_len; - - /* note count==0 is effectively infinity */ - if (--count == 0) - break; } /* copy any remaining values into output string */ --- 1096,1099 ---- From tim_one@users.sourceforge.net Thu May 10 01:32:59 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 17:32:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.114,2.115 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv29092/python/dist/src/Objects Modified Files: stringobject.c Log Message: Heh. I need a break. After this: stropmodule & stringobject were more out of synch than I realized, and I managed to break replace's "count" argument when it was 0. All is well again. Maybe. Bugfix candidate. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.114 retrieving revision 2.115 diff -C2 -r2.114 -r2.115 *** stringobject.c 2001/05/10 00:05:33 2.114 --- stringobject.c 2001/05/10 00:32:57 2.115 *************** *** 1558,1563 **** /* find length of output string */ nfound = mymemcnt(str, len, pat, pat_len); ! if (count > 0) ! nfound = nfound > count ? count : nfound; if (nfound == 0) goto return_same; --- 1558,1565 ---- /* find length of output string */ nfound = mymemcnt(str, len, pat, pat_len); ! if (count < 0) ! count = INT_MAX; ! else if (nfound > count) ! nfound = count; if (nfound == 0) goto return_same; *************** *** 1567,1571 **** /* Have to allocate something for the caller to free(). */ out_s = (char *)PyMem_MALLOC(1); ! if (out_s = NULL) return NULL; out_s[0] = '\0'; --- 1569,1573 ---- /* Have to allocate something for the caller to free(). */ out_s = (char *)PyMem_MALLOC(1); ! if (out_s == NULL) return NULL; out_s[0] = '\0'; *************** *** 1578,1582 **** out_s = new_s; ! while (len > 0) { /* find index of next instance of pattern */ offset = mymemfind(str, len, pat, pat_len); --- 1580,1584 ---- out_s = new_s; ! for (; count > 0 && len > 0; --count) { /* find index of next instance of pattern */ offset = mymemfind(str, len, pat, pat_len); *************** *** 1593,1600 **** memcpy(new_s, sub, sub_len); new_s += sub_len; - - /* note count==0 is effectively infinity */ - if (--count == 0) - break; } /* copy any remaining values into output string */ --- 1595,1598 ---- From tim_one@users.sourceforge.net Thu May 10 01:59:47 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 17:59:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules stropmodule.c,2.79,2.80 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv31705/python/dist/src/Modules Modified Files: stropmodule.c Log Message: The strop module and test_strop.py believe replace() with a 0 count means "replace everything". But the string module, string.replace() amd test_string.py believe a 0 count means "replace nothing". "Nothing" wins, strop loses. Bugfix candidate. Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.79 retrieving revision 2.80 diff -C2 -r2.79 -r2.80 *** stropmodule.c 2001/05/10 00:32:57 2.79 --- stropmodule.c 2001/05/10 00:59:45 2.80 *************** *** 1122,1126 **** char *str, *pat,*sub,*new_s; int len,pat_len,sub_len,out_len; ! int count = 0; PyObject *new; --- 1122,1126 ---- char *str, *pat,*sub,*new_s; int len,pat_len,sub_len,out_len; ! int count = -1; PyObject *new; From tim_one@users.sourceforge.net Thu May 10 01:59:47 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 17:59:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_strop.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31705/python/dist/src/Lib/test Modified Files: test_strop.py Log Message: The strop module and test_strop.py believe replace() with a 0 count means "replace everything". But the string module, string.replace() amd test_string.py believe a 0 count means "replace nothing". "Nothing" wins, strop loses. Bugfix candidate. Index: test_strop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strop.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** test_strop.py 2001/01/17 21:51:36 1.10 --- test_strop.py 2001/05/10 00:59:45 1.11 *************** *** 78,82 **** test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 3) test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 4) ! test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 0) test('replace', 'one!two!three!', 'one@two@three@', '!', '@') test('replace', 'one!two!three!', 'one!two!three!', 'x', '@') --- 78,82 ---- test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 3) test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 4) ! test('replace', 'one!two!three!', 'one!two!three!', '!', '@', 0) test('replace', 'one!two!three!', 'one@two@three@', '!', '@') test('replace', 'one!two!three!', 'one!two!three!', 'x', '@') From tim_one@users.sourceforge.net Thu May 10 02:23:41 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 18:23:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_strop.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2545/python/dist/src/Lib/test Modified Files: test_strop.py Log Message: Guido has Spoken. Restore strop.replace()'s treatment of a 0 count as meaning infinity -- but at least warn about it in the code! I pissed away a couple hours on this today, and don't wish the same on the next in line. Bugfix candidate. Index: test_strop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strop.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** test_strop.py 2001/05/10 00:59:45 1.11 --- test_strop.py 2001/05/10 01:23:39 1.12 *************** *** 78,82 **** test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 3) test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 4) ! test('replace', 'one!two!three!', 'one!two!three!', '!', '@', 0) test('replace', 'one!two!three!', 'one@two@three@', '!', '@') test('replace', 'one!two!three!', 'one!two!three!', 'x', '@') --- 78,84 ---- test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 3) test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 4) ! # CAUTION: a replace count of 0 means infinity only to strop, not to the ! # string .replace() method or to the string.replace() function. ! test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 0) test('replace', 'one!two!three!', 'one@two@three@', '!', '@') test('replace', 'one!two!three!', 'one!two!three!', 'x', '@') From tim_one@users.sourceforge.net Thu May 10 02:23:41 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 09 May 2001 18:23:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules stropmodule.c,2.80,2.81 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2545/python/dist/src/Modules Modified Files: stropmodule.c Log Message: Guido has Spoken. Restore strop.replace()'s treatment of a 0 count as meaning infinity -- but at least warn about it in the code! I pissed away a couple hours on this today, and don't wish the same on the next in line. Bugfix candidate. Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.80 retrieving revision 2.81 diff -C2 -r2.80 -r2.81 *** stropmodule.c 2001/05/10 00:59:45 2.80 --- stropmodule.c 2001/05/10 01:23:39 2.81 *************** *** 1133,1136 **** --- 1133,1142 ---- return NULL; } + /* CAUTION: strop treats a replace count of 0 as infinity, unlke + * current (2.1) string.py and string methods. Preserve this for + * ... well, hard to say for what . + */ + if (count == 0) + count = -1; new_s = mymemreplace(str,len,pat,pat_len,sub,sub_len,count,&out_len); if (new_s == NULL) { From purcell@users.sourceforge.net Thu May 10 02:28:43 2001 From: purcell@users.sourceforge.net (Steve Purcell) Date: Wed, 09 May 2001 18:28:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib unittest.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv3434 Modified Files: unittest.py Log Message: patch 418489 from Andrew Dalke for string format bug Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** unittest.py 2001/04/15 09:18:32 1.7 --- unittest.py 2001/05/10 01:28:40 1.8 *************** *** 444,448 **** not isinstance(test, TestSuite): raise ValueError, \ ! "calling %s returned %s, not a test" % obj,test return test else: --- 444,448 ---- not isinstance(test, TestSuite): raise ValueError, \ ! "calling %s returned %s, not a test" % (obj,test) return test else: From fdrake@users.sourceforge.net Thu May 10 06:17:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Wed, 09 May 2001 22:17:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pty.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv32703/Lib Modified Files: pty.py Log Message: Update to reflect deprecation of the FCNTL module: The fcntl module does *not* define O_RDWR; get that from the os module. Index: pty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pty.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** pty.py 2001/02/12 02:00:42 1.7 --- pty.py 2001/05/10 05:17:02 1.8 *************** *** 8,12 **** from select import select ! import os, FCNTL import tty --- 8,12 ---- from select import select ! import os import tty *************** *** 56,60 **** else: try: ! tty_name, master_fd = sgi._getpty(FCNTL.O_RDWR, 0666, 0) except IOError, msg: raise os.error, msg --- 56,60 ---- else: try: ! tty_name, master_fd = sgi._getpty(os.O_RDWR, 0666, 0) except IOError, msg: raise os.error, msg *************** *** 64,68 **** pty_name = '/dev/pty' + x + y try: ! fd = os.open(pty_name, FCNTL.O_RDWR) except os.error: continue --- 64,68 ---- pty_name = '/dev/pty' + x + y try: ! fd = os.open(pty_name, os.O_RDWR) except os.error: continue *************** *** 76,80 **** Deprecated, use openpty() instead.""" ! return os.open(tty_name, FCNTL.O_RDWR) def fork(): --- 76,80 ---- Deprecated, use openpty() instead.""" ! return os.open(tty_name, os.O_RDWR) def fork(): From tim_one@users.sourceforge.net Thu May 10 09:32:46 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 10 May 2001 01:32:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_mutants,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv28217/python/dist/src/Lib/test/output Added Files: test_mutants Log Message: SF bug #422121 Insecurities in dict comparison. Fixed a half dozen ways in which general dict comparison could crash Python (even cause Win98SE to reboot) in the presence of kay and/or value comparison routines that mutate the dict during dict comparison. Bugfix candidate. --- NEW FILE: test_mutants --- test_mutants From tim_one@users.sourceforge.net Thu May 10 09:32:46 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 10 May 2001 01:32:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.83,2.84 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28217/python/dist/src/Objects Modified Files: dictobject.c Log Message: SF bug #422121 Insecurities in dict comparison. Fixed a half dozen ways in which general dict comparison could crash Python (even cause Win98SE to reboot) in the presence of kay and/or value comparison routines that mutate the dict during dict comparison. Bugfix candidate. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.83 retrieving revision 2.84 diff -C2 -r2.83 -r2.84 *** dictobject.c 2001/05/08 04:38:29 2.83 --- dictobject.c 2001/05/10 08:32:44 2.84 *************** *** 982,1022 **** /* Subroutine which returns the smallest key in a for which b's value is different or absent. The value is returned too, through the ! pval argument. No reference counts are incremented. */ static PyObject * characterize(dictobject *a, dictobject *b, PyObject **pval) { ! PyObject *diff = NULL; int i, cmp; - *pval = NULL; for (i = 0; i < a->ma_size; i++) { ! if (a->ma_table[i].me_value != NULL) { ! PyObject *key = a->ma_table[i].me_key; ! PyObject *aval, *bval; ! if (diff != NULL) { ! cmp = PyObject_RichCompareBool(diff, key, Py_LT); ! if (cmp < 0) ! return NULL; ! if (cmp > 0) ! continue; } ! aval = a->ma_table[i].me_value; ! bval = PyDict_GetItem((PyObject *)b, key); ! if (bval == NULL) ! cmp = 0; ! else { ! cmp = PyObject_RichCompareBool(aval, bval, Py_EQ); ! if (cmp < 0) ! return NULL; ! } ! if (cmp == 0) { ! diff = key; ! *pval = aval; } } } ! return diff; } --- 982,1062 ---- /* Subroutine which returns the smallest key in a for which b's value is different or absent. The value is returned too, through the ! pval argument. Both are NULL if no key in a is found for which b's status ! differs. The refcounts on (and only on) non-NULL *pval and function return ! values must be decremented by the caller (characterize() increments them ! to ensure that mutating comparison and PyDict_GetItem calls can't delete ! them before the caller is done looking at them). */ static PyObject * characterize(dictobject *a, dictobject *b, PyObject **pval) { ! PyObject *akey = NULL; /* smallest key in a s.t. a[akey] != b[akey] */ ! PyObject *aval = NULL; /* a[akey] */ int i, cmp; for (i = 0; i < a->ma_size; i++) { ! PyObject *thiskey, *thisaval, *thisbval; ! if (a->ma_table[i].me_value == NULL) ! continue; ! thiskey = a->ma_table[i].me_key; ! Py_INCREF(thiskey); /* keep alive across compares */ ! if (akey != NULL) { ! cmp = PyObject_RichCompareBool(akey, thiskey, Py_LT); ! if (cmp < 0) { ! Py_DECREF(thiskey); ! goto Fail; } ! if (cmp > 0 || ! i >= a->ma_size || ! a->ma_table[i].me_value == NULL) { ! /* Not the *smallest* a key; or maybe it is ! * but the compare shrunk the dict so we can't ! * find its associated value anymore; or ! * maybe it is but the compare deleted the ! * a[thiskey] entry. ! */ ! Py_DECREF(thiskey); ! continue; } } + + /* Compare a[thiskey] to b[thiskey]; cmp <- true iff equal. */ + thisaval = a->ma_table[i].me_value; + assert(thisaval); + Py_INCREF(thisaval); /* keep alive */ + thisbval = PyDict_GetItem((PyObject *)b, thiskey); + if (thisbval == NULL) + cmp = 0; + else { + /* both dicts have thiskey: same values? */ + cmp = PyObject_RichCompareBool( + thisaval, thisbval, Py_EQ); + if (cmp < 0) { + Py_DECREF(thiskey); + Py_DECREF(thisaval); + goto Fail; + } + } + if (cmp == 0) { + /* New winner. */ + Py_XDECREF(akey); + Py_XDECREF(aval); + akey = thiskey; + aval = thisaval; + } + else { + Py_DECREF(thiskey); + Py_DECREF(thisaval); + } } ! *pval = aval; ! return akey; ! ! Fail: ! Py_XDECREF(akey); ! Py_XDECREF(aval); ! *pval = NULL; ! return NULL; } *************** *** 1032,1048 **** else if (a->ma_used > b->ma_used) return 1; /* b is shorter */ /* Same length -- check all keys */ adiff = characterize(a, b, &aval); ! if (adiff == NULL && PyErr_Occurred()) ! return -1; ! if (adiff == NULL) ! return 0; /* a is a subset with the same length */ bdiff = characterize(b, a, &bval); ! if (bdiff == NULL && PyErr_Occurred()) ! return -1; ! /* bdiff == NULL would be impossible now */ ! res = PyObject_Compare(adiff, bdiff); ! if (res == 0) res = PyObject_Compare(aval, bval); return res; } --- 1072,1109 ---- else if (a->ma_used > b->ma_used) return 1; /* b is shorter */ + /* Same length -- check all keys */ + bdiff = bval = NULL; adiff = characterize(a, b, &aval); ! if (adiff == NULL) { ! assert(!aval); ! /* Either an error, or a is a subst with the same length so ! * must be equal. ! */ ! res = PyErr_Occurred() ? -1 : 0; ! goto Finished; ! } bdiff = characterize(b, a, &bval); ! if (bdiff == NULL && PyErr_Occurred()) { ! assert(!bval); ! res = -1; ! goto Finished; ! } ! res = 0; ! if (bdiff) { ! /* bdiff == NULL "should be" impossible now, but perhaps ! * the last comparison done by the characterize() on a had ! * the side effect of making the dicts equal! ! */ ! res = PyObject_Compare(adiff, bdiff); ! } ! if (res == 0 && bval != NULL) res = PyObject_Compare(aval, bval); + + Finished: + Py_XDECREF(adiff); + Py_XDECREF(bdiff); + Py_XDECREF(aval); + Py_XDECREF(bval); return res; } From tim_one@users.sourceforge.net Thu May 10 09:32:46 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 10 May 2001 01:32:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mutants.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28217/python/dist/src/Lib/test Added Files: test_mutants.py Log Message: SF bug #422121 Insecurities in dict comparison. Fixed a half dozen ways in which general dict comparison could crash Python (even cause Win98SE to reboot) in the presence of kay and/or value comparison routines that mutate the dict during dict comparison. Bugfix candidate. --- NEW FILE: test_mutants.py --- from test_support import verbose import random # From SF bug #422121: Insecurities in dict comparison. # Safety of code doing comparisons has been an historical Python waak spot. # The problem is that comparison of structures in written in C *naturally* # wants to hold on to things like the size of the container, or "the # biggest" containee so far, across a traversal of the container; but # code to do containee comparisons can call back into Python and mutate # the container in arbitrary ways while the C loop is in midstream. If the # C code isn't extremely paranoid about digging things out of memory on # each trip, and artificially boosting refcounts for the duration, anything # from infinite loops to OS crashes can result (yes, I use Windows ). # # The other problem is that code designed to provoke a weakness is usually # white-box code, and so catches only the particular vulnerabilities the # author knew to protect against. For example, Python's list.sort() code # went thru many iterations as one "new" vulnerability after another was # discovered. # # So the dict comparison test here uses a black-box approach instead, # generating dicts of various sizes at random, and performing random # mutations on them at random times. This proved very effective, # triggering at least six distinct failure modes the first 20 times I # ran it. Indeed, at the start, the driver never got beyond 6 iterations # before the test died. # The dicts are global to make it easy to mutate tham from within functions. dict1 = {} dict2 = {} # The current set of keys in dict1 and dict2. These are materialized as # lists to make it easy to pick a dict key at random. dict1keys = [] dict2keys = [] # Global flag telling maybe_mutate() wether to *consider* mutating. mutate = 0 # If global mutate is true, consider mutating a dict. May or may not # mutate a dict even if mutate is true. If it does decide to mutate a # dict, it picks one of {dict1, dict2} at random, and deletes a random # entry from it. def maybe_mutate(): if not mutate: return if random.random() < 0.5: return if random.random() < 0.5: target, keys = dict1, dict1keys else: target, keys = dict2, dict2keys if keys: i = random.randrange(len(keys)) key = keys[i] del target[key] # CAUTION: don't use keys.remove(key) here. Or do . The # point is that .remove() would trigger more comparisons, and so # also more calls to this routine. We're mutating often enough # without that. del keys[i] # A horrid class that triggers random mutations of dict1 and dict2 when # instances are compared. class Horrid: def __init__(self, i): # Comparison outcomes are determined by the value of i. self.i = i # An artificial hashcode is selected at random so that we don't # have any systematic relationship between comparsion outcomes # (based on self.i and other.i) and relative position within the # hawh vector (based on hashcode). self.hashcode = random.randrange(1000000000) def __hash__(self): return self.hashcode def __cmp__(self, other): maybe_mutate() # The point of the test. return cmp(self.i, other.i) def __repr__(self): return "Horrid(%d)" % self.i # Fill dict d with numentries (Horrid(i), Horrid(j)) key-value pairs, # where i and j are selected at random from the candidates list. # Return d.keys() after filling. def fill_dict(d, candidates, numentries): d.clear() for i in xrange(numentries): d[Horrid(random.choice(candidates))] = \ Horrid(random.choice(candidates)) return d.keys() # Test one pair of randomly generated dicts, each with n entries. # Note that dict comparison is trivial if they don't have the same number # of entires (then the "shorter" dict is instantly considered to be the # smaller one, without even looking at the entries). def test_one(n): global mutate, dict1, dict2, dict1keys, dict2keys # Fill the dicts without mutating them. mutate = 0 dict1keys = fill_dict(dict1, range(n), n) dict2keys = fill_dict(dict2, range(n), n) # Enable mutation, then compare the dicts so long as they have the # same size. mutate = 1 if verbose: print "trying w/ lengths", len(dict1), len(dict2), while dict1 and len(dict1) == len(dict2): if verbose: print ".", c = cmp(dict1, dict2) if verbose: print # Run test_one n times. At the start (before the bugs were fixed), 20 # consecutive runs of this test each blew up on or before the sixth time # test_one was run. So n doesn't have to be large to get an interesting # test. # OTOH, calling with large n is also interesting, to ensure that the fixed # code doesn't hold on to refcounts *too* long (in which case memory would # leak). def test(n): for i in xrange(n): test_one(random.randrange(1, 100)) # See last comment block for clues about good values for n. test(100) From tim_one@users.sourceforge.net Thu May 10 09:32:46 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 10 May 2001 01:32:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.163,1.164 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv28217/python/dist/src/Misc Modified Files: NEWS Log Message: SF bug #422121 Insecurities in dict comparison. Fixed a half dozen ways in which general dict comparison could crash Python (even cause Win98SE to reboot) in the presence of kay and/or value comparison routines that mutate the dict during dict comparison. Bugfix candidate. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -r1.163 -r1.164 *** NEWS 2001/05/08 15:43:37 1.163 --- NEWS 2001/05/10 08:32:44 1.164 *************** *** 48,51 **** --- 48,56 ---- if the keys and values don't support comparisons other than ==. + - Comparing dictionaries in ways other than == and != is slower: there were + insecurities in the dict comparison implementation that could cause Python + to crash if the element comparison routines for the dict keys and/or + values mutated the dicts. Making the code bulletproof slowed it down. + What's New in Python 2.1 (final)? From fdrake@users.sourceforge.net Thu May 10 16:05:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 08:05:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib liblocale.tex,1.22,1.23 libstring.tex,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv7103/lib Modified Files: liblocale.tex libstring.tex Log Message: Remove all mentions of the strop module -- it has been pronounced Evil. (The string "strop" is found in the rexec documentation, but that should not be changed until strop is actually removed or rexec no longer allows it.) Index: liblocale.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblocale.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** liblocale.tex 2001/01/24 17:19:06 1.22 --- liblocale.tex 2001/05/10 15:05:03 1.23 *************** *** 301,314 **** The case conversion functions in the ! \refmodule{string}\refstmodindex{string} and ! \module{strop}\refbimodindex{strop} modules are affected by the locale ! settings. When a call to the \function{setlocale()} function changes ! the \constant{LC_CTYPE} settings, the variables \code{string.lowercase}, \code{string.uppercase} and ! \code{string.letters} (and their counterparts in \module{strop}) are ! recalculated. Note that this code that uses these variable through ! `\keyword{from} ... \keyword{import} ...', e.g. \code{from string ! import letters}, is not affected by subsequent \function{setlocale()} ! calls. The only way to perform numeric operations according to the locale --- 301,312 ---- The case conversion functions in the ! \refmodule{string}\refstmodindex{string} module are affected by the ! locale settings. When a call to the \function{setlocale()} function ! changes the \constant{LC_CTYPE} settings, the variables \code{string.lowercase}, \code{string.uppercase} and ! \code{string.letters} are recalculated. Note that this code that uses ! these variable through `\keyword{from} ... \keyword{import} ...', ! e.g.\ \code{from string import letters}, is not affected by subsequent ! \function{setlocale()} calls. The only way to perform numeric operations according to the locale Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -r1.42 -r1.43 *** libstring.tex 2000/12/26 16:14:32 1.42 --- libstring.tex 2001/05/10 15:05:03 1.43 *************** *** 266,276 **** replaced. \end{funcdesc} - - This module is implemented in Python. Much of its functionality has - been reimplemented in the built-in module - \module{strop}\refbimodindex{strop}. However, you - should \emph{never} import the latter module directly. When - \module{string} discovers that \module{strop} exists, it transparently - replaces parts of itself with the implementation from \module{strop}. - After initialization, there is \emph{no} overhead in using - \module{string} instead of \module{strop}. --- 266,267 ---- From fdrake@users.sourceforge.net Thu May 10 16:09:38 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 08:09:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref7.tex,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv9991/ref Modified Files: ref7.tex Log Message: Fix typo reported by David Goodger. This closes SF patch #422383. Index: ref7.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref7.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** ref7.tex 2001/03/23 17:23:50 1.24 --- ref7.tex 2001/05/10 15:09:36 1.25 *************** *** 402,406 **** \method{__init__()} method or in another method. Both class and instance variables are accessible through the notation ! ```code{self.name}'', and an instance variable hides a class variable with the same name when accessed in this way. Class variables with immutable values can be used as defaults for instance variables. --- 402,406 ---- \method{__init__()} method or in another method. Both class and instance variables are accessible through the notation ! ``\code{self.name}'', and an instance variable hides a class variable with the same name when accessed in this way. Class variables with immutable values can be used as defaults for instance variables. From fdrake@users.sourceforge.net Thu May 10 16:10:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 08:10:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref7.tex,1.24,1.24.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv10331/ref Modified Files: Tag: release21-maint ref7.tex Log Message: Fix typo reported by David Goodger. This closes SF patch #422383. Index: ref7.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref7.tex,v retrieving revision 1.24 retrieving revision 1.24.2.1 diff -C2 -r1.24 -r1.24.2.1 *** ref7.tex 2001/03/23 17:23:50 1.24 --- ref7.tex 2001/05/10 15:10:17 1.24.2.1 *************** *** 402,406 **** \method{__init__()} method or in another method. Both class and instance variables are accessible through the notation ! ```code{self.name}'', and an instance variable hides a class variable with the same name when accessed in this way. Class variables with immutable values can be used as defaults for instance variables. --- 402,406 ---- \method{__init__()} method or in another method. Both class and instance variables are accessible through the notation ! ``\code{self.name}'', and an instance variable hides a class variable with the same name when accessed in this way. Class variables with immutable values can be used as defaults for instance variables. From fdrake@users.sourceforge.net Thu May 10 16:13:41 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 08:13:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib liblocale.tex,1.22,1.22.4.1 libstring.tex,1.42,1.42.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv11867/lib Modified Files: Tag: release21-maint liblocale.tex libstring.tex Log Message: Remove all mentions of the strop module -- it has been pronounced Evil. (The string "strop" is found in the rexec documentation, but that should not be changed until strop is actually removed or rexec no longer allows it.) Index: liblocale.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblocale.tex,v retrieving revision 1.22 retrieving revision 1.22.4.1 diff -C2 -r1.22 -r1.22.4.1 *** liblocale.tex 2001/01/24 17:19:06 1.22 --- liblocale.tex 2001/05/10 15:13:39 1.22.4.1 *************** *** 301,314 **** The case conversion functions in the ! \refmodule{string}\refstmodindex{string} and ! \module{strop}\refbimodindex{strop} modules are affected by the locale ! settings. When a call to the \function{setlocale()} function changes ! the \constant{LC_CTYPE} settings, the variables \code{string.lowercase}, \code{string.uppercase} and ! \code{string.letters} (and their counterparts in \module{strop}) are ! recalculated. Note that this code that uses these variable through ! `\keyword{from} ... \keyword{import} ...', e.g. \code{from string ! import letters}, is not affected by subsequent \function{setlocale()} ! calls. The only way to perform numeric operations according to the locale --- 301,312 ---- The case conversion functions in the ! \refmodule{string}\refstmodindex{string} module are affected by the ! locale settings. When a call to the \function{setlocale()} function ! changes the \constant{LC_CTYPE} settings, the variables \code{string.lowercase}, \code{string.uppercase} and ! \code{string.letters} are recalculated. Note that this code that uses ! these variable through `\keyword{from} ... \keyword{import} ...', ! e.g.\ \code{from string import letters}, is not affected by subsequent ! \function{setlocale()} calls. The only way to perform numeric operations according to the locale Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.42 retrieving revision 1.42.4.1 diff -C2 -r1.42 -r1.42.4.1 *** libstring.tex 2000/12/26 16:14:32 1.42 --- libstring.tex 2001/05/10 15:13:39 1.42.4.1 *************** *** 266,276 **** replaced. \end{funcdesc} - - This module is implemented in Python. Much of its functionality has - been reimplemented in the built-in module - \module{strop}\refbimodindex{strop}. However, you - should \emph{never} import the latter module directly. When - \module{string} discovers that \module{strop} exists, it transparently - replaces parts of itself with the implementation from \module{strop}. - After initialization, there is \emph{no} overhead in using - \module{string} instead of \module{strop}. --- 266,267 ---- From gvanrossum@users.sourceforge.net Thu May 10 16:21:30 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 10 May 2001 08:21:30 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.124.4.8,2.124.4.9 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14511 Modified Files: Tag: descr-branch object.c Log Message: In PyGeneric_SetAttr(), distinguish between non-existent and read-only attributes when raising AttributeError. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.4.8 retrieving revision 2.124.4.9 diff -C2 -r2.124.4.8 -r2.124.4.9 *** object.c 2001/05/06 02:31:13 2.124.4.8 --- object.c 2001/05/10 15:21:28 2.124.4.9 *************** *** 1113,1120 **** } descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr != NULL && (f = descr->ob_type->tp_descr_set) != NULL) return (*f)(descr, obj, value); PyErr_Format(PyExc_AttributeError, ! "'%.50s' object has no attribute '%.400s'", tp->tp_name, PyString_AS_STRING(name)); return -1; --- 1113,1126 ---- } descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr == NULL) { ! PyErr_Format(PyExc_AttributeError, ! "'%.50s' object has no attribute '%.400s'", ! tp->tp_name, PyString_AS_STRING(name)); ! return -1; ! } ! if ((f = descr->ob_type->tp_descr_set) != NULL) return (*f)(descr, obj, value); PyErr_Format(PyExc_AttributeError, ! "'%.50s' object attribute '%.400s' is read-only", tp->tp_name, PyString_AS_STRING(name)); return -1; From gvanrossum@users.sourceforge.net Thu May 10 16:33:13 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 10 May 2001 08:33:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.13,2.16.8.14 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv20151 Modified Files: Tag: descr-branch typeobject.c Log Message: Add a __dict__ to instances of Python classes that inherit from built-in types. Still to do (at least): - class variables should serve as defaults for instance variables - call __init__() if defined - don't add a __dict__ if the base type has non-generic getattro or setattro - support fixed slots instead of a __dict__, as an option? - multiple inheritance (limited to only one base class with C slots) Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.13 retrieving revision 2.16.8.14 diff -C2 -r2.16.8.13 -r2.16.8.14 *** typeobject.c 2001/05/07 23:19:24 2.16.8.13 --- typeobject.c 2001/05/10 15:33:11 2.16.8.14 *************** *** 54,57 **** --- 54,59 ---- type_call(PyTypeObject *type, PyObject *args, PyObject *kwds) { + int size; + void *mem; PyObject *obj, *res; *************** *** 62,68 **** return NULL; } ! obj = PyObject_New(PyObject, type); ! if (obj == NULL) ! return NULL; res = (type->tp_construct)(obj, args, kwds); if (res != obj) { --- 64,80 ---- return NULL; } ! ! /* Inline PyObject_New() so we can zero the memory */ ! size = _PyObject_SIZE(type); ! mem = PyObject_MALLOC(size); ! if (mem == NULL) ! return PyErr_NoMemory(); ! memset(mem, '\0', size); ! if (PyType_IS_GC(type)) ! obj = PyObject_FROM_GC(mem); ! else ! obj = (PyObject *)mem; ! PyObject_INIT(obj, type); ! res = (type->tp_construct)(obj, args, kwds); if (res != obj) { *************** *** 149,154 **** --- 161,217 ---- } + static PyObject * + subtype_getattro(PyObject *self, PyObject *name) + { + int dictoffset = self->ob_type->tp_members[0].offset; + PyObject *dict = * (PyObject **) ((char *)self + dictoffset); + + if (dict != NULL) { + PyObject *res = PyObject_GetItem(dict, name); + if (res != NULL) + return res; + PyErr_Clear(); + } + return PyGeneric_GetAttr(self, name); + } + + static int + subtype_setattro(PyObject *self, PyObject *name, PyObject *value) + { + PyTypeObject *tp = self->ob_type; + PyObject *descr; + + assert(tp->tp_dict != NULL && PyDict_Check(tp->tp_dict)); + descr = PyDict_GetItem(tp->tp_dict, name); + if (descr == NULL) { + int dictoffset = self->ob_type->tp_members[0].offset; + PyObject **dictptr = (PyObject **) ((char *)self + dictoffset); + PyObject *dict = *dictptr; + + if (dict == NULL) { + dict = PyDict_New(); + if (dict == NULL) + return -1; + *dictptr = dict; + } + if (value == NULL) { + int res = PyObject_DelItem(dict, name); + if (res < 0 && + PyErr_ExceptionMatches(PyExc_KeyError)) + { + PyErr_SetObject(PyExc_AttributeError, name); + return -1; + } + } + else + return PyObject_SetItem(dict, name, value); + } + return PyGeneric_SetAttr(self, name, value); + } + staticforward void override_slots(PyTypeObject *type, PyObject *dict); + #define NMEMBERS 1 + typedef struct { PyTypeObject type; *************** *** 157,160 **** --- 220,224 ---- PyMappingMethods as_mapping; PyBufferProcs as_buffer; + struct memberlist members[NMEMBERS+1]; char name[1]; } etype; *************** *** 168,171 **** --- 232,237 ---- PyTypeObject *base; char *dummy = NULL; + etype *et; + struct memberlist *mp; if (type != NULL) { *************** *** 198,211 **** return NULL; } ! type = PyObject_MALLOC(sizeof(etype) + strlen(name)); ! if (type == NULL) return NULL; ! memset(type, '\0', sizeof(etype)); PyObject_INIT(type, &PyType_Type); ! type->tp_as_number = & (((etype *)type)->as_number); ! type->tp_as_sequence = & (((etype *)type)->as_sequence); ! type->tp_as_mapping = & (((etype *)type)->as_mapping); ! type->tp_as_buffer = & (((etype *)type)->as_buffer); ! type->tp_name = strcpy(((etype *)type)->name, name); type->tp_flags = Py_TPFLAGS_DEFAULT; Py_INCREF(base); --- 264,278 ---- return NULL; } ! et = PyObject_MALLOC(sizeof(etype) + strlen(name)); ! if (et == NULL) return NULL; ! memset(et, '\0', sizeof(etype)); ! type = &et->type; PyObject_INIT(type, &PyType_Type); ! type->tp_as_number = &et->as_number; ! type->tp_as_sequence = &et->as_sequence; ! type->tp_as_mapping = &et->as_mapping; ! type->tp_as_buffer = &et->as_buffer; ! type->tp_name = strcpy(et->name, name); type->tp_flags = Py_TPFLAGS_DEFAULT; Py_INCREF(base); *************** *** 215,222 **** --- 282,309 ---- if (base->tp_dealloc) type->tp_dealloc = subtype_dealloc; + if (base->tp_getattro == NULL || + base->tp_getattro == PyGeneric_GetAttr) { + type->tp_getattro = subtype_getattro; + type->tp_getattr = NULL; + } + if (base->tp_setattro == NULL || + base->tp_setattro == PyGeneric_SetAttr) { + type->tp_setattro = subtype_setattro; + type->tp_setattr = NULL; + } + + type->tp_members = mp = et->members; + mp->name = "__dict__"; + mp->type = T_OBJECT; + mp->offset = base->tp_basicsize - ((base->tp_flags & Py_TPFLAGS_GC) + ? PyGC_HEAD_SIZE : 0); + mp->readonly = 1; + assert(mp+1 <= &et->members[NMEMBERS]); + if (PyType_InitDict(type) < 0) { Py_DECREF(type); return NULL; } + type->tp_basicsize += sizeof(PyObject *); /* for __dict__ */ x = PyObject_CallMethod(type->tp_dict, "update", "O", dict); if (x == NULL) { *************** *** 429,432 **** --- 516,521 ---- inherit_slots(PyTypeObject *type, PyTypeObject *base) { + int oldsize, newsize; + #undef COPYSLOT #undef COPYNUM *************** *** 530,534 **** COPYSLOT(tp_name); ! COPYSLOT(tp_basicsize); if (!(type->tp_flags & Py_TPFLAGS_GC) && (base->tp_flags & Py_TPFLAGS_GC) && --- 619,632 ---- COPYSLOT(tp_name); ! ! /* Copying basicsize is connected to the GC flags */ ! oldsize = base->tp_basicsize; ! if (base->tp_flags & Py_TPFLAGS_GC) ! oldsize -= PyGC_HEAD_SIZE; ! newsize = type->tp_basicsize; ! if (newsize && (type->tp_flags & Py_TPFLAGS_GC)) ! newsize -= PyGC_HEAD_SIZE; ! if (!newsize) ! newsize = oldsize; if (!(type->tp_flags & Py_TPFLAGS_GC) && (base->tp_flags & Py_TPFLAGS_GC) && *************** *** 536,543 **** (!type->tp_traverse && !type->tp_clear)) { type->tp_flags |= Py_TPFLAGS_GC; - type->tp_basicsize += PyGC_HEAD_SIZE; COPYSLOT(tp_traverse); COPYSLOT(tp_clear); } COPYSLOT(tp_itemsize); COPYSLOT(tp_dealloc); --- 634,644 ---- (!type->tp_traverse && !type->tp_clear)) { type->tp_flags |= Py_TPFLAGS_GC; COPYSLOT(tp_traverse); COPYSLOT(tp_clear); } + if (type->tp_flags & Py_TPFLAGS_GC) + newsize += PyGC_HEAD_SIZE; + type->tp_basicsize = newsize; + COPYSLOT(tp_itemsize); COPYSLOT(tp_dealloc); *************** *** 1227,1230 **** --- 1328,1333 ---- } + /* XXX the numerical slots should call the reverse operators too; + but how do they know their type? */ SLOT1(nb_add, add, PyObject *, O); SLOT1(nb_subtract, sub, PyObject *, O); From fdrake@users.sourceforge.net Thu May 10 16:33:33 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 08:33:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib asyncore.py,1.12,1.13 posixfile.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv20268 Modified Files: asyncore.py posixfile.py Log Message: Remove all remaining uses of the FCNTL module from the standard library. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** asyncore.py 2001/05/02 05:54:44 1.12 --- asyncore.py 2001/05/10 15:33:31 1.13 *************** *** 511,515 **** if os.name == 'posix': import fcntl - import FCNTL class file_wrapper: --- 511,514 ---- *************** *** 539,545 **** self.connected = 1 # set it to non-blocking mode ! flags = fcntl.fcntl (fd, FCNTL.F_GETFL, 0) ! flags = flags | FCNTL.O_NONBLOCK ! fcntl.fcntl (fd, FCNTL.F_SETFL, flags) self.set_file (fd) --- 538,544 ---- self.connected = 1 # set it to non-blocking mode ! flags = fcntl.fcntl (fd, fcntl.F_GETFL, 0) ! flags = flags | os.O_NONBLOCK ! fcntl.fcntl (fd, fcntl.F_SETFL, flags) self.set_file (fd) Index: posixfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixfile.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 *** posixfile.py 2001/04/10 15:44:33 1.20 --- posixfile.py 2001/05/10 15:33:31 1.21 *************** *** 108,112 **** def flags(self, *which): ! import fcntl, FCNTL if which: --- 108,112 ---- def flags(self, *which): ! import fcntl if which: *************** *** 117,158 **** l_flags = 0 ! if 'n' in which: l_flags = l_flags | FCNTL.O_NDELAY ! if 'a' in which: l_flags = l_flags | FCNTL.O_APPEND ! if 's' in which: l_flags = l_flags | FCNTL.O_SYNC file = self._file_ if '=' not in which: ! cur_fl = fcntl.fcntl(file.fileno(), FCNTL.F_GETFL, 0) if '!' in which: l_flags = cur_fl & ~ l_flags else: l_flags = cur_fl | l_flags ! l_flags = fcntl.fcntl(file.fileno(), FCNTL.F_SETFL, l_flags) if 'c' in which: arg = ('!' not in which) # 0 is don't, 1 is do close on exec ! l_flags = fcntl.fcntl(file.fileno(), FCNTL.F_SETFD, arg) if '?' in which: which = '' # Return current flags ! l_flags = fcntl.fcntl(file.fileno(), FCNTL.F_GETFL, 0) ! if FCNTL.O_APPEND & l_flags: which = which + 'a' ! if fcntl.fcntl(file.fileno(), FCNTL.F_GETFD, 0) & 1: which = which + 'c' ! if FCNTL.O_NDELAY & l_flags: which = which + 'n' ! if FCNTL.O_SYNC & l_flags: which = which + 's' return which def lock(self, how, *args): ! import struct, fcntl, FCNTL ! if 'w' in how: l_type = FCNTL.F_WRLCK ! elif 'r' in how: l_type = FCNTL.F_RDLCK ! elif 'u' in how: l_type = FCNTL.F_UNLCK else: raise TypeError, 'no type of lock specified' ! if '|' in how: cmd = FCNTL.F_SETLKW ! elif '?' in how: cmd = FCNTL.F_GETLK ! else: cmd = FCNTL.F_SETLK l_whence = 0 --- 117,158 ---- l_flags = 0 ! if 'n' in which: l_flags = l_flags | os.O_NDELAY ! if 'a' in which: l_flags = l_flags | os.O_APPEND ! if 's' in which: l_flags = l_flags | os.O_SYNC file = self._file_ if '=' not in which: ! cur_fl = fcntl.fcntl(file.fileno(), fcntl.F_GETFL, 0) if '!' in which: l_flags = cur_fl & ~ l_flags else: l_flags = cur_fl | l_flags ! l_flags = fcntl.fcntl(file.fileno(), fcntl.F_SETFL, l_flags) if 'c' in which: arg = ('!' not in which) # 0 is don't, 1 is do close on exec ! l_flags = fcntl.fcntl(file.fileno(), fcntl.F_SETFD, arg) if '?' in which: which = '' # Return current flags ! l_flags = fcntl.fcntl(file.fileno(), fcntl.F_GETFL, 0) ! if os.O_APPEND & l_flags: which = which + 'a' ! if fcntl.fcntl(file.fileno(), fcntl.F_GETFD, 0) & 1: which = which + 'c' ! if os.O_NDELAY & l_flags: which = which + 'n' ! if os.O_SYNC & l_flags: which = which + 's' return which def lock(self, how, *args): ! import struct, fcntl ! if 'w' in how: l_type = fcntl.F_WRLCK ! elif 'r' in how: l_type = fcntl.F_RDLCK ! elif 'u' in how: l_type = fcntl.F_UNLCK else: raise TypeError, 'no type of lock specified' ! if '|' in how: cmd = fcntl.F_SETLKW ! elif '?' in how: cmd = fcntl.F_GETLK ! else: cmd = fcntl.F_SETLK l_whence = 0 *************** *** 204,209 **** struct.unpack('hhllhh', flock) ! if l_type != FCNTL.F_UNLCK: ! if l_type == FCNTL.F_RDLCK: return 'r', l_len, l_start, l_whence, l_pid else: --- 204,209 ---- struct.unpack('hhllhh', flock) ! if l_type != fcntl.F_UNLCK: ! if l_type == fcntl.F_RDLCK: return 'r', l_len, l_start, l_whence, l_pid else: From fdrake@users.sourceforge.net Thu May 10 16:33:33 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 08:33:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/lib-old lockfile.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-old In directory usw-pr-cvs1:/tmp/cvs-serv20268/lib-old Modified Files: lockfile.py Log Message: Remove all remaining uses of the FCNTL module from the standard library. Index: lockfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-old/lockfile.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** lockfile.py 1994/05/03 14:46:18 1.1 --- lockfile.py 2001/05/10 15:33:31 1.2 *************** *** 1,15 **** ! import struct, fcntl, FCNTL def writelock(f): ! _lock(f, FCNTL.F_WRLCK) def readlock(f): ! _lock(f, FCNTL.F_RDLCK) def unlock(f): ! _lock(f, FCNTL.F_UNLCK) def _lock(f, op): ! dummy = fcntl.fcntl(f.fileno(), FCNTL.F_SETLKW, struct.pack('2h8l', op, 0, 0, 0, 0, 0, 0, 0, 0, 0)) --- 1,15 ---- ! import struct, fcntl def writelock(f): ! _lock(f, fcntl.F_WRLCK) def readlock(f): ! _lock(f, fcntl.F_RDLCK) def unlock(f): ! _lock(f, fcntl.F_UNLCK) def _lock(f, op): ! dummy = fcntl.fcntl(f.fileno(), fcntl.F_SETLKW, struct.pack('2h8l', op, 0, 0, 0, 0, 0, 0, 0, 0, 0)) From fdrake@users.sourceforge.net Thu May 10 16:52:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 08:52:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-sunos5 regen,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-sunos5 In directory usw-pr-cvs1:/tmp/cvs-serv25205/Lib/plat-sunos5 Modified Files: regen Log Message: Do no regenerate modules that should no longer be here. Index: regen =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-sunos5/regen,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** regen 1997/12/02 14:37:20 1.3 --- regen 2001/05/10 15:52:47 1.4 *************** *** 6,12 **** esac set -v - h2py /usr/include/sys/fcntl.h - h2py /usr/include/sys/socket.h h2py -i '(u_long)' /usr/include/netinet/in.h - h2py /usr/include/termios.h h2py /usr/include/sys/stropts.h --- 6,9 ---- From fdrake@users.sourceforge.net Thu May 10 16:52:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 08:52:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-sunos4 regen,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-sunos4 In directory usw-pr-cvs1:/tmp/cvs-serv25205/Lib/plat-sunos4 Modified Files: regen Log Message: Do no regenerate modules that should no longer be here. Index: regen =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-sunos4/regen,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** regen 1994/08/01 11:30:58 1.2 --- regen 2001/05/10 15:52:47 1.3 *************** *** 6,12 **** esac set -v - h2py FCNTL.py - echo "O_ACCMODE = (O_RDONLY|O_WRONLY|O_RDWR)" >>FCNTL.py - h2py /usr/include/sys/socket.h h2py /usr/include/sys/wait.h h2py -i '(u_long)' /usr/include/netinet/in.h --- 6,9 ---- From fdrake@users.sourceforge.net Thu May 10 16:52:49 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 08:52:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/plat-next3 regen,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-next3 In directory usw-pr-cvs1:/tmp/cvs-serv25205/Lib/plat-next3 Modified Files: regen Log Message: Do no regenerate modules that should no longer be here. Index: regen =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-next3/regen,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** regen 1996/08/16 18:14:41 1.1 --- regen 2001/05/10 15:52:47 1.2 *************** *** 4,11 **** export INCLUDE - python ../../Tools/scripts/h2py.py /usr/include/bsd/sys/fcntl.h - echo "Adding O_NDELAY and O_SYNC" - echo "O_NDELAY = FNDELAY" >> FCNTL.py - echo "O_SYNC = FSYNC" >> FCNTL.py - python ../../Tools/scripts/h2py.py /usr/include/bsd/sys/socket.h python ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/bsd/netinet/in.h --- 4,6 ---- From fdrake@users.sourceforge.net Thu May 10 16:54:34 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 08:54:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules fcntlmodule.c,2.29,2.30 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv25630/Modules Modified Files: fcntlmodule.c Log Message: Fix the fcntl() docstring so the user is not mis-directed to the FCNTL module for useful constants. Index: fcntlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fcntlmodule.c,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -r2.29 -r2.30 *** fcntlmodule.c 2001/05/09 21:02:02 2.29 --- fcntlmodule.c 2001/05/10 15:54:32 2.30 *************** *** 82,92 **** \n\ Perform the requested operation on file descriptor fd. The operation\n\ ! is defined by op and is operating system dependent. Typically these\n\ ! codes can be retrieved from the library module FCNTL. The argument arg\n\ ! is optional, and defaults to 0; it may be an int or a string. If arg is\n\ ! given as a string, the return value of fcntl is a string of that length,\n\ ! containing the resulting value put in the arg buffer by the operating system.\n\ ! The length of the arg string is not allowed to exceed 1024 bytes. If the arg\n\ ! given is an integer or if none is specified, the result value is an integer\n\ corresponding to the return value of the fcntl call in the C code."; --- 82,92 ---- \n\ Perform the requested operation on file descriptor fd. The operation\n\ ! is defined by op and is operating system dependent. These constants are\n\ ! available from the fcntl module. The argument arg is optional, and\n\ ! defaults to 0; it may be an int or a string. If arg is given as a string,\n\ ! the return value of fcntl is a string of that length, containing the\n\ ! resulting value put in the arg buffer by the operating system.The length\n\ ! of the arg string is not allowed to exceed 1024 bytes. If the arg given\n\ ! is an integer or if none is specified, the result value is an integer\n\ corresponding to the return value of the fcntl call in the C code."; From fdrake@users.sourceforge.net Thu May 10 16:57:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 08:57:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libsignal.tex,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv26174/Doc/lib Modified Files: libsignal.tex Log Message: Update example to no longer use the FCNTL module. Index: libsignal.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsignal.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** libsignal.tex 2000/10/10 17:03:45 1.19 --- libsignal.tex 2001/05/10 15:57:17 1.20 *************** *** 156,160 **** \begin{verbatim} ! import signal, os, FCNTL def handler(signum, frame): --- 156,160 ---- \begin{verbatim} ! import signal, os def handler(signum, frame): *************** *** 167,171 **** # This open() may hang indefinitely ! fd = os.open('/dev/ttyS0', FCNTL.O_RDWR) signal.alarm(0) # Disable the alarm --- 167,171 ---- # This open() may hang indefinitely ! fd = os.open('/dev/ttyS0', os.O_RDWR) signal.alarm(0) # Disable the alarm From gvanrossum@users.sourceforge.net Thu May 10 17:23:21 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 10 May 2001 09:23:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.1.2.4,1.1.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv31148 Modified Files: Tag: descr-branch test_descr.py Log Message: Add tests for subtyping -- in C and Python. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -r1.1.2.4 -r1.1.2.5 *** test_descr.py 2001/05/01 21:04:21 1.1.2.4 --- test_descr.py 2001/05/10 16:23:19 1.1.2.5 *************** *** 196,199 **** --- 196,305 ---- numops(100.0, 3.0) + def spamlists(): + if verbose: print "Testing spamlist operations..." + import copy, spam + def spamlist(l, memo=None): + import spam + sl = spam.list() + for i in l: sl.append(i) + return sl + # This is an ugly hack: + copy._deepcopy_dispatch[spam.SpamListType] = spamlist + + testbinop(spamlist([1]), spamlist([2]), spamlist([1,2]), "a+b", "__add__") + testbinop(spamlist([1,2,3]), 2, 1, "b in a", "__contains__") + testbinop(spamlist([1,2,3]), 4, 0, "b in a", "__contains__") + testbinop(spamlist([1,2,3]), 1, 2, "a[b]", "__getitem__") + testternop(spamlist([1,2,3]), 0, 2, spamlist([1,2]), + "a[b:c]", "__getslice__") + testsetop(spamlist([1]), spamlist([2]), spamlist([1,2]), + "a+=b", "__iadd__") + testsetop(spamlist([1,2]), 3, spamlist([1,2,1,2,1,2]), "a*=b", "__imul__") + testunop(spamlist([1,2,3]), 3, "len(a)", "__len__") + testbinop(spamlist([1,2]), 3, spamlist([1,2,1,2,1,2]), "a*b", "__mul__") + testbinop(spamlist([1]), spamlist([2]), spamlist([2,1]), "b+a", "__radd__") + testbinop(spamlist([1,2]), 3, spamlist([1,2,1,2,1,2]), "b*a", "__rmul__") + testset2op(spamlist([1,2]), 1, 3, spamlist([1,3]), "a[b]=c", "__setitem__") + testset3op(spamlist([1,2,3,4]), 1, 3, spamlist([5,6]), + spamlist([1,5,6,4]), "a[b:c]=d", "__setslice__") + + def spamdicts(): + if verbose: print "Testing spamdict operations..." + import copy, spam + def spamdict(d, memo=None): + import spam + sd = spam.dict() + for k, v in d.items(): sd[k] = v + return sd + # This is an ugly hack: + copy._deepcopy_dispatch[spam.SpamDictType] = spamdict + + testbinop(spamdict({1:2}), spamdict({2:1}), -1, "cmp(a,b)", "__cmp__") + testbinop(spamdict({1:2,3:4}), 1, 1, "b in a", "__contains__") + testbinop(spamdict({1:2,3:4}), 2, 0, "b in a", "__contains__") + testbinop(spamdict({1:2,3:4}), 1, 2, "a[b]", "__getitem__") + d = spamdict({1:2,3:4}) + l1 = [] + for i in d.keys(): l1.append(i) + l = [] + for i in iter(d): l.append(i) + verify(l == l1) + l = [] + for i in d.__iter__(): l.append(i) + verify(l == l1) + l = [] + for i in type(spamdict({})).__iter__(d): l.append(i) + verify(l == l1) + testunop(spamdict({1:2,3:4}), 2, "len(a)", "__len__") + testunop(spamdict({1:2,3:4}), "{3: 4, 1: 2}", "repr(a)", "__repr__") + testset2op(spamdict({1:2,3:4}), 2, 3, spamdict({1:2,2:3,3:4}), + "a[b]=c", "__setitem__") + + DT = type({}) + + def pydicts(): + if verbose: print "Testing Python subclass of dict..." + verify(issubclass(DT, DT)) + verify(isinstance({}, DT)) + d = DT() + verify(d == {}) + verify(d.__class__ is DT) + verify(isinstance(d, DT)) + class C(DT): + def __getitem__(self, key): + return self.get(key, 0) + def __setitem__(self, key, value): + assert isinstance(key, type(0)) + DT.__setitem__(self, key, value) + def setstate(self, state): + self.state = state + def getstate(self): + return self.state + verify(issubclass(C, DT)) + a = C() + try: + a.getstate() + except AttributeError: + pass + else: + raise TestFailed, "undefined getstate() didn't raise AttributeError" + a.setstate(0) + verify(a.state == 0) + verify(a.getstate() == 0) + a.setstate(10) + verify(a.state == 10) + verify(a.getstate() == 10) + verify(a[42] == 0) + a[42] = 24 + verify(a[42] == 24) + if verbose: print "pydict stress test ..." + for i in range(100): + a[i] = C() + for j in range(100): + a[i][j] = i*j + for i in range(100): + for j in range(100): + verify(a[i][j] == i*j) + def all(): lists() *************** *** 202,205 **** --- 308,314 ---- longs() floats() + spamlists() + spamdicts() + pydicts() all() From gvanrossum@users.sourceforge.net Thu May 10 17:37:13 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 10 May 2001 09:37:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects descrobject.c,1.1.2.7,1.1.2.8 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv818 Modified Files: Tag: descr-branch descrobject.c Log Message: Issue more appropriate error when trying to set an attribute described by a wrapper. Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/Attic/descrobject.c,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -r1.1.2.7 -r1.1.2.8 *** descrobject.c 2001/05/01 21:04:21 1.1.2.7 --- descrobject.c 2001/05/10 16:37:11 1.1.2.8 *************** *** 156,164 **** case DF_METHOD: PyErr_Format(PyExc_TypeError, "can't %s method attribute '%.400s' " "of '%.50s' object", value==NULL ? "delete" : "assign to", ! descr->d_union.d_method->ml_name, obj->ob_type->tp_name); return -1; --- 156,165 ---- case DF_METHOD: + case DF_WRAPPER: PyErr_Format(PyExc_TypeError, "can't %s method attribute '%.400s' " "of '%.50s' object", value==NULL ? "delete" : "assign to", ! descr_name(descr), obj->ob_type->tp_name); return -1; From gvanrossum@users.sourceforge.net Thu May 10 17:55:44 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 10 May 2001 09:55:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.14,2.16.8.15 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4368 Modified Files: Tag: descr-branch typeobject.c Log Message: Change to make most class variables act as defaults for instance variables. How: In subtype_setattro(), when a descriptor found in the type's dict has no tp_descr_set slot, allow setting (or deleting) a value in the instance's dict. Also fixed a control flow bug that caused successful deletions of instance variables to raise an error (after deleting the instance variable). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.14 retrieving revision 2.16.8.15 diff -C2 -r2.16.8.14 -r2.16.8.15 *** typeobject.c 2001/05/10 15:33:11 2.16.8.14 --- typeobject.c 2001/05/10 16:55:42 2.16.8.15 *************** *** 184,188 **** assert(tp->tp_dict != NULL && PyDict_Check(tp->tp_dict)); descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr == NULL) { int dictoffset = self->ob_type->tp_members[0].offset; PyObject **dictptr = (PyObject **) ((char *)self + dictoffset); --- 184,188 ---- assert(tp->tp_dict != NULL && PyDict_Check(tp->tp_dict)); descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr == NULL || descr->ob_type->tp_descr_set == NULL) { int dictoffset = self->ob_type->tp_members[0].offset; PyObject **dictptr = (PyObject **) ((char *)self + dictoffset); *************** *** 199,206 **** if (res < 0 && PyErr_ExceptionMatches(PyExc_KeyError)) - { PyErr_SetObject(PyExc_AttributeError, name); ! return -1; ! } } else --- 199,204 ---- if (res < 0 && PyErr_ExceptionMatches(PyExc_KeyError)) PyErr_SetObject(PyExc_AttributeError, name); ! return res; } else From gvanrossum@users.sourceforge.net Thu May 10 18:03:15 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 10 May 2001 10:03:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.1.2.5,1.1.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5813 Modified Files: Tag: descr-branch test_descr.py Log Message: Change the pydicts test to verify that instance variables can shadow class variables. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -r1.1.2.5 -r1.1.2.6 *** test_descr.py 2001/05/10 16:23:19 1.1.2.5 --- test_descr.py 2001/05/10 17:03:13 1.1.2.6 *************** *** 267,270 **** --- 267,271 ---- verify(isinstance(d, DT)) class C(DT): + state = -1 def __getitem__(self, key): return self.get(key, 0) *************** *** 278,287 **** verify(issubclass(C, DT)) a = C() ! try: ! a.getstate() ! except AttributeError: ! pass ! else: ! raise TestFailed, "undefined getstate() didn't raise AttributeError" a.setstate(0) verify(a.state == 0) --- 279,284 ---- verify(issubclass(C, DT)) a = C() ! verify(a.state == -1) ! verify(a.getstate() == -1) a.setstate(0) verify(a.state == 0) From fdrake@users.sourceforge.net Thu May 10 18:16:40 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 10:16:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_weakref.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8233/Lib/test Modified Files: test_weakref.py Log Message: Extend the weakref test suite to cover the complete mapping interface for both weakref.Weak*Dictionary classes. This closes SF bug #416480. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** test_weakref.py 2001/05/02 05:44:22 1.8 --- test_weakref.py 2001/05/10 17:16:38 1.9 *************** *** 293,309 **** for item in dict.iteritems(): items.remove(item) ! self.assert_(len(items) == 0, "iterator did not touch all items") ! # key iterator: keys = dict.keys() for k in dict: keys.remove(k) ! self.assert_(len(keys) == 0, "iterator did not touch all keys") # value iterator: values = dict.values() for v in dict.itervalues(): values.remove(v) ! self.assert_(len(values) == 0, "iterator did not touch all values") def make_weak_keyed_dict(self): --- 293,315 ---- for item in dict.iteritems(): items.remove(item) ! self.assert_(len(items) == 0, "iteritems() did not touch all items") ! # key iterator, via __iter__(): keys = dict.keys() for k in dict: keys.remove(k) ! self.assert_(len(keys) == 0, "__iter__() did not touch all keys") + # key iterator, via iterkeys(): + keys = dict.keys() + for k in dict.iterkeys(): + keys.remove(k) + self.assert_(len(keys) == 0, "iterkeys() did not touch all keys") + # value iterator: values = dict.values() for v in dict.itervalues(): values.remove(v) ! self.assert_(len(values) == 0, "itervalues() did not touch all values") def make_weak_keyed_dict(self): *************** *** 320,323 **** --- 326,380 ---- dict[o.arg] = o return dict, objects + + def check_popitem(self, klass, key1, value1, key2, value2): + weakdict = klass() + weakdict[key1] = value1 + weakdict[key2] = value2 + self.assert_(len(weakdict) == 2) + k, v = weakdict.popitem() + self.assert_(len(weakdict) == 1) + if k is key1: + self.assert_(v is value1) + else: + self.assert_(v is value2) + k, v = weakdict.popitem() + self.assert_(len(weakdict) == 0) + if k is key1: + self.assert_(v is value1) + else: + self.assert_(v is value2) + + def test_weak_valued_dict_popitem(self): + self.check_popitem(weakref.WeakValueDictionary, + "key1", C(), "key2", C()) + + def test_weak_keyed_dict_popitem(self): + self.check_popitem(weakref.WeakKeyDictionary, + C(), "value 1", C(), "value 2") + + def check_setdefault(self, klass, key, value1, value2): + self.assert_(value1 is not value2, + "invalid test" + " -- value parameters must be distinct objects") + weakdict = klass() + o = weakdict.setdefault(key, value1) + self.assert_(o is value1) + self.assert_(weakdict.has_key(key)) + self.assert_(weakdict.get(key) is value1) + self.assert_(weakdict[key] is value1) + + o = weakdict.setdefault(key, value2) + self.assert_(o is value1) + self.assert_(weakdict.has_key(key)) + self.assert_(weakdict.get(key) is value1) + self.assert_(weakdict[key] is value1) + + def test_weak_valued_dict_setdefault(self): + self.check_setdefault(weakref.WeakValueDictionary, + "key", C(), C()) + + def test_weak_keyed_dict_setdefault(self): + self.check_setdefault(weakref.WeakKeyDictionary, + C(), "value 1", "value 2") def check_update(self, klass, dict): From fdrake@users.sourceforge.net Thu May 10 18:22:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 10:22:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libweakref.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv9285/lib Modified Files: libweakref.tex Log Message: Fix typo in weakref.proxy() documentation. This closes SF bug #423087. Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** libweakref.tex 2001/04/11 19:17:11 1.7 --- libweakref.tex 2001/05/10 17:22:17 1.8 *************** *** 63,67 **** referent; this avoids a number of problems related to their fundamentally mutable nature, and prevent their use as dictionary ! keys. \var{callable} is the same as the parameter of the same name to the \function{ref()} function. \end{funcdesc} --- 63,67 ---- referent; this avoids a number of problems related to their fundamentally mutable nature, and prevent their use as dictionary ! keys. \var{callback} is the same as the parameter of the same name to the \function{ref()} function. \end{funcdesc} From fdrake@users.sourceforge.net Thu May 10 18:23:12 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 10:23:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libweakref.tex,1.7,1.7.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv9416/lib Modified Files: Tag: release21-maint libweakref.tex Log Message: Fix typo in weakref.proxy() documentation. This closes SF bug #423087. Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -r1.7 -r1.7.2.1 *** libweakref.tex 2001/04/11 19:17:11 1.7 --- libweakref.tex 2001/05/10 17:23:10 1.7.2.1 *************** *** 63,67 **** referent; this avoids a number of problems related to their fundamentally mutable nature, and prevent their use as dictionary ! keys. \var{callable} is the same as the parameter of the same name to the \function{ref()} function. \end{funcdesc} --- 63,67 ---- referent; this avoids a number of problems related to their fundamentally mutable nature, and prevent their use as dictionary ! keys. \var{callback} is the same as the parameter of the same name to the \function{ref()} function. \end{funcdesc} From fdrake@users.sourceforge.net Thu May 10 19:41:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 11:41:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26424/Lib Modified Files: pydoc.py Log Message: Change some text just a little to avoid font-lock hell. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -r1.38 -r1.39 *** pydoc.py 2001/04/13 15:04:32 1.38 --- pydoc.py 2001/05/10 18:41:02 1.39 *************** *** 1285,1289 **** self.interact() self.output.write(''' ! You're now leaving help and returning to the Python interpreter. If you want to ask for help on a particular object directly from the interpreter, you can type "help(object)". Executing "help('string')" --- 1285,1289 ---- self.interact() self.output.write(''' ! You are now leaving help and returning to the Python interpreter. If you want to ask for help on a particular object directly from the interpreter, you can type "help(object)". Executing "help('string')" From tim_one@users.sourceforge.net Thu May 10 19:58:33 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 10 May 2001 11:58:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.84,2.85 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30666/python/dist/src/Objects Modified Files: dictobject.c Log Message: Repair typo in comment. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.84 retrieving revision 2.85 diff -C2 -r2.84 -r2.85 *** dictobject.c 2001/05/10 08:32:44 2.84 --- dictobject.c 2001/05/10 18:58:31 2.85 *************** *** 1078,1082 **** if (adiff == NULL) { assert(!aval); ! /* Either an error, or a is a subst with the same length so * must be equal. */ --- 1078,1082 ---- if (adiff == NULL) { assert(!aval); ! /* Either an error, or a is a subset with the same length so * must be equal. */ From tim_one@users.sourceforge.net Thu May 10 20:40:32 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 10 May 2001 12:40:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mutants.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6372/python/dist/src/Lib/test Modified Files: test_mutants.py Log Message: Repair typos in comments. Index: test_mutants.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mutants.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_mutants.py 2001/05/10 08:32:44 1.1 --- test_mutants.py 2001/05/10 19:40:30 1.2 *************** *** 4,9 **** # From SF bug #422121: Insecurities in dict comparison. ! # Safety of code doing comparisons has been an historical Python waak spot. ! # The problem is that comparison of structures in written in C *naturally* # wants to hold on to things like the size of the container, or "the # biggest" containee so far, across a traversal of the container; but --- 4,9 ---- # From SF bug #422121: Insecurities in dict comparison. ! # Safety of code doing comparisons has been an historical Python weak spot. ! # The problem is that comparison of structures written in C *naturally* # wants to hold on to things like the size of the container, or "the # biggest" containee so far, across a traversal of the container; but *************** *** 72,78 **** # An artificial hashcode is selected at random so that we don't ! # have any systematic relationship between comparsion outcomes # (based on self.i and other.i) and relative position within the ! # hawh vector (based on hashcode). self.hashcode = random.randrange(1000000000) --- 72,78 ---- # An artificial hashcode is selected at random so that we don't ! # have any systematic relationship between comparison outcomes # (based on self.i and other.i) and relative position within the ! # hash vector (based on hashcode). self.hashcode = random.randrange(1000000000) From tim_one@users.sourceforge.net Thu May 10 21:03:06 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 10 May 2001 13:03:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mmap.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10921/python/dist/src/Lib/test Modified Files: test_mmap.py Log Message: Change test_mmap.py to use test_support.TESTFN instead of hardcoded "foo", and wrap the body in try/finally to ensure TESTFN gets cleaned up no matter what. Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** test_mmap.py 2001/02/09 11:49:24 1.15 --- test_mmap.py 2001/05/10 20:03:04 1.16 *************** *** 1,3 **** ! from test_support import verify import mmap import os, re, sys --- 1,3 ---- ! from test_support import verify, TESTFN, unlink import mmap import os, re, sys *************** *** 8,123 **** "Test mmap module on Unix systems and Windows" ! # Create an mmap'ed file ! f = open('foo', 'w+') ! # Write 2 pages worth of data to the file ! f.write('\0'* PAGESIZE) ! f.write('foo') ! f.write('\0'* (PAGESIZE-3) ) ! ! m = mmap.mmap(f.fileno(), 2 * PAGESIZE) ! f.close() ! ! # Simple sanity checks ! ! print type(m) # SF bug 128713: segfaulted on Linux ! print ' Position of foo:', m.find('foo') / float(PAGESIZE), 'pages' ! verify(m.find('foo') == PAGESIZE) ! ! print ' Length of file:', len(m) / float(PAGESIZE), 'pages' ! verify(len(m) == 2*PAGESIZE) ! ! print ' Contents of byte 0:', repr(m[0]) ! verify(m[0] == '\0') ! print ' Contents of first 3 bytes:', repr(m[0:3]) ! verify(m[0:3] == '\0\0\0') ! ! # Modify the file's content ! print "\n Modifying file's content..." ! m[0] = '3' ! m[PAGESIZE +3: PAGESIZE +3+3]='bar' ! ! # Check that the modification worked ! print ' Contents of byte 0:', repr(m[0]) ! verify(m[0] == '3') ! print ' Contents of first 3 bytes:', repr(m[0:3]) ! verify(m[0:3] == '3\0\0') ! print ' Contents of second page:', repr(m[PAGESIZE-1 : PAGESIZE + 7]) ! verify(m[PAGESIZE-1 : PAGESIZE + 7] == '\0foobar\0') ! ! m.flush() ! ! # Test doing a regular expression match in an mmap'ed file ! match=re.search('[A-Za-z]+', m) ! if match is None: ! print ' ERROR: regex match on mmap failed!' ! else: ! start, end = match.span(0) ! length = end - start ! ! print ' Regex match on mmap (page start, length of match):', ! print start / float(PAGESIZE), length ! ! verify(start == PAGESIZE) ! verify(end == PAGESIZE + 6) ! ! # test seeking around (try to overflow the seek implementation) ! m.seek(0,0) ! print ' Seek to zeroth byte' ! verify(m.tell() == 0) ! m.seek(42,1) ! print ' Seek to 42nd byte' ! verify(m.tell() == 42) ! m.seek(0,2) ! print ' Seek to last byte' ! verify(m.tell() == len(m)) ! ! print ' Try to seek to negative position...' ! try: ! m.seek(-1) ! except ValueError: ! pass ! else: ! verify(0, 'expected a ValueError but did not get it') ! ! print ' Try to seek beyond end of mmap...' ! try: ! m.seek(1,2) ! except ValueError: ! pass ! else: ! verify(0, 'expected a ValueError but did not get it') ! ! print ' Try to seek to negative position...' ! try: ! m.seek(-len(m)-1,2) ! except ValueError: ! pass ! else: ! verify(0, 'expected a ValueError but did not get it') ! ! # Try resizing map ! print ' Attempting resize()' ! try: ! m.resize( 512 ) ! except SystemError: ! # resize() not supported ! # No messages are printed, since the output of this test suite ! # would then be different across platforms. ! pass ! else: ! # resize() is supported ! verify(len(m) == 512, ! "len(m) is %d, but expecting 512" % (len(m),) ) ! # Check that we can no longer seek beyond the new size. try: ! m.seek(513,0) except ValueError: pass else: ! verify(0, 'Could seek beyond the new size') - m.close() - os.unlink("foo") print ' Test passed' --- 8,134 ---- "Test mmap module on Unix systems and Windows" ! # Create a file to be mmap'ed. ! f = open(TESTFN, 'w+') ! try: # unlink TESTFN no matter what ! # Write 2 pages worth of data to the file ! f.write('\0'* PAGESIZE) ! f.write('foo') ! f.write('\0'* (PAGESIZE-3) ) ! ! m = mmap.mmap(f.fileno(), 2 * PAGESIZE) ! f.close() ! ! # Simple sanity checks ! ! print type(m) # SF bug 128713: segfaulted on Linux ! print ' Position of foo:', m.find('foo') / float(PAGESIZE), 'pages' ! verify(m.find('foo') == PAGESIZE) ! ! print ' Length of file:', len(m) / float(PAGESIZE), 'pages' ! verify(len(m) == 2*PAGESIZE) ! ! print ' Contents of byte 0:', repr(m[0]) ! verify(m[0] == '\0') ! print ' Contents of first 3 bytes:', repr(m[0:3]) ! verify(m[0:3] == '\0\0\0') ! ! # Modify the file's content ! print "\n Modifying file's content..." ! m[0] = '3' ! m[PAGESIZE +3: PAGESIZE +3+3]='bar' ! ! # Check that the modification worked ! print ' Contents of byte 0:', repr(m[0]) ! verify(m[0] == '3') ! print ' Contents of first 3 bytes:', repr(m[0:3]) ! verify(m[0:3] == '3\0\0') ! print ' Contents of second page:', repr(m[PAGESIZE-1 : PAGESIZE + 7]) ! verify(m[PAGESIZE-1 : PAGESIZE + 7] == '\0foobar\0') ! ! m.flush() ! ! # Test doing a regular expression match in an mmap'ed file ! match=re.search('[A-Za-z]+', m) ! if match is None: ! print ' ERROR: regex match on mmap failed!' ! else: ! start, end = match.span(0) ! length = end - start ! ! print ' Regex match on mmap (page start, length of match):', ! print start / float(PAGESIZE), length ! ! verify(start == PAGESIZE) ! verify(end == PAGESIZE + 6) ! ! # test seeking around (try to overflow the seek implementation) ! m.seek(0,0) ! print ' Seek to zeroth byte' ! verify(m.tell() == 0) ! m.seek(42,1) ! print ' Seek to 42nd byte' ! verify(m.tell() == 42) ! m.seek(0,2) ! print ' Seek to last byte' ! verify(m.tell() == len(m)) ! ! print ' Try to seek to negative position...' try: ! m.seek(-1) except ValueError: pass else: ! verify(0, 'expected a ValueError but did not get it') ! ! print ' Try to seek beyond end of mmap...' ! try: ! m.seek(1,2) ! except ValueError: ! pass ! else: ! verify(0, 'expected a ValueError but did not get it') ! ! print ' Try to seek to negative position...' ! try: ! m.seek(-len(m)-1,2) ! except ValueError: ! pass ! else: ! verify(0, 'expected a ValueError but did not get it') ! ! # Try resizing map ! print ' Attempting resize()' ! try: ! m.resize( 512 ) ! except SystemError: ! # resize() not supported ! # No messages are printed, since the output of this test suite ! # would then be different across platforms. ! pass ! else: ! # resize() is supported ! verify(len(m) == 512, ! "len(m) is %d, but expecting 512" % (len(m),) ) ! # Check that we can no longer seek beyond the new size. ! try: ! m.seek(513,0) ! except ValueError: ! pass ! else: ! verify(0, 'Could seek beyond the new size') ! ! m.close() ! ! finally: ! try: ! f.close() ! except OSError: ! pass ! try: ! unlink(TESTFN) ! except OSError: ! pass print ' Test passed' From tim_one@users.sourceforge.net Thu May 10 21:18:32 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 10 May 2001 13:18:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mutants.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv13427/python/dist/src/Lib/test Modified Files: test_mutants.py Log Message: Make test_mutants stronger by also adding random keys during comparisons. A Mystery: test_mutants ran amazingly slowly even before dictobject.c "got fixed". I don't have a clue as to why. dict comparison was and remains linear-time in the size of the dicts, and test_mutants only tries 100 dict pairs, of size averaging just 50. So "it should" run in less than an eyeblink; but it takes at least a second on this 800MHz box. Index: test_mutants.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mutants.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_mutants.py 2001/05/10 19:40:30 1.2 --- test_mutants.py 2001/05/10 20:18:30 1.3 *************** *** 42,57 **** # mutate a dict even if mutate is true. If it does decide to mutate a # dict, it picks one of {dict1, dict2} at random, and deletes a random ! # entry from it. def maybe_mutate(): if not mutate: return if random.random() < 0.5: return if random.random() < 0.5: target, keys = dict1, dict1keys else: target, keys = dict2, dict2keys ! if keys: i = random.randrange(len(keys)) key = keys[i] --- 42,72 ---- # mutate a dict even if mutate is true. If it does decide to mutate a # dict, it picks one of {dict1, dict2} at random, and deletes a random ! # entry from it; or, more rarely, adds a random element. def maybe_mutate(): + global mutate if not mutate: return if random.random() < 0.5: return + if random.random() < 0.5: target, keys = dict1, dict1keys else: target, keys = dict2, dict2keys ! ! if random.random() < 0.2: ! # Insert a new key. ! mutate = 0 # disable mutation until key inserted ! while 1: ! newkey = Horrid(random.randrange(100)) ! if newkey not in target: ! break ! target[newkey] = Horrid(random.randrange(100)) ! keys.append(newkey) ! mutate = 1 ! ! elif keys: ! # Delete a key at random. i = random.randrange(len(keys)) key = keys[i] From gvanrossum@users.sourceforge.net Thu May 10 22:12:45 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 10 May 2001 14:12:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include object.h,2.79.2.5,2.79.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv27172 Modified Files: Tag: descr-branch object.h Log Message: Add declaration for PyDynamic_Type; see next checkin to typeobject.c. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.79.2.5 retrieving revision 2.79.2.6 diff -C2 -r2.79.2.5 -r2.79.2.6 *** object.h 2001/05/06 02:31:13 2.79.2.5 --- object.h 2001/05/10 21:12:42 2.79.2.6 *************** *** 285,289 **** extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of most type objects */ ! extern DL_IMPORT(PyTypeObject) PyTurtle_Type; /* The type of PyType_Type */ #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type) --- 285,290 ---- extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of most type objects */ ! extern DL_IMPORT(PyTypeObject) PyDynamicType_Type; /* For dynamic types */ ! extern DL_IMPORT(PyTypeObject) PyTurtle_Type; /* The type of the above two */ #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type) From gvanrossum@users.sourceforge.net Thu May 10 22:15:44 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 10 May 2001 14:15:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.15,2.16.8.16 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv27865 Modified Files: Tag: descr-branch typeobject.c Log Message: Make attributes of subtypes writable, but only for dynamic subtypes derived in Python using a class statement; static subtypes derived in C still have read-only attributes. The __dict__ is a read-only proxy in both cases (because the setattro slot enforces certain invariants that could be broken by changing the __dict__ directly). Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.15 retrieving revision 2.16.8.16 diff -C2 -r2.16.8.15 -r2.16.8.16 *** typeobject.c 2001/05/10 16:55:42 2.16.8.15 --- typeobject.c 2001/05/10 21:15:42 2.16.8.16 *************** *** 97,110 **** assert(PyString_Check(name)); ! if (type->tp_flags & Py_TPFLAGS_HAVE_CLASS) { ! if (type->tp_dict == NULL) { ! if (PyType_InitDict(type) < 0) ! return NULL; ! } ! descr = PyDict_GetItem(type->tp_dict, name); ! if (descr != NULL && PyDescr_IsMethod(descr) && ! (f = descr->ob_type->tp_descr_get) != NULL) ! return (*f)(descr, NULL); ! } if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { --- 97,107 ---- assert(PyString_Check(name)); ! /* Complications: some attributes, like __class__ and __repr__, occur ! in the type's dict as well as in the metatype's dict. The ! descriptor in the type's dict is for attributes of its instances, ! while the descriptor in the metatype's dict is for the attributes ! of the type. Rule: if the descriptor found in the metatype's dict ! describes data, it wins; otherwise anything found in the type's ! dict wins. */ if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { *************** *** 114,118 **** } descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr != NULL && (f = descr->ob_type->tp_descr_get) != NULL) return (*f)(descr, (PyObject *)type); --- 111,115 ---- } descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr != NULL && PyDescr_IsData(descr) && (f = descr->ob_type->tp_descr_get) != NULL) return (*f)(descr, (PyObject *)type); *************** *** 131,134 **** --- 128,138 ---- } + if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { + descr = PyDict_GetItem(tp->tp_dict, name); + if (descr != NULL && + (f = descr->ob_type->tp_descr_get) != NULL) + return (*f)(descr, (PyObject *)type); + } + PyErr_Format(PyExc_AttributeError, "type '%.50s' has no attribute '%.400s'", *************** *** 267,271 **** memset(et, '\0', sizeof(etype)); type = &et->type; ! PyObject_INIT(type, &PyType_Type); type->tp_as_number = &et->as_number; type->tp_as_sequence = &et->as_sequence; --- 271,275 ---- memset(et, '\0', sizeof(etype)); type = &et->type; ! PyObject_INIT(type, &PyDynamicType_Type); type->tp_as_number = &et->as_number; type->tp_as_sequence = &et->as_sequence; *************** *** 313,320 **** return (PyObject *)type; } ! /* Only for dynamic types, created by type_construct() above */ static void ! type_dealloc(PyTypeObject *type) { Py_XDECREF(type->tp_base); --- 317,410 ---- return (PyObject *)type; } + + PyTypeObject PyType_Type = { + PyObject_HEAD_INIT(&PyTurtle_Type) + 0, /* Number of items for varobject */ + "type", /* Name of this type */ + sizeof(PyTypeObject), /* Basic object size */ + 0, /* Item size for varobject */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_compare */ + (reprfunc)type_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)type_call, /* tp_call */ + 0, /* tp_str */ + (getattrofunc)type_getattro, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + "Define the behavior of a particular type of object.", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + type_members, /* tp_members */ + type_getsets, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + (ternaryfunc)type_construct, /* tp_construct */ + }; ! /* Support for dynamic types, created by type_construct() above */ ! ! static int ! dtype_setattro(PyTypeObject *type, PyObject *name, PyObject *value) ! { ! PyTypeObject *tp = type->ob_type; /* Usually == &PyDynamicType_Type */ ! ! assert(PyString_Check(name)); ! ! /* If the metatype has a descriptor this attribute with a ! descr_set slot, use it. This may fail for read-only attrs! */ ! if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { ! PyObject *descr; ! descrsetfunc f; ! if (tp->tp_dict == NULL) { ! if (PyType_InitDict(tp) < 0) ! return -1; ! } ! descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr != NULL && ! (f = descr->ob_type->tp_descr_set) != NULL) ! return (*f)(descr, (PyObject *)type, value); ! } ! ! /* If the type has a dict, store the value in it */ ! if (type->tp_flags & Py_TPFLAGS_HAVE_CLASS) { ! if (type->tp_dict == NULL) { ! if (PyType_InitDict(type) < 0) ! return -1; ! } ! if (value == NULL) { ! int res = PyObject_DelItem(type->tp_dict, name); ! if (res < 0 && ! PyErr_ExceptionMatches(PyExc_KeyError)) ! PyErr_SetObject(PyExc_AttributeError, name); ! return res; ! } ! else ! return PyObject_SetItem(type->tp_dict, name, value); ! } ! ! /* If the type has no dict, so we can't set attributes */ ! PyErr_Format(PyExc_AttributeError, ! "type '%.50s' has no writable attribute '%.400s'", ! type->tp_name, PyString_AS_STRING(name)); ! return -1; ! } ! static void ! dtype_dealloc(PyTypeObject *type) { Py_XDECREF(type->tp_base); *************** *** 323,333 **** } ! PyTypeObject PyType_Type = { PyObject_HEAD_INIT(&PyTurtle_Type) 0, /* Number of items for varobject */ ! "type", /* Name of this type */ sizeof(PyTypeObject), /* Basic object size */ 0, /* Item size for varobject */ ! (destructor)type_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ --- 413,423 ---- } ! PyTypeObject PyDynamicType_Type = { PyObject_HEAD_INIT(&PyTurtle_Type) 0, /* Number of items for varobject */ ! "dynamic-type", /* Name of this type */ sizeof(PyTypeObject), /* Basic object size */ 0, /* Item size for varobject */ ! (destructor)dtype_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ *************** *** 342,346 **** 0, /* tp_str */ (getattrofunc)type_getattro, /* tp_getattro */ ! 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ --- 432,436 ---- 0, /* tp_str */ (getattrofunc)type_getattro, /* tp_getattro */ ! (setattrofunc)dtype_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ From gvanrossum@users.sourceforge.net Thu May 10 22:41:36 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 10 May 2001 14:41:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.16,2.16.8.17 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv414 Modified Files: Tag: descr-branch typeobject.c Log Message: When a dynamic type is called (to create a new instance), after all the C initialization is done, look for an __init__() method and call it if it is defined. Open issues: - Should the args/kwds be passed on to type_call (which passes them on to the base class's tp_construct, which may use or ignore them or complain about them) as well as to __init__? - Currently when there's no __init__ I don't enforce that the argument list is empty. Should I? Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.16 retrieving revision 2.16.8.17 diff -C2 -r2.16.8.16 -r2.16.8.17 *** typeobject.c 2001/05/10 21:15:42 2.16.8.16 --- typeobject.c 2001/05/10 21:41:34 2.16.8.17 *************** *** 142,145 **** --- 142,146 ---- /* Helpers for subtyping */ + static PyObject * subtype_construct(PyObject *self, PyObject *args, PyObject *kwds) *************** *** 359,362 **** --- 360,386 ---- /* Support for dynamic types, created by type_construct() above */ + static PyObject * + dtype_call(PyTypeObject *type, PyObject *args, PyObject *kwds) + { + PyObject *newobj, *init, *res; + + newobj = type_call(type, args, kwds); + if (newobj == NULL) + return NULL; + init = PyObject_GetAttrString(newobj, "__init__"); + if (init == NULL) { + PyErr_Clear(); + return newobj; + } + res = PyObject_Call(init, args, kwds); + Py_DECREF(init); + if (res == NULL) { + Py_DECREF(newobj); + return NULL; + } + Py_DECREF(res); + return newobj; + } + static int dtype_setattro(PyTypeObject *type, PyObject *name, PyObject *value) *************** *** 429,433 **** 0, /* tp_as_mapping */ 0, /* tp_hash */ ! (ternaryfunc)type_call, /* tp_call */ 0, /* tp_str */ (getattrofunc)type_getattro, /* tp_getattro */ --- 453,457 ---- 0, /* tp_as_mapping */ 0, /* tp_hash */ ! (ternaryfunc)dtype_call, /* tp_call */ 0, /* tp_str */ (getattrofunc)type_getattro, /* tp_getattro */ From tim_one@users.sourceforge.net Thu May 10 22:45:21 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 10 May 2001 14:45:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.85,2.86 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31424/python/dist/src/Objects Modified Files: dictobject.c Log Message: Restore dicts' tp_compare slot, and change dict_richcompare to say it doesn't know how to do LE, LT, GE, GT. dict_richcompare can't do the latter any faster than dict_compare can. More importantly, for cmp(dict1, dict2), Python *first* tries rich compares with EQ, LT, and GT one at a time, even if the tp_compare slot is defined, and dict_richcompare called dict_compare for the latter two because it couldn't do them itself. The result was a lot of wasted calls to dict_compare. Now dict_richcompare gives up at once the times Python calls it with LT and GT from try_rich_to_3way_compare(), and dict_compare is called only once (when Python gets around to trying the tp_compare slot). Continued mystery: despite that this cut the number of calls to dict_compare approximately in half in test_mutants.py, the latter still runs amazingly slowly. Running under the debugger doesn't show excessive activity in the dict comparison code anymore, so I'm guessing the culprit is somewhere else -- but where? Perhaps in the element (key/value) comparison code? We clearly spend a lot of time figuring out how to compare things. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.85 retrieving revision 2.86 diff -C2 -r2.85 -r2.86 *** dictobject.c 2001/05/10 18:58:31 2.85 --- dictobject.c 2001/05/10 21:45:19 2.86 *************** *** 1161,1178 **** res = (cmp == (op == Py_EQ)) ? Py_True : Py_False; } ! else { ! cmp = dict_compare((dictobject *)v, (dictobject *)w); ! if (cmp < 0 && PyErr_Occurred()) ! return NULL; ! switch (op) { ! case Py_LT: cmp = cmp < 0; break; ! case Py_LE: cmp = cmp <= 0; break; ! case Py_GT: cmp = cmp > 0; break; ! case Py_GE: cmp = cmp >= 0; break; ! default: ! assert(!"op unexpected"); ! } ! res = cmp ? Py_True : Py_False; ! } Py_INCREF(res); return res; --- 1161,1166 ---- res = (cmp == (op == Py_EQ)) ? Py_True : Py_False; } ! else ! res = Py_NotImplemented; Py_INCREF(res); return res; *************** *** 1542,1546 **** (getattrfunc)dict_getattr, /* tp_getattr */ 0, /* tp_setattr */ ! 0, /* tp_compare */ (reprfunc)dict_repr, /* tp_repr */ 0, /* tp_as_number */ --- 1530,1534 ---- (getattrfunc)dict_getattr, /* tp_getattr */ 0, /* tp_setattr */ ! (cmpfunc)dict_compare, /* tp_compare */ (reprfunc)dict_repr, /* tp_repr */ 0, /* tp_as_number */ From gvanrossum@users.sourceforge.net Thu May 10 22:47:08 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 10 May 2001 14:47:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.1.2.6,1.1.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1787 Modified Files: Tag: descr-branch test_descr.py Log Message: Add test for __init__() in pydict test. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -r1.1.2.6 -r1.1.2.7 *** test_descr.py 2001/05/10 17:03:13 1.1.2.6 --- test_descr.py 2001/05/10 21:47:06 1.1.2.7 *************** *** 268,271 **** --- 268,277 ---- class C(DT): state = -1 + def __init__(self, *a, **kw): + if a: + assert len(a) == 1 + self.state = a[0] + if kw: + for k, v in kw.items(): self[v] = k def __getitem__(self, key): return self.get(key, 0) *************** *** 278,281 **** --- 284,291 ---- return self.state verify(issubclass(C, DT)) + a1 = C(12) + verify(a1.state == 12) + a2 = C(foo=1, bar=2) + verify(a2[1] == 'foo' and a2[2] == 'bar') a = C() verify(a.state == -1) From fdrake@users.sourceforge.net Thu May 10 23:36:15 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 15:36:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/mac libcolorpicker.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory usw-pr-cvs1:/tmp/cvs-serv11522/mac Modified Files: libcolorpicker.tex Log Message: Actually include a synopsis line for the ColorPicker module. Index: libcolorpicker.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libcolorpicker.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** libcolorpicker.tex 2001/04/13 17:37:00 1.2 --- libcolorpicker.tex 2001/05/10 22:36:13 1.3 *************** *** 4,8 **** \declaremodule{extension}{ColorPicker} \platform{Mac} ! \modulesynopsis{} \moduleauthor{Just van Rossum}{just@letterror.com} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} --- 4,8 ---- \declaremodule{extension}{ColorPicker} \platform{Mac} ! \modulesynopsis{Interface to the standard color selection dialog.} \moduleauthor{Just van Rossum}{just@letterror.com} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} From fdrake@users.sourceforge.net Thu May 10 23:37:41 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 15:37:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/mac toolbox.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory usw-pr-cvs1:/tmp/cvs-serv11738/mac Modified Files: toolbox.tex Log Message: Write a better synopsis for the Scrap module, and provide a link to useful documentation on the Scrap Manager. Index: toolbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/toolbox.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** toolbox.tex 2001/04/13 17:37:00 1.2 --- toolbox.tex 2001/05/10 22:37:38 1.3 *************** *** 94,98 **** \declaremodule{standard}{Scrap} \platform{Mac} ! \modulesynopsis{Interface to the Scrap Manager} --- 94,106 ---- \declaremodule{standard}{Scrap} \platform{Mac} ! \modulesynopsis{The Scrap Manager provides basic services for ! implementing cut \&\ paste and clipboard operations.} ! ! \begin{seealso} ! \seetitle[http://developer.apple.com/techpubs/mac/MoreToolbox/MoreToolbox-109.html]{Scrap ! Manager}{Apple's documentation for the Scrap Manager gives ! a lot of useful information about using the Scrap Manager ! in applications.} ! \end{seealso} From fdrake@users.sourceforge.net Fri May 11 02:00:32 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 18:00:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/texinputs python.sty,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory usw-pr-cvs1:/tmp/cvs-serv1409/texinputs Modified Files: python.sty Log Message: Define a new environment, classdesc*, which can be used to document a class without providing any information about the constructor. This should be used for classes which only exist to act as containers rather than as factories for instances. Index: python.sty =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/python.sty,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -r1.74 -r1.75 *** python.sty 2001/04/18 03:08:54 1.74 --- python.sty 2001/05/11 01:00:29 1.75 *************** *** 624,627 **** --- 624,636 ---- }{\end{fulllineitems}} + % \begin{classdesc*}{name} + \newenvironment{classdesc*}[1]{ + % Using \renewcommand doesn't work for this, for unknown reasons: + \global\def\py@thisclass{#1} + \begin{fulllineitems} + \item[\strong{class }\code{\bfcode{#1}}% + \index{#1@{\py@idxcode{#1}} (class in \py@thismodule)}] + }{\end{fulllineitems}} + % \begin{excclassdesc}{name}{constructor args} % but indexes as an exception *************** *** 633,636 **** --- 642,648 ---- \index{#1@{\py@idxcode{#1}} (exception in \py@thismodule)}] }{\end{fulllineitems}} + + % There is no corresponding {excclassdesc*} environment. To describe + % a class exception without parameters, use the {excdesc} environment. From fdrake@users.sourceforge.net Fri May 11 02:00:32 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 18:00:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/perl python.perl,1.100,1.101 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory usw-pr-cvs1:/tmp/cvs-serv1409/perl Modified Files: python.perl Log Message: Define a new environment, classdesc*, which can be used to document a class without providing any information about the constructor. This should be used for classes which only exist to act as containers rather than as factories for instances. Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.100 retrieving revision 1.101 diff -C2 -r1.100 -r1.101 *** python.perl 2001/04/21 05:48:07 1.100 --- python.perl 2001/05/11 01:00:30 1.101 *************** *** 907,910 **** --- 907,921 ---- } + sub do_env_classdescstar{ + local($_) = @_; + $THIS_CLASS = next_argument(); + $idx = make_str_index_entry( + "$THIS_CLASS (class in $THIS_MODULE)" ); + $idx =~ s/ \(.*\)//; + return ("
class $idx\n
" + . $_ + . '
'); + } + sub do_env_excclassdesc{ return handle_classlike_descriptor(@_[0], "exception"); From fdrake@users.sourceforge.net Fri May 11 02:01:14 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 18:01:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/doc doc.tex,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory usw-pr-cvs1:/tmp/cvs-serv1526/doc Modified Files: doc.tex Log Message: Document the new classdesc* environment, and the previously undocumented excclassdesc environment. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -r1.40 -r1.41 *** doc.tex 2001/04/18 05:19:06 1.40 --- doc.tex 2001/05/11 01:01:12 1.41 *************** *** 520,526 **** \end{envdesc} \begin{envdesc}{excdesc}{\p{name}} Describe an exception. This may be either a string exception or ! a class exception. \end{envdesc} --- 520,536 ---- \end{envdesc} + \begin{envdesc}{excclassdesc}{\p{name}\p{constructor parameters}} + Descibe an exception defined by a class. \var{constructor + parameters} should not include the \var{self} parameter or + the parentheses used in the call syntax. To describe an + exception class without describing the parameters to its + constructor, use the \env{excdesc} environment. + \end{envdesc} + \begin{envdesc}{excdesc}{\p{name}} Describe an exception. This may be either a string exception or ! a class exception. In the case of class exceptions, the ! constructor parameters are not described; use \env{excclassdesc} ! to describe an exception class and its constructor. \end{envdesc} *************** *** 546,549 **** --- 556,566 ---- parameters} should not include the \var{self} parameter or the parentheses used in the call syntax. + \end{envdesc} + + \begin{envdesc}{classdesc*}{\p{name}} + Describe a class without describing the constructor. This can + be used to describe classes that are merely containers for + attributes or which should never be instantiated or subclassed + by user code. \end{envdesc} From fdrake@users.sourceforge.net Fri May 11 02:08:15 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 10 May 2001 18:08:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libdifflib.tex,1.5,1.6 libzipfile.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv2566 Modified Files: libdifflib.tex libzipfile.tex Log Message: Replace "\begin{classdesc}{SomeClass}{\unspecified}" with "\begin{classdesc*}{SomeClass}" -- the rendering of \unspecified was identical to \moreargs, so this helps clarify things just a little. Index: libdifflib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdifflib.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** libdifflib.tex 2001/04/10 19:56:09 1.5 --- libdifflib.tex 2001/05/11 01:08:13 1.6 *************** *** 41,45 **** \end{funcdesc} ! \begin{classdesc}{SequenceMatcher}{\unspecified} This is a flexible class for comparing pairs of sequences of any type, so long as the sequence elements are hashable. The basic --- 41,45 ---- \end{funcdesc} ! \begin{classdesc*}{SequenceMatcher} This is a flexible class for comparing pairs of sequences of any type, so long as the sequence elements are hashable. The basic *************** *** 72,75 **** --- 72,77 ---- \subsection{SequenceMatcher Objects \label{sequence-matcher}} + + The \class{SequenceMatcher} class has this constructor: \begin{classdesc}{SequenceMatcher}{\optional{isjunk\optional{, Index: libzipfile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libzipfile.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** libzipfile.tex 2001/05/09 19:57:37 1.9 --- libzipfile.tex 2001/05/11 01:08:13 1.10 *************** *** 26,30 **** \end{excdesc} ! \begin{classdesc}{ZipFile}{\unspecified} The class for reading and writing ZIP files. See ``\citetitle{ZipFile Objects}'' (section \ref{zipfile-objects}) for --- 26,30 ---- \end{excdesc} ! \begin{classdesc*}{ZipFile} The class for reading and writing ZIP files. See ``\citetitle{ZipFile Objects}'' (section \ref{zipfile-objects}) for *************** *** 32,36 **** \end{classdesc} ! \begin{classdesc}{PyZipFile}{\unspecified} Class for creating ZIP archives containing Python libraries. \end{classdesc} --- 32,36 ---- \end{classdesc} ! \begin{classdesc*}{PyZipFile} Class for creating ZIP archives containing Python libraries. \end{classdesc} From tim_one@users.sourceforge.net Fri May 11 04:36:47 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 10 May 2001 20:36:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.130,2.131 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22537/python/dist/src/Objects Modified Files: object.c Log Message: Cosmetic: code under "else" clause was missing indent. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.130 retrieving revision 2.131 diff -C2 -r2.130 -r2.131 *** object.c 2001/05/07 20:53:51 2.130 --- object.c 2001/05/11 03:36:45 2.131 *************** *** 1053,1057 **** return (*v->ob_type->tp_getattro)(v, name); else ! return PyObject_GetAttrString(v, PyString_AS_STRING(name)); } --- 1053,1057 ---- return (*v->ob_type->tp_getattro)(v, name); else ! return PyObject_GetAttrString(v, PyString_AS_STRING(name)); } From fdrake@users.sourceforge.net Fri May 11 15:29:23 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 07:29:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mmap.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14505/Lib/test Modified Files: test_mmap.py Log Message: unlink() would normally be found in the "os" module, so use it from there. Remove unused import of "sys". If the file TESTFN exists before we start, try to remove it. Add spaces around the = in some assignments. Index: test_mmap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mmap.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** test_mmap.py 2001/05/10 20:03:04 1.16 --- test_mmap.py 2001/05/11 14:29:21 1.17 *************** *** 1,5 **** ! from test_support import verify, TESTFN, unlink import mmap ! import os, re, sys PAGESIZE = mmap.PAGESIZE --- 1,5 ---- ! from test_support import verify, TESTFN import mmap ! import os, re PAGESIZE = mmap.PAGESIZE *************** *** 9,12 **** --- 9,14 ---- # Create a file to be mmap'ed. + if os.path.exists(TESTFN): + os.unlink(TESTFN) f = open(TESTFN, 'w+') *************** *** 37,41 **** print "\n Modifying file's content..." m[0] = '3' ! m[PAGESIZE +3: PAGESIZE +3+3]='bar' # Check that the modification worked --- 39,43 ---- print "\n Modifying file's content..." m[0] = '3' ! m[PAGESIZE +3: PAGESIZE +3+3] = 'bar' # Check that the modification worked *************** *** 50,54 **** # Test doing a regular expression match in an mmap'ed file ! match=re.search('[A-Za-z]+', m) if match is None: print ' ERROR: regex match on mmap failed!' --- 52,56 ---- # Test doing a regular expression match in an mmap'ed file ! match = re.search('[A-Za-z]+', m) if match is None: print ' ERROR: regex match on mmap failed!' *************** *** 127,131 **** pass try: ! unlink(TESTFN) except OSError: pass --- 129,133 ---- pass try: ! os.unlink(TESTFN) except OSError: pass From jhylton@users.sourceforge.net Fri May 11 15:48:43 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 11 May 2001 07:48:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.130,2.131 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18860 Modified Files: classobject.c Log Message: Variant of SF patch 423181 For rich comparisons, use instance_getattr2() when possible to avoid the expense of setting an AttributeError. Also intern the name_op[] table and use the interned strings rather than creating a new string and interning it each time through. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.130 retrieving revision 2.131 diff -C2 -r2.130 -r2.131 *** classobject.c 2001/05/05 21:05:01 2.130 --- classobject.c 2001/05/11 14:48:41 2.131 *************** *** 1652,1668 **** /* Map rich comparison operators to their __xx__ namesakes */ ! static char *name_op[] = { ! "__lt__", ! "__le__", ! "__eq__", ! "__ne__", ! "__gt__", ! "__ge__", ! }; static PyObject * half_richcompare(PyObject *v, PyObject *w, int op) { - PyObject *name; PyObject *method; PyObject *args; --- 1652,1685 ---- /* Map rich comparison operators to their __xx__ namesakes */ ! #define NAME_OPS 6 ! static PyObject **name_op = NULL; + static int + init_name_op() + { + int i; + char *_name_op[] = { + "__lt__", + "__le__", + "__eq__", + "__ne__", + "__gt__", + "__ge__", + }; + + name_op = (PyObject **)malloc(sizeof(PyObject *) * NAME_OPS); + if (name_op == NULL) + return -1; + for (i = 0; i < NAME_OPS; ++i) { + name_op[i] = PyString_InternFromString(_name_op[i]); + if (name_op[i] == NULL) + return -1; + } + return 0; + } + static PyObject * half_richcompare(PyObject *v, PyObject *w, int op) { PyObject *method; PyObject *args; *************** *** 1670,1687 **** assert(PyInstance_Check(v)); - - name = PyString_InternFromString(name_op[op]); - if (name == NULL) - return NULL; ! method = PyObject_GetAttr(v, name); ! Py_DECREF(name); ! if (method == NULL) { ! if (!PyErr_ExceptionMatches(PyExc_AttributeError)) return NULL; ! PyErr_Clear(); ! res = Py_NotImplemented; ! Py_INCREF(res); ! return res; } --- 1687,1717 ---- assert(PyInstance_Check(v)); ! if (name_op == NULL) { ! if (init_name_op() < 0) return NULL; ! } ! /* If the instance doesn't define an __getattr__ method, use ! instance_getattr2 directly because it will not set an ! exception on failure. */ ! if (((PyInstanceObject *)v)->in_class->cl_getattr == NULL) { ! method = instance_getattr2((PyInstanceObject *)v, ! name_op[op]); ! if (method == NULL) { ! assert(!PyErr_Occurred()); ! res = Py_NotImplemented; ! Py_INCREF(res); ! return res; ! } ! } else { ! method = PyObject_GetAttr(v, name_op[op]); ! if (method == NULL) { ! if (!PyErr_ExceptionMatches(PyExc_AttributeError)) ! return NULL; ! PyErr_Clear(); ! res = Py_NotImplemented; ! Py_INCREF(res); ! return res; ! } } From fdrake@users.sourceforge.net Fri May 11 16:46:47 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 08:46:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib liburllib2.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv31843 Modified Files: liburllib2.tex Log Message: Markup adjustments to avoid getting junk in the index. Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** liburllib2.tex 2001/03/02 20:39:34 1.2 --- liburllib2.tex 2001/05/11 15:46:45 1.3 *************** *** 116,120 **** protocol names to URLs of proxies. The default is to read the list of proxies from the environment ! variables \envvar{\var{protocol}_proxy}. \end{classdesc} --- 116,120 ---- protocol names to URLs of proxies. The default is to read the list of proxies from the environment ! variables \var{protocol}_proxy. \end{classdesc} *************** *** 339,343 **** \end{methoddesc} ! \begin{methoddesc}[BaseHandler]{\var{protocol}_open}{req} This method is \emph{not} defined in \class{BaseHandler}, but subclasses should define it if they want to handle URLs with the given --- 339,343 ---- \end{methoddesc} ! \begin{methoddescni}[BaseHandler]{\var{protocol}_open}{req} This method is \emph{not} defined in \class{BaseHandler}, but subclasses should define it if they want to handle URLs with the given *************** *** 347,351 **** \class{OpenerDirector}. Return values should be the same as for \method{default_open()}. ! \end{methoddesc} \begin{methoddesc}[BaseHandler]{unknown_open}{req} --- 347,351 ---- \class{OpenerDirector}. Return values should be the same as for \method{default_open()}. ! \end{methoddescni} \begin{methoddesc}[BaseHandler]{unknown_open}{req} *************** *** 411,415 **** \subsection{ProxyHandler Objects \label{proxy-handler}} ! \begin{methoddesc}[ProxyHandler]{\var{protocol}_open}{request} The \class{ProxyHandler} will have a method \method{\var{protocol}_open()} for every \var{protocol} which has a --- 411,415 ---- \subsection{ProxyHandler Objects \label{proxy-handler}} ! \begin{methoddescni}[ProxyHandler]{\var{protocol}_open}{request} The \class{ProxyHandler} will have a method \method{\var{protocol}_open()} for every \var{protocol} which has a *************** *** 418,422 **** \code{request.set_proxy()}, and call the next handler in the chain to actually execute the protocol. ! \end{methoddesc} --- 418,422 ---- \code{request.set_proxy()}, and call the next handler in the chain to actually execute the protocol. ! \end{methoddescni} From fdrake@users.sourceforge.net Fri May 11 16:49:21 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 08:49:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libdifflib.tex,1.6,1.7 libzipfile.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv32722 Modified Files: libdifflib.tex libzipfile.tex Log Message: --sigh-- Finish the last set of changes to these files so the conversion does not break. Index: libdifflib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdifflib.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** libdifflib.tex 2001/05/11 01:08:13 1.6 --- libdifflib.tex 2001/05/11 15:49:19 1.7 *************** *** 59,63 **** expected-case behavior dependent in a complicated way on how many elements the sequences have in common; best case time is linear. ! \end{classdesc} --- 59,63 ---- expected-case behavior dependent in a complicated way on how many elements the sequences have in common; best case time is linear. ! \end{classdesc*} Index: libzipfile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libzipfile.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** libzipfile.tex 2001/05/11 01:08:13 1.10 --- libzipfile.tex 2001/05/11 15:49:19 1.11 *************** *** 30,38 **** ``\citetitle{ZipFile Objects}'' (section \ref{zipfile-objects}) for constructor details. ! \end{classdesc} \begin{classdesc*}{PyZipFile} Class for creating ZIP archives containing Python libraries. ! \end{classdesc} \begin{classdesc}{ZipInfo}{\optional{filename\optional{, date_time}}} --- 30,38 ---- ``\citetitle{ZipFile Objects}'' (section \ref{zipfile-objects}) for constructor details. ! \end{classdesc*} \begin{classdesc*}{PyZipFile} Class for creating ZIP archives containing Python libraries. ! \end{classdesc*} \begin{classdesc}{ZipInfo}{\optional{filename\optional{, date_time}}} From fdrake@users.sourceforge.net Fri May 11 17:10:58 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 09:10:58 -0700 Subject: [Python-checkins] CVS: python/dist/src configure.in,1.217,1.218 config.h.in,2.92,2.93 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv5470 Modified Files: configure.in config.h.in Log Message: Add a check for sys/modem.h, needed by termios on HP-UX. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.217 retrieving revision 1.218 diff -C2 -r1.217 -r1.218 *** configure.in 2001/04/21 17:41:16 1.217 --- configure.in 2001/05/11 16:10:56 1.218 *************** *** 382,386 **** AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h db_185.h db.h \ sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ --- 382,386 ---- AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \ sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ Index: config.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/config.h.in,v retrieving revision 2.92 retrieving revision 2.93 diff -C2 -r2.92 -r2.93 *** config.h.in 2001/04/18 04:37:57 2.92 --- config.h.in 2001/05/11 16:10:56 2.93 *************** *** 591,594 **** --- 591,597 ---- #undef HAVE_SYS_LOCK_H + /* Define if you have the header file. */ + #undef HAVE_SYS_MODEM_H + /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H From fdrake@users.sourceforge.net Fri May 11 17:11:27 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 09:11:27 -0700 Subject: [Python-checkins] CVS: python/dist/src configure,1.209,1.210 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv5660 Modified Files: configure Log Message: the usual... Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.209 retrieving revision 1.210 diff -C2 -r1.209 -r1.210 *** configure 2001/04/21 17:41:16 1.209 --- configure 2001/05/11 16:11:25 1.210 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.216 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.217 # Guess values for system-dependent variables and create Makefiles. *************** *** 1815,1819 **** for ac_hdr in dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h db_185.h db.h \ sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ --- 1815,1819 ---- for ac_hdr in dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \ sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ *************** *** 5107,5111 **** /* Ultrix mips cc rejects this. */ ! typedef int charset[2]; const charset x = {0,0}; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; --- 5107,5111 ---- /* Ultrix mips cc rejects this. */ ! typedef int charset[2]; const charset x; /* SunOS 4.1.1 cc rejects this. */ char const *const *ccp; From fdrake@users.sourceforge.net Fri May 11 17:14:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 09:14:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.27,2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv6239/Modules Modified Files: termios.c Log Message: Include sys/modem.h if we have it; this is needed on HP-UX to provide constants used by other macros from the headers. Conditionalize VREPRINT and VDISCARD; these are not available on HP-UX. This closes bug #417418. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -r2.27 -r2.28 *** termios.c 2001/05/09 20:14:09 2.27 --- termios.c 2001/05/11 16:14:17 2.28 *************** *** 17,20 **** --- 17,28 ---- #endif + /* HP-UX requires that this be included to pick up MDCD, MCTS, MDSR, + * MDTR, MRI, and MRTS (appearantly used internally by some things + * defined as macros; these are not used here directly). + */ + #ifdef HAVE_SYS_MODEM_H + #include + #endif + static char termios__doc__[] = "\ This module provides an interface to the Posix calls for tty I/O control.\n\ *************** *** 529,534 **** --- 537,546 ---- {"VSUSP", VSUSP}, {"VEOL", VEOL}, + #ifndef VREPRINT {"VREPRINT", VREPRINT}, + #endif + #ifndef VDISCARD {"VDISCARD", VDISCARD}, + #endif {"VWERASE", VWERASE}, {"VLNEXT", VLNEXT}, From fdrake@users.sourceforge.net Fri May 11 17:21:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 09:21:08 -0700 Subject: [Python-checkins] CVS: python/dist/src configure.in,1.215,1.215.2.1 config.h.in,2.91,2.91.2.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv7833 Modified Files: Tag: release21-maint configure.in config.h.in Log Message: Add a check for sys/modem.h, needed by termios on HP-UX. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.215 retrieving revision 1.215.2.1 diff -C2 -r1.215 -r1.215.2.1 *** configure.in 2001/04/11 20:56:19 1.215 --- configure.in 2001/05/11 16:21:06 1.215.2.1 *************** *** 382,386 **** AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h db_185.h db.h \ sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ --- 382,386 ---- AC_CHECK_HEADERS(dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \ sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ Index: config.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/config.h.in,v retrieving revision 2.91 retrieving revision 2.91.2.1 diff -C2 -r2.91 -r2.91.2.1 *** config.h.in 2001/04/11 20:56:18 2.91 --- config.h.in 2001/05/11 16:21:06 2.91.2.1 *************** *** 591,594 **** --- 591,597 ---- #undef HAVE_SYS_LOCK_H + /* Define if you have the header file. */ + #undef HAVE_SYS_MODEM_H + /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H From fdrake@users.sourceforge.net Fri May 11 17:34:25 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 09:34:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.24,2.24.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv10999 Modified Files: Tag: release21-maint termios.c Log Message: Migrate the last few revisions from the head to the bugfix branch -- these have all been portability fixes and improving the consistency of how file descriptors and file objects are handled. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.24 retrieving revision 2.24.2.1 diff -C2 -r2.24 -r2.24.2.1 *** termios.c 2001/04/11 20:57:57 2.24 --- termios.c 2001/05/11 16:34:23 2.24.2.1 *************** *** 6,13 **** #include ! /* XXX Some systems need this to get all the symbols, while ! this breaks for others. #include ! */ static char termios__doc__[] = "\ --- 6,27 ---- #include ! #ifdef __osf__ ! /* On OSF, sys/ioctl.h requires that struct termio already be defined, ! * so this needs to be included first on that platform. */ ! #include ! #endif #include ! ! #ifdef __BEOS__ ! #include ! #endif ! ! /* HP-UX requires that this be included to pick up MDCD, MCTS, MDSR, ! * MDTR, MRI, and MRTS (appearantly used internally by some things ! * defined as macros; these are not used here directly). ! */ ! #ifdef HAVE_SYS_MODEM_H ! #include ! #endif static char termios__doc__[] = "\ *************** *** 15,42 **** For a complete description of these calls, see the Posix or Unix manual\n\ pages. It is only available for those Unix versions that support Posix\n\ ! termios style tty I/O control (and then only if configured at installation\n\ ! time).\n\ \n\ All functions in this module take a file descriptor fd as their first\n\ ! argument. This must be an integer file descriptor, such as returned by\n\ ! sys.stdin.fileno()."; ! - #ifdef __BEOS__ - #include - #endif - - #define BAD "bad termios argument" - static PyObject *TermiosError; ! /* termios = tcgetattr(fd) ! termios is ! [iflag, oflag, cflag, lflag, ispeed, ospeed, [cc[0], ..., cc[NCCS]]] ! Return the attributes of the terminal device. */ static char termios_tcgetattr__doc__[] = "\ tcgetattr(fd) -> list_of_attrs\n\ Get the tty attributes for file descriptor fd, as follows:\n\ [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] where cc is a list\n\ --- 29,55 ---- For a complete description of these calls, see the Posix or Unix manual\n\ pages. It is only available for those Unix versions that support Posix\n\ ! termios style tty I/O control.\n\ \n\ All functions in this module take a file descriptor fd as their first\n\ ! argument. This can be an integer file descriptor, such as returned by\n\ ! sys.stdin.fileno(), or a file object, such as sys.stdin itself."; static PyObject *TermiosError; ! static int fdconv(PyObject* obj, void* p) ! { ! int fd; ! fd = PyObject_AsFileDescriptor(obj); ! if (fd >= 0) { ! *(int*)p = fd; ! return 1; ! } ! return 0; ! } static char termios_tcgetattr__doc__[] = "\ tcgetattr(fd) -> list_of_attrs\n\ + \n\ Get the tty attributes for file descriptor fd, as follows:\n\ [iflag, oflag, cflag, lflag, ispeed, ospeed, cc] where cc is a list\n\ *************** *** 58,62 **** char ch; ! if (!PyArg_Parse(args, "i", &fd)) return NULL; --- 71,76 ---- char ch; ! if (!PyArg_ParseTuple(args, "O&:tcgetattr", ! fdconv, (void*)&fd)) return NULL; *************** *** 112,120 **** } - /* tcsetattr(fd, when, termios) - Set the attributes of the terminal device. */ - static char termios_tcsetattr__doc__[] = "\ tcsetattr(fd, when, attributes) -> None\n\ Set the tty attributes for file descriptor fd.\n\ The attributes to be set are taken from the attributes argument, which\n\ --- 126,132 ---- } static char termios_tcsetattr__doc__[] = "\ tcsetattr(fd, when, attributes) -> None\n\ + \n\ Set the tty attributes for file descriptor fd.\n\ The attributes to be set are taken from the attributes argument, which\n\ *************** *** 134,141 **** int i; ! if (!PyArg_Parse(args, "(iiO)", &fd, &when, &term)) return NULL; if (!PyList_Check(term) || PyList_Size(term) != 7) { ! PyErr_SetString(PyExc_TypeError, BAD); return NULL; } --- 146,155 ---- int i; ! if (!PyArg_ParseTuple(args, "O&iO:tcsetattr", ! fdconv, &fd, &when, &term)) return NULL; if (!PyList_Check(term) || PyList_Size(term) != 7) { ! PyErr_SetString(PyExc_TypeError, ! "tcsetattr, arg 3: must be 7 element list"); return NULL; } *************** *** 155,159 **** if (!PyList_Check(cc) || PyList_Size(cc) != NCCS) { ! PyErr_SetString(PyExc_TypeError, BAD); return NULL; } --- 169,175 ---- if (!PyList_Check(cc) || PyList_Size(cc) != NCCS) { ! PyErr_Format(PyExc_TypeError, ! "tcsetattr: attributes[6] must be %d element list", ! NCCS); return NULL; } *************** *** 167,171 **** mode.c_cc[i] = (cc_t) PyInt_AsLong(v); else { ! PyErr_SetString(PyExc_TypeError, BAD); return NULL; } --- 183,188 ---- mode.c_cc[i] = (cc_t) PyInt_AsLong(v); else { ! PyErr_SetString(PyExc_TypeError, ! "tcsetattr: elements of attributes must be characters or integers"); return NULL; } *************** *** 183,194 **** } - /* tcsendbreak(fd, duration) - Generate a break condition. */ - static char termios_tcsendbreak__doc__[] = "\ tcsendbreak(fd, duration) -> None\n\ Send a break on file descriptor fd.\n\ ! A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration \n\ ! has a system dependent meaning. "; static PyObject * --- 200,209 ---- } static char termios_tcsendbreak__doc__[] = "\ tcsendbreak(fd, duration) -> None\n\ + \n\ Send a break on file descriptor fd.\n\ ! A zero duration sends a break for 0.25-0.5 seconds; a nonzero duration\n\ ! has a system dependent meaning."; static PyObject * *************** *** 197,201 **** int fd, duration; ! if (!PyArg_Parse(args, "(ii)", &fd, &duration)) return NULL; if (tcsendbreak(fd, duration) == -1) --- 212,217 ---- int fd, duration; ! if (!PyArg_ParseTuple(args, "O&i:tcsendbreak", ! fdconv, &fd, &duration)) return NULL; if (tcsendbreak(fd, duration) == -1) *************** *** 206,216 **** } - /* tcdrain(fd) - Wait until all queued output to the terminal has been - transmitted. */ - static char termios_tcdrain__doc__[] = "\ tcdrain(fd) -> None\n\ ! Wait until all output written to file descriptor fd has been transmitted. "; static PyObject * --- 222,229 ---- } static char termios_tcdrain__doc__[] = "\ tcdrain(fd) -> None\n\ ! \n\ ! Wait until all output written to file descriptor fd has been transmitted."; static PyObject * *************** *** 219,223 **** int fd; ! if (!PyArg_Parse(args, "i", &fd)) return NULL; if (tcdrain(fd) == -1) --- 232,237 ---- int fd; ! if (!PyArg_ParseTuple(args, "O&:tcdrain", ! fdconv, &fd)) return NULL; if (tcdrain(fd) == -1) *************** *** 228,237 **** } - /* tcflush(fd, queue) - Clear the input and/or output queues associated with - the terminal. */ - static char termios_tcflush__doc__[] = "\ tcflush(fd, queue) -> None\n\ Discard queued data on file descriptor fd.\n\ The queue selector specifies which queue: termios.TCIFLUSH for the input\n\ --- 242,248 ---- } static char termios_tcflush__doc__[] = "\ tcflush(fd, queue) -> None\n\ + \n\ Discard queued data on file descriptor fd.\n\ The queue selector specifies which queue: termios.TCIFLUSH for the input\n\ *************** *** 244,248 **** int fd, queue; ! if (!PyArg_Parse(args, "(ii)", &fd, &queue)) return NULL; if (tcflush(fd, queue) == -1) --- 255,260 ---- int fd, queue; ! if (!PyArg_ParseTuple(args, "O&i:tcflush", ! fdconv, &fd, &queue)) return NULL; if (tcflush(fd, queue) == -1) *************** *** 253,262 **** } - /* tcflow(fd, action) - Perform operations relating to XON/XOFF flow control on - the terminal. */ - static char termios_tcflow__doc__[] = "\ tcflow(fd, action) -> None\n\ Suspend or resume input or output on file descriptor fd.\n\ The action argument can be termios.TCOOFF to suspend output,\n\ --- 265,271 ---- } static char termios_tcflow__doc__[] = "\ tcflow(fd, action) -> None\n\ + \n\ Suspend or resume input or output on file descriptor fd.\n\ The action argument can be termios.TCOOFF to suspend output,\n\ *************** *** 269,273 **** int fd, action; ! if (!PyArg_Parse(args, "(ii)", &fd, &action)) return NULL; if (tcflow(fd, action) == -1) --- 278,283 ---- int fd, action; ! if (!PyArg_ParseTuple(args, "O&i:tcflow", ! fdconv, &fd, &action)) return NULL; if (tcflow(fd, action) == -1) *************** *** 281,295 **** { {"tcgetattr", termios_tcgetattr, ! METH_OLDARGS, termios_tcgetattr__doc__}, {"tcsetattr", termios_tcsetattr, ! METH_OLDARGS, termios_tcsetattr__doc__}, {"tcsendbreak", termios_tcsendbreak, ! METH_OLDARGS, termios_tcsendbreak__doc__}, {"tcdrain", termios_tcdrain, ! METH_OLDARGS, termios_tcdrain__doc__}, {"tcflush", termios_tcflush, ! METH_OLDARGS, termios_tcflush__doc__}, {"tcflow", termios_tcflow, ! METH_OLDARGS, termios_tcflow__doc__}, {NULL, NULL} }; --- 291,305 ---- { {"tcgetattr", termios_tcgetattr, ! METH_VARARGS, termios_tcgetattr__doc__}, {"tcsetattr", termios_tcsetattr, ! METH_VARARGS, termios_tcsetattr__doc__}, {"tcsendbreak", termios_tcsendbreak, ! METH_VARARGS, termios_tcsendbreak__doc__}, {"tcdrain", termios_tcdrain, ! METH_VARARGS, termios_tcdrain__doc__}, {"tcflush", termios_tcflush, ! METH_VARARGS, termios_tcflush__doc__}, {"tcflow", termios_tcflow, ! METH_VARARGS, termios_tcflow__doc__}, {NULL, NULL} }; *************** *** 527,532 **** --- 537,546 ---- {"VSUSP", VSUSP}, {"VEOL", VEOL}, + #ifndef VREPRINT {"VREPRINT", VREPRINT}, + #endif + #ifndef VDISCARD {"VDISCARD", VDISCARD}, + #endif {"VWERASE", VWERASE}, {"VLNEXT", VLNEXT}, From fdrake@users.sourceforge.net Fri May 11 17:35:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 09:35:05 -0700 Subject: [Python-checkins] CVS: python/dist/src configure,1.207,1.207.2.1 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv11184 Modified Files: Tag: release21-maint configure Log Message: the usual... Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.207 retrieving revision 1.207.2.1 diff -C2 -r1.207 -r1.207.2.1 *** configure 2001/04/11 20:56:18 1.207 --- configure 2001/05/11 16:35:03 1.207.2.1 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.215 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.215.2.1 # Guess values for system-dependent variables and create Makefiles. *************** *** 1815,1819 **** for ac_hdr in dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h db_185.h db.h \ sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ --- 1815,1819 ---- for ac_hdr in dlfcn.h fcntl.h limits.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h thread.h unistd.h utime.h termios.h \ ! sys/audioio.h sys/file.h sys/lock.h sys/modem.h db_185.h db.h \ sys/param.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h libutil.h \ From fdrake@users.sourceforge.net Fri May 11 18:01:34 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 10:01:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libfilecmp.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18166/lib Modified Files: libfilecmp.tex Log Message: Add some text to make the dircmp object section more readable, and move some stuff around. Index: libfilecmp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfilecmp.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** libfilecmp.tex 2001/01/18 10:44:08 1.4 --- libfilecmp.tex 2001/05/11 17:01:32 1.5 *************** *** 7,14 **** ! The \module{filecmp} module defines functions to compare files and directories, ! with various optional time/correctness trade-offs. ! The \module{filecmp} module defines the following function: \begin{funcdesc}{cmp}{f1, f2\optional{, shallow\optional{, use_statcache}}} --- 7,14 ---- ! The \module{filecmp} module defines functions to compare files and ! directories, with various optional time/correctness trade-offs. ! The \module{filecmp} module defines the following functions: \begin{funcdesc}{cmp}{f1, f2\optional{, shallow\optional{, use_statcache}}} *************** *** 59,62 **** --- 59,64 ---- \subsection{The \protect\class{dircmp} class \label{dircmp-objects}} + \class{dircmp} instances are built using this constructor: + \begin{classdesc}{dircmp}{a, b\optional{, ignore\optional{, hide}}} Construct a new directory comparison object, to compare the *************** *** 66,69 **** --- 68,73 ---- \end{classdesc} + The \class{dircmp} class provides the following methods: + \begin{methoddesc}[dircmp]{report}{} Print (to \code{sys.stdout}) a comparison between \var{a} and \var{b}. *************** *** 80,83 **** --- 84,96 ---- \end{methoddesc} + + The \class{dircmp} offers a number of interesting attributes that may + be used to get various bits of information about the directory trees + being compared. + + Note that via \method{__getattr__()} hooks, all attributes are + computed lazilly, so there is no speed penalty if only those + attributes which are lightweight to compute are used. + \begin{memberdesc}[dircmp]{left_list} Files and subdirectories in \var{a}, filtered by \var{hide} and *************** *** 133,138 **** \class{dircmp} objects. \end{memberdesc} - - Note that via \method{__getattr__()} hooks, all attributes are - computed lazilly, so there is no speed penalty if only those - attributes which are lightweight to compute are used. --- 146,147 ---- From fdrake@users.sourceforge.net Fri May 11 19:27:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 11:27:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib anydbm.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4611 Modified Files: anydbm.py Log Message: Catch only the relevant exceptions instead of using a bare except clause. Index: anydbm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/anydbm.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** anydbm.py 2001/02/18 03:30:53 1.10 --- anydbm.py 2001/05/11 18:27:00 1.11 *************** *** 46,50 **** class error(Exception): pass ! except: error = "anydbm.error" --- 46,50 ---- class error(Exception): pass ! except (NameError, TypeError): error = "anydbm.error" From fdrake@users.sourceforge.net Fri May 11 19:28:56 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 11:28:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib asyncore.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5164 Modified Files: asyncore.py Log Message: .getsockopt() and .setsockopt() can only raise socket.error, so only catch that specific exception. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** asyncore.py 2001/05/10 15:33:31 1.13 --- asyncore.py 2001/05/11 18:28:54 1.14 *************** *** 267,271 **** self.socket.getsockopt (socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1 ) ! except: pass --- 267,271 ---- self.socket.getsockopt (socket.SOL_SOCKET, socket.SO_REUSEADDR) | 1 ) ! except socket.error: pass From fdrake@users.sourceforge.net Fri May 11 19:45:54 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 11:45:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib htmllib.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv8989 Modified Files: htmllib.py Log Message: int() of a string is only expected to through ValueError, so do not use a bare except clause. Index: htmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/htmllib.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** htmllib.py 2001/02/09 08:21:17 1.17 --- htmllib.py 2001/05/11 18:45:52 1.18 *************** *** 363,370 **** if attrname == 'width': try: width = int(value) ! except: pass if attrname == 'height': try: height = int(value) ! except: pass self.handle_image(src, alt, ismap, align, width, height) --- 363,370 ---- if attrname == 'width': try: width = int(value) ! except ValueError: pass if attrname == 'height': try: height = int(value) ! except ValueError: pass self.handle_image(src, alt, ismap, align, width, height) From fdrake@users.sourceforge.net Fri May 11 19:47:56 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 11:47:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib mailcap.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv9559 Modified Files: mailcap.py Log Message: Opening a file for reading can raise IOError, so only catch that. Index: mailcap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mailcap.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** mailcap.py 2001/02/09 10:23:55 1.9 --- mailcap.py 2001/05/11 18:47:54 1.10 *************** *** 21,25 **** try: fp = open(mailcap, 'r') ! except: continue morecaps = readmailcapfile(fp) --- 21,25 ---- try: fp = open(mailcap, 'r') ! except IOError: continue morecaps = readmailcapfile(fp) From fdrake@users.sourceforge.net Fri May 11 20:14:53 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 12:14:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib chunk.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv16345 Modified Files: chunk.py Log Message: Clean up bare except: when determining whether a file is seekable. Index: chunk.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/chunk.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** chunk.py 2001/04/15 12:40:13 1.10 --- chunk.py 2001/05/11 19:14:51 1.11 *************** *** 71,75 **** try: self.offset = self.file.tell() ! except: self.seekable = 0 else: --- 71,75 ---- try: self.offset = self.file.tell() ! except (AttributeError, IOError): self.seekable = 0 else: *************** *** 159,163 **** self.size_read = self.size_read + n return ! except: pass while self.size_read < self.chunksize: --- 159,163 ---- self.size_read = self.size_read + n return ! except IOError: pass while self.size_read < self.chunksize: From fdrake@users.sourceforge.net Fri May 11 20:15:48 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 12:15:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pty.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv16496 Modified Files: pty.py Log Message: Clean up bare except where only IOError makes sense. Index: pty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pty.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** pty.py 2001/05/10 05:17:02 1.8 --- pty.py 2001/05/11 19:15:28 1.9 *************** *** 148,151 **** try: _copy(master_fd, master_read, stdin_read) ! except: tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) --- 148,151 ---- try: _copy(master_fd, master_read, stdin_read) ! except IOError: tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) From fdrake@users.sourceforge.net Fri May 11 20:20:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 12:20:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pre.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv17963 Modified Files: pre.py Log Message: Clean up a bare except where we only expect to catch pcre.error. Index: pre.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pre.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** pre.py 2001/03/10 09:33:14 1.9 --- pre.py 2001/05/11 19:20:17 1.10 *************** *** 365,369 **** try: repl = pcre_expand(_Dummy, repl) ! except: m = MatchObject(self, source, 0, end, []) repl = lambda m, repl=repl, expand=pcre_expand: expand(m, repl) --- 365,369 ---- try: repl = pcre_expand(_Dummy, repl) ! except error: m = MatchObject(self, source, 0, end, []) repl = lambda m, repl=repl, expand=pcre_expand: expand(m, repl) From fdrake@users.sourceforge.net Fri May 11 20:21:43 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 12:21:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pstats.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv18257 Modified Files: pstats.py Log Message: When guarding an import, only catch ImportError. Index: pstats.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pstats.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** pstats.py 2001/04/26 07:32:38 1.16 --- pstats.py 2001/05/11 19:21:41 1.17 *************** *** 534,538 **** try: import readline ! except: pass --- 534,538 ---- try: import readline ! except ImportError: pass From fdrake@users.sourceforge.net Fri May 11 20:25:10 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 12:25:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib formatter.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv19190 Modified Files: formatter.py Log Message: Remove a bare try/except completely -- it just did not make sense! Add a comment elsewhere making clear an assumption in the code. Index: formatter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/formatter.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** formatter.py 2001/02/09 10:58:30 1.17 --- formatter.py 2001/05/11 19:25:08 1.18 *************** *** 114,129 **** label = '' for c in format: ! try: ! if c == '1': ! label = label + ('%d' % counter) ! elif c in 'aA': ! if counter > 0: ! label = label + self.format_letter(c, counter) ! elif c in 'iI': ! if counter > 0: ! label = label + self.format_roman(c, counter) ! else: ! label = label + c ! except: label = label + c return label --- 114,126 ---- label = '' for c in format: ! if c == '1': ! label = label + ('%d' % counter) ! elif c in 'aA': ! if counter > 0: ! label = label + self.format_letter(c, counter) ! elif c in 'iI': ! if counter > 0: ! label = label + self.format_roman(c, counter) ! else: label = label + c return label *************** *** 133,136 **** --- 130,136 ---- while counter > 0: counter, x = divmod(counter-1, 26) + # This makes a strong assumption that lowercase letters + # and uppercase letters form two contiguous blocks, with + # letters in order! s = chr(ord(case) + x) label = s + label From fdrake@users.sourceforge.net Fri May 11 20:40:12 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 12:40:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/webchecker wsgui.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/webchecker In directory usw-pr-cvs1:/tmp/cvs-serv23047 Modified Files: wsgui.py Log Message: Only catch NameError and TypeError when attempting to subclass an exception (for compatibility with old versions of Python). Index: wsgui.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/wsgui.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** wsgui.py 1999/11/17 15:13:21 1.4 --- wsgui.py 2001/05/11 19:40:10 1.5 *************** *** 23,27 **** class Canceled(Exception): "Exception used to cancel run()." ! except: Canceled = __name__ + ".Canceled" --- 23,27 ---- class Canceled(Exception): "Exception used to cancel run()." ! except (NameError, TypeError): Canceled = __name__ + ".Canceled" From fdrake@users.sourceforge.net Fri May 11 20:44:57 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 12:44:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Demo/tix tixwidgets.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/tix In directory usw-pr-cvs1:/tmp/cvs-serv24090/tix Modified Files: tixwidgets.py Log Message: [].index() raises ValueError if the value is not in the list, so only catch that instead of using a bare except clause. Index: tixwidgets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tix/tixwidgets.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** tixwidgets.py 2001/03/21 07:42:07 1.1 --- tixwidgets.py 2001/05/11 19:44:55 1.2 *************** *** 295,299 **** try: i = states.index(demo_spintxt.get()) ! except: return states[0] return states[i] --- 295,299 ---- try: i = states.index(demo_spintxt.get()) ! except ValueError: return states[0] return states[i] From fdrake@users.sourceforge.net Fri May 11 20:52:05 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 12:52:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Demo/tix/samples Control.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/tix/samples In directory usw-pr-cvs1:/tmp/cvs-serv25848/tix/samples Modified Files: Control.py Log Message: [].index() raises ValueError if the value is not in the list, so only catch that instead of using a bare except clause. Index: Control.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/tix/samples/Control.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Control.py 2001/03/21 07:42:07 1.1 --- Control.py 2001/05/11 19:52:03 1.2 *************** *** 87,91 **** try: i = maker_list.index(demo_maker.get()) ! except: # Works here though. Why ? Beats me. return maker_list[0] --- 87,91 ---- try: i = maker_list.index(demo_maker.get()) ! except ValueError: # Works here though. Why ? Beats me. return maker_list[0] From fdrake@users.sourceforge.net Fri May 11 20:52:59 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 12:52:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib zipfile.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26077/Lib Modified Files: zipfile.py Log Message: Fix one bare except: clause. Index: zipfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/zipfile.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** zipfile.py 2001/04/14 16:45:14 1.13 --- zipfile.py 2001/05/11 19:52:57 1.14 *************** *** 82,86 **** if endrec[0:4] == "PK\005\006" and endrec[-2:] == "\000\000": return 1 # file has correct magic number ! except: pass --- 82,86 ---- if endrec[0:4] == "PK\005\006" and endrec[-2:] == "\000\000": return 1 # file has correct magic number ! except IOError: pass From gvanrossum@users.sourceforge.net Fri May 11 20:58:20 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 11 May 2001 12:58:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include object.h,2.79.2.6,2.79.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv27059 Modified Files: Tag: descr-branch object.h Log Message: Add tp_dictoffset slot -- the offset to the object's __dict__, if it has one. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.79.2.6 retrieving revision 2.79.2.7 diff -C2 -r2.79.2.6 -r2.79.2.7 *** object.h 2001/05/10 21:12:42 2.79.2.6 --- object.h 2001/05/11 19:58:18 2.79.2.7 *************** *** 267,270 **** --- 267,271 ---- descrsetfunc tp_descr_set; ternaryfunc tp_construct; + long tp_dictoffset; From gvanrossum@users.sourceforge.net Fri May 11 21:00:26 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 11 May 2001 13:00:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.124.4.9,2.124.4.10 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv27442 Modified Files: Tag: descr-branch object.c Log Message: Make PyGeneric_{Get,Set}Attr honor the tp_dictoffset slot, if set. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.4.9 retrieving revision 2.124.4.10 diff -C2 -r2.124.4.9 -r2.124.4.10 *** object.c 2001/05/10 15:21:28 2.124.4.9 --- object.c 2001/05/11 20:00:24 2.124.4.10 *************** *** 1082,1085 **** --- 1082,1086 ---- PyObject *descr; descrgetfunc f; + int dictoffset; if (tp->tp_dict == NULL) { *************** *** 1087,1098 **** return NULL; } descr = PyDict_GetItem(tp->tp_dict, name); if (descr != NULL) { f = descr->ob_type->tp_descr_get; ! if (f != NULL) ! return (*f)(descr, obj); Py_INCREF(descr); return descr; } PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", --- 1088,1120 ---- return NULL; } + descr = PyDict_GetItem(tp->tp_dict, name); + f = NULL; if (descr != NULL) { f = descr->ob_type->tp_descr_get; ! if (f != NULL && PyDescr_IsData(descr)) ! return f(descr, obj); ! } ! ! dictoffset = tp->tp_dictoffset; ! if (dictoffset != 0) { ! PyObject *dict = * (PyObject **) ((char *)obj + dictoffset); ! if (dict != NULL) { ! PyObject *res = PyDict_GetItem(dict, name); ! if (res != NULL) { ! Py_INCREF(res); ! return res; ! } ! } ! } ! ! if (f != NULL) ! return f(descr, obj); ! ! if (descr != NULL) { Py_INCREF(descr); return descr; } + PyErr_Format(PyExc_AttributeError, "'%.50s' object has no attribute '%.400s'", *************** *** 1107,1110 **** --- 1129,1133 ---- PyObject *descr; descrsetfunc f; + int dictoffset; if (tp->tp_dict == NULL) { *************** *** 1113,1116 **** --- 1136,1171 ---- } descr = PyDict_GetItem(tp->tp_dict, name); + f = NULL; + if (descr != NULL) { + f = descr->ob_type->tp_descr_set; + if (f != NULL && PyDescr_IsData(descr)) + return f(descr, obj, value); + } + + dictoffset = tp->tp_dictoffset; + if (dictoffset != 0) { + PyObject **dictptr = (PyObject **) ((char *)obj + dictoffset); + PyObject *dict = *dictptr; + if (dict == NULL && value != NULL) { + dict = PyDict_New(); + if (dict == NULL) + return -1; + *dictptr = dict; + } + if (dict != NULL) { + int res; + if (value == NULL) + res = PyDict_DelItem(dict, name); + else + res = PyDict_SetItem(dict, name, value); + if (res < 0 && PyErr_ExceptionMatches(PyExc_KeyError)) + PyErr_SetObject(PyExc_AttributeError, name); + return res; + } + } + + if (f != NULL) + return f(descr, obj, value); + if (descr == NULL) { PyErr_Format(PyExc_AttributeError, *************** *** 1119,1124 **** return -1; } ! if ((f = descr->ob_type->tp_descr_set) != NULL) ! return (*f)(descr, obj, value); PyErr_Format(PyExc_AttributeError, "'%.50s' object attribute '%.400s' is read-only", --- 1174,1178 ---- return -1; } ! PyErr_Format(PyExc_AttributeError, "'%.50s' object attribute '%.400s' is read-only", From fdrake@users.sourceforge.net Fri May 11 21:12:28 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 11 May 2001 13:12:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.142,1.143 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30292/Modules Modified Files: socketmodule.c Log Message: Fix a minor style consistency issue. When getting a string buffer for a string we just created, use PyString_AS_STRING() instead of PyString_AsString() to avoid the call overhead and extra type check. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -r1.142 -r1.143 *** socketmodule.c 2001/05/09 19:11:33 1.142 --- socketmodule.c 2001/05/11 20:12:26 1.143 *************** *** 963,968 **** #ifdef __BEOS__ ! /* We have incomplete socket support. */ ! PyErr_SetString( PySocket_Error, "getsockopt not supported" ); return NULL; #else --- 963,968 ---- #ifdef __BEOS__ ! /* We have incomplete socket support. */ ! PyErr_SetString(PySocket_Error, "getsockopt not supported"); return NULL; #else *************** *** 990,994 **** return NULL; res = getsockopt(s->sock_fd, level, optname, ! (void *)PyString_AsString(buf), &buflen); if (res < 0) { Py_DECREF(buf); --- 990,994 ---- return NULL; res = getsockopt(s->sock_fd, level, optname, ! (void *)PyString_AS_STRING(buf), &buflen); if (res < 0) { Py_DECREF(buf); From gvanrossum@users.sourceforge.net Fri May 11 21:12:30 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 11 May 2001 13:12:30 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.17,2.16.8.18 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30275 Modified Files: Tag: descr-branch typeobject.c Log Message: Use the new tp_dictoffset slot. Be more careful about how and when to add a __dict__ slot to a new subtype, and DECREF __dict__ properly on dealloc of an object. No longer define type_getattro and dtype_setattro -- PyGeneric{Set,Get}Attr are now up to this job. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.17 retrieving revision 2.16.8.18 diff -C2 -r2.16.8.17 -r2.16.8.18 *** typeobject.c 2001/05/10 21:41:34 2.16.8.17 --- typeobject.c 2001/05/11 20:12:27 2.16.8.18 *************** *** 5,8 **** --- 5,10 ---- #include "structmember.h" + staticforward int add_members(PyTypeObject *, struct memberlist *); + struct memberlist type_members[] = { {"__name__", T_STRING, offsetof(PyTypeObject, tp_name), READONLY}, *************** *** 88,144 **** } - static PyObject * - type_getattro(PyTypeObject *type, PyObject *name) - { - PyTypeObject *tp = type->ob_type; /* Usually == &PyType_Type below */ - PyObject *descr; - descrgetfunc f; - - assert(PyString_Check(name)); - - /* Complications: some attributes, like __class__ and __repr__, occur - in the type's dict as well as in the metatype's dict. The - descriptor in the type's dict is for attributes of its instances, - while the descriptor in the metatype's dict is for the attributes - of the type. Rule: if the descriptor found in the metatype's dict - describes data, it wins; otherwise anything found in the type's - dict wins. */ - - if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { - if (tp->tp_dict == NULL) { - if (PyType_InitDict(tp) < 0) - return NULL; - } - descr = PyDict_GetItem(tp->tp_dict, name); - if (descr != NULL && PyDescr_IsData(descr) && - (f = descr->ob_type->tp_descr_get) != NULL) - return (*f)(descr, (PyObject *)type); - } - - if (type->tp_flags & Py_TPFLAGS_HAVE_CLASS) { - descr = PyDict_GetItem(type->tp_dict, name); - if (descr != NULL) { - f = descr->ob_type->tp_descr_get; - if (f != NULL) - return (*f)(descr, NULL); - /* Not a descriptor -- a plain value */ - Py_INCREF(descr); - return descr; - } - } - - if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { - descr = PyDict_GetItem(tp->tp_dict, name); - if (descr != NULL && - (f = descr->ob_type->tp_descr_get) != NULL) - return (*f)(descr, (PyObject *)type); - } - - PyErr_Format(PyExc_AttributeError, - "type '%.50s' has no attribute '%.400s'", - type->tp_name, PyString_AS_STRING(name)); - return NULL; - } - /* Helpers for subtyping */ --- 90,93 ---- *************** *** 162,214 **** subtype_dealloc(PyObject *self) { ! self->ob_type->tp_base->tp_dealloc(self); ! Py_DECREF(self->ob_type); ! } ! ! static PyObject * ! subtype_getattro(PyObject *self, PyObject *name) ! { ! int dictoffset = self->ob_type->tp_members[0].offset; ! PyObject *dict = * (PyObject **) ((char *)self + dictoffset); ! ! if (dict != NULL) { ! PyObject *res = PyObject_GetItem(dict, name); ! if (res != NULL) ! return res; ! PyErr_Clear(); ! } ! return PyGeneric_GetAttr(self, name); ! } ! ! static int ! subtype_setattro(PyObject *self, PyObject *name, PyObject *value) ! { ! PyTypeObject *tp = self->ob_type; ! PyObject *descr; ! ! assert(tp->tp_dict != NULL && PyDict_Check(tp->tp_dict)); ! descr = PyDict_GetItem(tp->tp_dict, name); ! if (descr == NULL || descr->ob_type->tp_descr_set == NULL) { ! int dictoffset = self->ob_type->tp_members[0].offset; PyObject **dictptr = (PyObject **) ((char *)self + dictoffset); PyObject *dict = *dictptr; ! ! if (dict == NULL) { ! dict = PyDict_New(); ! if (dict == NULL) ! return -1; ! *dictptr = dict; ! } ! if (value == NULL) { ! int res = PyObject_DelItem(dict, name); ! if (res < 0 && ! PyErr_ExceptionMatches(PyExc_KeyError)) ! PyErr_SetObject(PyExc_AttributeError, name); ! return res; } - else - return PyObject_SetItem(dict, name, value); } ! return PyGeneric_SetAttr(self, name, value); } --- 111,125 ---- subtype_dealloc(PyObject *self) { ! int dictoffset = self->ob_type->tp_dictoffset; ! if (dictoffset && !self->ob_type->tp_base->tp_dictoffset) { PyObject **dictptr = (PyObject **) ((char *)self + dictoffset); PyObject *dict = *dictptr; ! if (dict != NULL) { ! Py_DECREF(dict); ! *dictptr = NULL; } } ! self->ob_type->tp_base->tp_dealloc(self); ! Py_DECREF(self->ob_type); } *************** *** 238,241 **** --- 149,153 ---- struct memberlist *mp; + /* Check arguments */ if (type != NULL) { PyErr_SetString(PyExc_TypeError, *************** *** 267,270 **** --- 179,184 ---- return NULL; } + + /* Allocate memory and construct a type object in it */ et = PyObject_MALLOC(sizeof(etype) + strlen(name)); if (et == NULL) *************** *** 279,312 **** type->tp_name = strcpy(et->name, name); type->tp_flags = Py_TPFLAGS_DEFAULT; Py_INCREF(base); type->tp_base = base; ! if (base->tp_construct) type->tp_construct = subtype_construct; ! if (base->tp_dealloc) type->tp_dealloc = subtype_dealloc; ! if (base->tp_getattro == NULL || ! base->tp_getattro == PyGeneric_GetAttr) { ! type->tp_getattro = subtype_getattro; type->tp_getattr = NULL; } ! if (base->tp_setattro == NULL || ! base->tp_setattro == PyGeneric_SetAttr) { ! type->tp_setattro = subtype_setattro; type->tp_setattr = NULL; } - - type->tp_members = mp = et->members; - mp->name = "__dict__"; - mp->type = T_OBJECT; - mp->offset = base->tp_basicsize - ((base->tp_flags & Py_TPFLAGS_GC) - ? PyGC_HEAD_SIZE : 0); - mp->readonly = 1; - assert(mp+1 <= &et->members[NMEMBERS]); ! if (PyType_InitDict(type) < 0) { ! Py_DECREF(type); ! return NULL; } ! type->tp_basicsize += sizeof(PyObject *); /* for __dict__ */ x = PyObject_CallMethod(type->tp_dict, "update", "O", dict); if (x == NULL) { --- 193,236 ---- type->tp_name = strcpy(et->name, name); type->tp_flags = Py_TPFLAGS_DEFAULT; + + /* Copy slots and dict from the base type */ Py_INCREF(base); type->tp_base = base; ! if (PyType_InitDict(type) < 0) { ! Py_DECREF(type); ! return NULL; ! } ! ! /* Override some slots with specific requirements */ ! if (type->tp_construct) type->tp_construct = subtype_construct; ! if (type->tp_dealloc) type->tp_dealloc = subtype_dealloc; ! if (type->tp_getattro == NULL) { ! type->tp_getattro = PyGeneric_GetAttr; type->tp_getattr = NULL; } ! if (type->tp_setattro == NULL) { ! type->tp_setattro = PyGeneric_SetAttr; type->tp_setattr = NULL; } ! /* Add a __dict__ slot if we don't already have one, ! but only if the getattro is generic */ ! if (type->tp_dictoffset == 0 && ! type->tp_setattro == PyGeneric_SetAttr) { ! int dictoffset = type->tp_basicsize; ! if (type->tp_flags & Py_TPFLAGS_GC) ! dictoffset -= PyGC_HEAD_SIZE; ! type->tp_dictoffset = dictoffset; ! type->tp_basicsize += sizeof(PyObject *); ! mp = et->members; ! mp->name = "__dict__"; ! mp->type = T_OBJECT; ! mp->offset = dictoffset; ! mp->readonly = 1; ! add_members(type, mp); } ! x = PyObject_CallMethod(type->tp_dict, "update", "O", dict); if (x == NULL) { *************** *** 337,341 **** (ternaryfunc)type_call, /* tp_call */ 0, /* tp_str */ ! (getattrofunc)type_getattro, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 261,265 ---- (ternaryfunc)type_call, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ *************** *** 356,359 **** --- 280,284 ---- 0, /* tp_descr_set */ (ternaryfunc)type_construct, /* tp_construct */ + offsetof(PyTypeObject, tp_dict), /* tp_dictoffset */ }; *************** *** 383,432 **** } - static int - dtype_setattro(PyTypeObject *type, PyObject *name, PyObject *value) - { - PyTypeObject *tp = type->ob_type; /* Usually == &PyDynamicType_Type */ - - assert(PyString_Check(name)); - - /* If the metatype has a descriptor this attribute with a - descr_set slot, use it. This may fail for read-only attrs! */ - if (tp->tp_flags & Py_TPFLAGS_HAVE_CLASS) { - PyObject *descr; - descrsetfunc f; - if (tp->tp_dict == NULL) { - if (PyType_InitDict(tp) < 0) - return -1; - } - descr = PyDict_GetItem(tp->tp_dict, name); - if (descr != NULL && - (f = descr->ob_type->tp_descr_set) != NULL) - return (*f)(descr, (PyObject *)type, value); - } - - /* If the type has a dict, store the value in it */ - if (type->tp_flags & Py_TPFLAGS_HAVE_CLASS) { - if (type->tp_dict == NULL) { - if (PyType_InitDict(type) < 0) - return -1; - } - if (value == NULL) { - int res = PyObject_DelItem(type->tp_dict, name); - if (res < 0 && - PyErr_ExceptionMatches(PyExc_KeyError)) - PyErr_SetObject(PyExc_AttributeError, name); - return res; - } - else - return PyObject_SetItem(type->tp_dict, name, value); - } - - /* If the type has no dict, so we can't set attributes */ - PyErr_Format(PyExc_AttributeError, - "type '%.50s' has no writable attribute '%.400s'", - type->tp_name, PyString_AS_STRING(name)); - return -1; - } - static void dtype_dealloc(PyTypeObject *type) --- 308,311 ---- *************** *** 455,460 **** (ternaryfunc)dtype_call, /* tp_call */ 0, /* tp_str */ ! (getattrofunc)type_getattro, /* tp_getattro */ ! (setattrofunc)dtype_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ --- 334,339 ---- (ternaryfunc)dtype_call, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ ! PyGeneric_SetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ *************** *** 474,477 **** --- 353,357 ---- 0, /* tp_descr_set */ (ternaryfunc)type_construct, /* tp_construct */ + offsetof(PyTypeObject, tp_dict), /* tp_dictoffset */ }; *************** *** 524,528 **** (ternaryfunc)turtle_call, /* tp_call */ 0, /* tp_str */ ! (getattrofunc)type_getattro, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ --- 404,408 ---- (ternaryfunc)turtle_call, /* tp_call */ 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ *************** *** 540,543 **** --- 420,427 ---- &PyType_Type, /* tp_base */ 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_construct */ + offsetof(PyTypeObject, tp_dict), /* tp_dictoffset */ }; *************** *** 782,785 **** --- 666,670 ---- COPYSLOT(tp_descr_set); COPYSLOT(tp_construct); + COPYSLOT(tp_dictoffset); } From gvanrossum@users.sourceforge.net Fri May 11 21:14:10 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 11 May 2001 13:14:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects moduleobject.c,2.31,2.31.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30890 Modified Files: Tag: descr-branch moduleobject.c Log Message: Now that we have tp_dictoffset, we don't need module_getattr and module_setattr any more. Yay! Index: moduleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/moduleobject.c,v retrieving revision 2.31 retrieving revision 2.31.6.1 diff -C2 -r2.31 -r2.31.6.1 *** moduleobject.c 2001/01/02 15:58:27 2.31 --- moduleobject.c 2001/05/11 20:14:07 2.31.6.1 *************** *** 3,6 **** --- 3,7 ---- #include "Python.h" + #include "structmember.h" typedef struct { *************** *** 9,12 **** --- 10,18 ---- } PyModuleObject; + struct memberlist module_members[] = { + {"__dict__", T_OBJECT, offsetof(PyModuleObject, md_dict), READONLY}, + {0} + }; + PyObject * PyModule_New(char *name) *************** *** 162,217 **** } - static PyObject * - module_getattr(PyModuleObject *m, char *name) - { - PyObject *res; - char* modname; - if (strcmp(name, "__dict__") == 0) { - Py_INCREF(m->md_dict); - return m->md_dict; - } - res = PyDict_GetItemString(m->md_dict, name); - if (res == NULL) { - modname = PyModule_GetName((PyObject *)m); - if (modname == NULL) { - PyErr_Clear(); - modname = "?"; - } - PyErr_Format(PyExc_AttributeError, - "'%.50s' module has no attribute '%.400s'", - modname, name); - } - else - Py_INCREF(res); - return res; - } - - static int - module_setattr(PyModuleObject *m, char *name, PyObject *v) - { - char* modname; - if (name[0] == '_' && strcmp(name, "__dict__") == 0) { - PyErr_SetString(PyExc_TypeError, - "read-only special attribute"); - return -1; - } - if (v == NULL) { - int rv = PyDict_DelItemString(m->md_dict, name); - if (rv < 0) { - modname = PyModule_GetName((PyObject *)m); - if (modname == NULL) { - PyErr_Clear(); - modname = "?"; - } - PyErr_Format(PyExc_AttributeError, - "'%.50s' module has no attribute '%.400s'", - modname, name); - } - return rv; - } - else - return PyDict_SetItemString(m->md_dict, name, v); - } - /* We only need a traverse function, no clear function: If the module is in a cycle, md_dict will be cleared as well, which will break --- 168,171 ---- *************** *** 227,251 **** PyTypeObject PyModule_Type = { PyObject_HEAD_INIT(&PyType_Type) ! 0, /*ob_size*/ ! "module", /*tp_name*/ ! sizeof(PyModuleObject) + PyGC_HEAD_SIZE, /*tp_size*/ ! 0, /*tp_itemsize*/ ! (destructor)module_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! (getattrfunc)module_getattr, /*tp_getattr*/ ! (setattrfunc)module_setattr, /*tp_setattr*/ ! 0, /*tp_compare*/ ! (reprfunc)module_repr, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /*tp_flags*/ ! 0, /* tp_doc */ ! (traverseproc)module_traverse, /* tp_traverse */ }; --- 181,219 ---- PyTypeObject PyModule_Type = { PyObject_HEAD_INIT(&PyType_Type) ! 0, /* ob_size */ ! "module", /* tp_name */ ! sizeof(PyModuleObject) + PyGC_HEAD_SIZE, /* tp_size */ ! 0, /* tp_itemsize */ ! (destructor)module_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! (reprfunc)module_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ ! PyGeneric_SetAttr, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)module_traverse, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* tp_methods */ ! module_members, /* tp_members */ ! 0, /* tp_getset */ ! 0, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! 0, /* tp_construct */ ! offsetof(PyModuleObject, md_dict), /* tp_dictoffset */ }; From gvanrossum@users.sourceforge.net Fri May 11 21:45:24 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 11 May 2001 13:45:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects funcobject.c,2.37.4.2,2.37.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5915 Modified Files: Tag: descr-branch funcobject.c Log Message: Use PyGeneric_{Get,Set}Attr. We still need wrappers for the peculiar additional constraints on the type of some special attributes and the tests for restricted execution. (Note that the restricted access test in func_getattro doesn't make much sense. In restricted mode, it disallows getting attributes whose name *doesn't* start with underscore -- this forbids access to most user attributes, but allows (writable!) access to the __dict__ attribute. This was probably never reviewed when user attributes were added. Unclear what should be done, so for now I'm leaving it in.) Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.37.4.2 retrieving revision 2.37.4.3 diff -C2 -r2.37.4.2 -r2.37.4.3 *** funcobject.c 2001/05/06 02:31:13 2.37.4.2 --- funcobject.c 2001/05/11 20:45:22 2.37.4.3 *************** *** 143,149 **** static PyObject * ! func_getattro(PyFunctionObject *op, PyObject *name) { - PyObject *rtn; char *sname = PyString_AsString(name); --- 143,148 ---- static PyObject * ! func_getattro(PyObject *op, PyObject *name) { char *sname = PyString_AsString(name); *************** *** 154,176 **** } ! /* no API for PyMember_HasAttr() */ ! rtn = PyMember_Get((char *)op, func_memberlist, sname); ! ! if (rtn == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { ! PyErr_Clear(); ! if (op->func_dict != NULL) { ! rtn = PyDict_GetItem(op->func_dict, name); ! Py_XINCREF(rtn); ! } ! if (rtn == NULL) ! PyErr_SetObject(PyExc_AttributeError, name); ! } ! return rtn; } static int ! func_setattro(PyFunctionObject *op, PyObject *name, PyObject *value) { - int rtn; char *sname = PyString_AsString(name); --- 153,162 ---- } ! return PyGeneric_GetAttr(op, name); } static int ! func_setattro(PyObject *op, PyObject *name, PyObject *value) { char *sname = PyString_AsString(name); *************** *** 218,246 **** } ! rtn = PyMember_Set((char *)op, func_memberlist, sname, value); ! if (rtn < 0 && PyErr_ExceptionMatches(PyExc_AttributeError)) { ! PyErr_Clear(); ! if (op->func_dict == NULL) { ! /* don't create the dict if we're deleting an ! * attribute. In that case, we know we'll get an ! * AttributeError. ! */ ! if (value == NULL) { ! PyErr_SetString(PyExc_AttributeError, sname); ! return -1; ! } ! op->func_dict = PyDict_New(); ! if (op->func_dict == NULL) ! return -1; ! } ! if (value == NULL) ! rtn = PyDict_DelItem(op->func_dict, name); ! else ! rtn = PyDict_SetItem(op->func_dict, name, value); ! /* transform KeyError into AttributeError */ ! if (rtn < 0 && PyErr_ExceptionMatches(PyExc_KeyError)) ! PyErr_SetString(PyExc_AttributeError, sname); ! } ! return rtn; } --- 204,208 ---- } ! return PyGeneric_SetAttr(op, name, value); } *************** *** 397,402 **** function_call, /* tp_call */ 0, /* tp_str */ ! (getattrofunc)func_getattro, /* tp_getattro */ ! (setattrofunc)func_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ --- 359,364 ---- function_call, /* tp_call */ 0, /* tp_str */ ! func_getattro, /* tp_getattro */ ! func_setattro, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ *************** *** 409,413 **** 0, /* tp_iternext */ 0, /* tp_methods */ ! 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ --- 371,375 ---- 0, /* tp_iternext */ 0, /* tp_methods */ ! func_memberlist, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ *************** *** 415,417 **** --- 377,381 ---- func_descr_get, /* tp_descr_get */ 0, /* tp_descr_set */ + 0, /* tp_construct */ + offsetof(PyFunctionObject, func_dict), /* tp_dictoffset */ }; From gvanrossum@users.sourceforge.net Fri May 11 22:51:37 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 11 May 2001 14:51:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.18,2.16.8.19 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv22095 Modified Files: Tag: descr-branch typeobject.c Log Message: Another cool feature: if a subtype of a built-in type defines a class variable __slots__ (which must be a sequence of strings), it doesn't have a __dict__, but instead it has named slots whose names are given by the strings in the sequence. Setting __slots__ = [] implies the subtype has no slots beyond those in the base class. (I think subtypes of such subtypes must specifiy __slots__ = [] to prevent adding a __dict__.) Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.18 retrieving revision 2.16.8.19 diff -C2 -r2.16.8.18 -r2.16.8.19 *** typeobject.c 2001/05/11 20:12:27 2.16.8.18 --- typeobject.c 2001/05/11 21:51:35 2.16.8.19 *************** *** 126,131 **** staticforward void override_slots(PyTypeObject *type, PyObject *dict); - #define NMEMBERS 1 - typedef struct { PyTypeObject type; --- 126,129 ---- *************** *** 134,139 **** PyMappingMethods as_mapping; PyBufferProcs as_buffer; ! struct memberlist members[NMEMBERS+1]; ! char name[1]; } etype; --- 132,137 ---- PyMappingMethods as_mapping; PyBufferProcs as_buffer; ! PyObject *name, *slots; ! struct memberlist members[1]; } etype; *************** *** 142,151 **** type_construct(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! char *name; ! PyObject *bases, *dict, *x; PyTypeObject *base; char *dummy = NULL; etype *et; struct memberlist *mp; /* Check arguments */ --- 140,149 ---- type_construct(PyTypeObject *type, PyObject *args, PyObject *kwds) { ! PyObject *name, *bases, *dict, *x, *slots; PyTypeObject *base; char *dummy = NULL; etype *et; struct memberlist *mp; + int i, nslots, slotoffset, allocsize; /* Check arguments */ *************** *** 155,159 **** return NULL; } ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "sOO", &dummy, &name, &bases, &dict)) return NULL; --- 153,157 ---- return NULL; } ! if (!PyArg_ParseTupleAndKeywords(args, kwds, "SOO", &dummy, &name, &bases, &dict)) return NULL; *************** *** 180,195 **** } /* Allocate memory and construct a type object in it */ ! et = PyObject_MALLOC(sizeof(etype) + strlen(name)); if (et == NULL) return NULL; ! memset(et, '\0', sizeof(etype)); type = &et->type; PyObject_INIT(type, &PyDynamicType_Type); type->tp_as_number = &et->as_number; type->tp_as_sequence = &et->as_sequence; type->tp_as_mapping = &et->as_mapping; type->tp_as_buffer = &et->as_buffer; ! type->tp_name = strcpy(et->name, name); type->tp_flags = Py_TPFLAGS_DEFAULT; --- 178,223 ---- } + /* Check for a __slots__ sequence variable in dict, and count it */ + slots = PyDict_GetItemString(dict, "__slots__"); + nslots = 0; + if (slots != NULL) { + /* Make it into a tuple */ + if (PyString_Check(slots)) + slots = Py_BuildValue("(O)", slots); + else + slots = PySequence_Tuple(slots); + if (slots == NULL) + return NULL; + nslots = PyTuple_GET_SIZE(slots); + for (i = 0; i < nslots; i++) { + if (!PyString_Check(PyTuple_GET_ITEM(slots, i))) { + PyErr_SetString(PyExc_TypeError, + "__slots__ must be a sequence of strings"); + Py_DECREF(slots); + return NULL; + } + } + } + if (slots == NULL && base->tp_dictoffset == 0 && + (base->tp_setattro == PyGeneric_SetAttr || + base->tp_setattro == NULL)) + nslots = 1; + /* Allocate memory and construct a type object in it */ ! allocsize = sizeof(etype) + nslots*sizeof(struct memberlist); ! et = PyObject_MALLOC(allocsize); if (et == NULL) return NULL; ! memset(et, '\0', allocsize); type = &et->type; PyObject_INIT(type, &PyDynamicType_Type); + Py_INCREF(name); + et->name = name; + et->slots = slots; type->tp_as_number = &et->as_number; type->tp_as_sequence = &et->as_sequence; type->tp_as_mapping = &et->as_mapping; type->tp_as_buffer = &et->as_buffer; ! type->tp_name = PyString_AS_STRING(name); type->tp_flags = Py_TPFLAGS_DEFAULT; *************** *** 216,235 **** } ! /* Add a __dict__ slot if we don't already have one, ! but only if the getattro is generic */ ! if (type->tp_dictoffset == 0 && ! type->tp_setattro == PyGeneric_SetAttr) { ! int dictoffset = type->tp_basicsize; ! if (type->tp_flags & Py_TPFLAGS_GC) ! dictoffset -= PyGC_HEAD_SIZE; ! type->tp_dictoffset = dictoffset; type->tp_basicsize += sizeof(PyObject *); - mp = et->members; mp->name = "__dict__"; mp->type = T_OBJECT; ! mp->offset = dictoffset; mp->readonly = 1; - add_members(type, mp); } x = PyObject_CallMethod(type->tp_dict, "update", "O", dict); --- 244,270 ---- } ! /* Add custom slots */ ! mp = et->members; ! slotoffset = type->tp_basicsize; ! if (type->tp_flags & Py_TPFLAGS_GC) ! slotoffset -= PyGC_HEAD_SIZE; ! if (slots != NULL) { ! for (i = 0; i < nslots; i++, mp++) { ! mp->name = PyString_AS_STRING( ! PyTuple_GET_ITEM(slots, i)); ! mp->type = T_OBJECT; ! mp->offset = slotoffset + i*sizeof(PyObject *); ! } ! type->tp_basicsize += nslots*sizeof(PyObject *); ! } ! else if (nslots) { ! type->tp_dictoffset = slotoffset; type->tp_basicsize += sizeof(PyObject *); mp->name = "__dict__"; mp->type = T_OBJECT; ! mp->offset = slotoffset; mp->readonly = 1; } + add_members(type, et->members); x = PyObject_CallMethod(type->tp_dict, "update", "O", dict); *************** *** 311,316 **** --- 346,355 ---- dtype_dealloc(PyTypeObject *type) { + etype *et = (etype *)type; + Py_XDECREF(type->tp_base); Py_XDECREF(type->tp_dict); + Py_XDECREF(et->name); + Py_XDECREF(et->slots); PyObject_DEL(type); } *************** *** 348,352 **** type_members, /* tp_members */ type_getsets, /* tp_getset */ ! 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ --- 387,391 ---- type_members, /* tp_members */ type_getsets, /* tp_getset */ ! &PyType_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ From tim_one@users.sourceforge.net Fri May 11 22:51:50 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 11 May 2001 14:51:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects moduleobject.c,2.31,2.32 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21481/python/dist/src/Objects Modified Files: moduleobject.c Log Message: Variant of patch #423262: Change module attribute get & set Allow module getattr and setattr to exploit string interning, via the previously null module object tp_getattro and tp_setattro slots. Yields a very nice speedup for things like random.random and os.path etc. Index: moduleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/moduleobject.c,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -r2.31 -r2.32 *** moduleobject.c 2001/01/02 15:58:27 2.31 --- moduleobject.c 2001/05/11 21:51:48 2.32 *************** *** 163,177 **** static PyObject * ! module_getattr(PyModuleObject *m, char *name) { PyObject *res; ! char* modname; ! if (strcmp(name, "__dict__") == 0) { Py_INCREF(m->md_dict); return m->md_dict; } ! res = PyDict_GetItemString(m->md_dict, name); if (res == NULL) { ! modname = PyModule_GetName((PyObject *)m); if (modname == NULL) { PyErr_Clear(); --- 163,178 ---- static PyObject * ! module_getattro(PyModuleObject *m, PyObject *name) { PyObject *res; ! char *sname = PyString_AsString(name); ! ! if (sname[0] == '_' && strcmp(sname, "__dict__") == 0) { Py_INCREF(m->md_dict); return m->md_dict; } ! res = PyDict_GetItem(m->md_dict, name); if (res == NULL) { ! char *modname = PyModule_GetName((PyObject *)m); if (modname == NULL) { PyErr_Clear(); *************** *** 188,195 **** static int ! module_setattr(PyModuleObject *m, char *name, PyObject *v) { ! char* modname; ! if (name[0] == '_' && strcmp(name, "__dict__") == 0) { PyErr_SetString(PyExc_TypeError, "read-only special attribute"); --- 189,196 ---- static int ! module_setattro(PyModuleObject *m, PyObject *name, PyObject *v) { ! char *sname = PyString_AsString(name); ! if (sname[0] == '_' && strcmp(sname, "__dict__") == 0) { PyErr_SetString(PyExc_TypeError, "read-only special attribute"); *************** *** 197,203 **** } if (v == NULL) { ! int rv = PyDict_DelItemString(m->md_dict, name); if (rv < 0) { ! modname = PyModule_GetName((PyObject *)m); if (modname == NULL) { PyErr_Clear(); --- 198,204 ---- } if (v == NULL) { ! int rv = PyDict_DelItem(m->md_dict, name); if (rv < 0) { ! char *modname = PyModule_GetName((PyObject *)m); if (modname == NULL) { PyErr_Clear(); *************** *** 206,215 **** PyErr_Format(PyExc_AttributeError, "'%.50s' module has no attribute '%.400s'", ! modname, name); } return rv; } else ! return PyDict_SetItemString(m->md_dict, name, v); } --- 207,216 ---- PyErr_Format(PyExc_AttributeError, "'%.50s' module has no attribute '%.400s'", ! modname, sname); } return rv; } else ! return PyDict_SetItem(m->md_dict, name, v); } *************** *** 227,251 **** PyTypeObject PyModule_Type = { PyObject_HEAD_INIT(&PyType_Type) ! 0, /*ob_size*/ ! "module", /*tp_name*/ ! sizeof(PyModuleObject) + PyGC_HEAD_SIZE, /*tp_size*/ ! 0, /*tp_itemsize*/ ! (destructor)module_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! (getattrfunc)module_getattr, /*tp_getattr*/ ! (setattrfunc)module_setattr, /*tp_setattr*/ ! 0, /*tp_compare*/ ! (reprfunc)module_repr, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /*tp_flags*/ ! 0, /* tp_doc */ ! (traverseproc)module_traverse, /* tp_traverse */ }; --- 228,252 ---- PyTypeObject PyModule_Type = { PyObject_HEAD_INIT(&PyType_Type) ! 0, /* ob_size */ ! "module", /* tp_name */ ! sizeof(PyModuleObject) + PyGC_HEAD_SIZE,/* tp_size */ ! 0, /* tp_itemsize */ ! (destructor)module_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! (reprfunc)module_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! (getattrofunc)module_getattro, /* tp_getattro */ ! (setattrofunc)module_setattro, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ ! 0, /* tp_doc */ ! (traverseproc)module_traverse, /* tp_traverse */ }; From tim_one@users.sourceforge.net Fri May 11 22:51:50 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 11 May 2001 14:51:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.164,1.165 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv21481/python/dist/src/Misc Modified Files: NEWS Log Message: Variant of patch #423262: Change module attribute get & set Allow module getattr and setattr to exploit string interning, via the previously null module object tp_getattro and tp_setattro slots. Yields a very nice speedup for things like random.random and os.path etc. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.164 retrieving revision 1.165 diff -C2 -r1.164 -r1.165 *** NEWS 2001/05/10 08:32:44 1.164 --- NEWS 2001/05/11 21:51:48 1.165 *************** *** 45,48 **** --- 45,51 ---- operator.countOf() (PySequence_Count() in C API) + - Accessing module attributes is significantly faster (for example, + random.random or os.path or yourPythonModule.yourAttribute). + - Comparing dictionary objects via == and != is faster, and now works even if the keys and values don't support comparisons other than ==. From gvanrossum@users.sourceforge.net Sat May 12 13:11:38 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 12 May 2001 05:11:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle FileList.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv12447 Modified Files: FileList.py Log Message: Delete goodname() method, which is unused. Add gotofileline(), a convenience method which I intend to use in a variant. Rename test() to _test(). Index: FileList.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/FileList.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** FileList.py 2001/01/17 08:48:39 1.8 --- FileList.py 2001/05/12 12:11:36 1.9 *************** *** 25,37 **** self.vars = {} # For EditorWindow.getrawvar (shared Tcl variables) - - def goodname(self, filename): - filename = self.canonize(filename) - key = os.path.normcase(filename) - if self.dict.has_key(key): - edit = self.dict[key] - filename = edit.io.filename or filename - return filename - def open(self, filename): assert filename --- 25,28 ---- *************** *** 55,58 **** --- 46,54 ---- return self.EditorWindow(self, filename, key) + def gotofileline(self, filename, lineno=None): + edit = self.open(filename) + if edit is not None and lineno is not None: + edit.gotoline(lineno) + def new(self): return self.EditorWindow(self) *************** *** 124,128 **** ! def test(): from EditorWindow import fixwordbreaks import sys --- 120,124 ---- ! def _test(): from EditorWindow import fixwordbreaks import sys *************** *** 140,142 **** if __name__ == '__main__': ! test() --- 136,138 ---- if __name__ == '__main__': ! _test() From gvanrossum@users.sourceforge.net Sat May 12 13:18:12 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 12 May 2001 05:18:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle IdleConf.py,1.6,1.7 idle.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv13120 Modified Files: IdleConf.py idle.py Log Message: Move the action of loading the configuration to the IdleConf module rather than the idle.py script. This has advantages and disadvantages; the biggest advantage being that we can more easily have an alternative main program. Index: IdleConf.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/IdleConf.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** IdleConf.py 2001/01/17 08:48:39 1.6 --- IdleConf.py 2001/05/12 12:18:10 1.7 *************** *** 111,112 **** --- 111,113 ---- idleconf = IdleConfParser() + load(os.path.dirname(__file__)) Index: idle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/idle.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** idle.py 2000/04/10 16:27:47 1.3 --- idle.py 2001/05/12 12:18:10 1.4 *************** *** 1,12 **** #! /usr/bin/env python - import os - import sys - import IdleConf - - idle_dir = os.path.dirname(IdleConf.__file__) - IdleConf.load(idle_dir) - - # defer importing Pyshell until IdleConf is loaded import PyShell PyShell.main() --- 1,4 ---- From gvanrossum@users.sourceforge.net Sat May 12 13:30:07 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 12 May 2001 05:30:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/idle StackViewer.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/idle In directory usw-pr-cvs1:/tmp/cvs-serv14975 Modified Files: StackViewer.py Log Message: Refactored, with some future plans in mind. This now uses the new gotofileline() method defined in FileList.py. Index: StackViewer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/idle/StackViewer.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** StackViewer.py 2001/01/17 08:48:39 1.15 --- StackViewer.py 2001/05/12 12:30:04 1.16 *************** *** 1,4 **** import string - from Tkinter import * import linecache --- 1,5 ---- + import os + import sys import string import linecache *************** *** 7,15 **** from OldStackViewer import StackViewer, NamespaceViewer ! def StackBrowser(root, flist=None, stack=None): ! top = Toplevel(root) sc = ScrolledCanvas(top, bg="white", highlightthickness=0) sc.frame.pack(expand=1, fill="both") ! item = StackTreeItem(flist) node = TreeNode(sc.canvas, None, item) node.expand() --- 8,18 ---- from OldStackViewer import StackViewer, NamespaceViewer ! def StackBrowser(root, flist=None, tb=None, top=None): ! if top is None: ! from Tkinter import Toplevel ! top = Toplevel(root) sc = ScrolledCanvas(top, bg="white", highlightthickness=0) sc.frame.pack(expand=1, fill="both") ! item = StackTreeItem(flist, tb) node = TreeNode(sc.canvas, None, item) node.expand() *************** *** 17,23 **** class StackTreeItem(TreeItem): ! def __init__(self, flist=None): self.flist = flist ! self.stack = get_stack() self.text = get_exception() --- 20,26 ---- class StackTreeItem(TreeItem): ! def __init__(self, flist=None, tb=None): self.flist = flist ! self.stack = get_stack(tb) self.text = get_exception() *************** *** 72,77 **** frame, lineno = self.info filename = frame.f_code.co_filename ! edit = self.flist.open(filename) ! edit.gotoline(lineno) class VariablesTreeItem(ObjectTreeItem): --- 75,80 ---- frame, lineno = self.info filename = frame.f_code.co_filename ! if os.path.isfile(filename): ! self.flist.gotofileline(filename, lineno) class VariablesTreeItem(ObjectTreeItem): *************** *** 130,135 **** return s ! if __name__ == "__main__": root = Tk() ! root.withdraw() ! StackBrowser(root) --- 133,147 ---- return s ! def _test(): ! try: ! import testcode ! reload(testcode) ! except: ! sys.last_type, sys.last_value, sys.last_traceback = sys.exc_info() ! from Tkinter import Tk root = Tk() ! StackBrowser(None, top=root) ! root.mainloop() ! ! if __name__ == "__main__": ! _test() From tim_one@users.sourceforge.net Sat May 12 21:24:24 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 12 May 2001 13:24:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects moduleobject.c,2.32,2.33 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv32751/python/dist/src/Objects Modified Files: moduleobject.c Log Message: Repair "module has no attribute xxx" error msg; bug introduced when switching from tp_getattr to tp_getattro. Index: moduleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/moduleobject.c,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -r2.32 -r2.33 *** moduleobject.c 2001/05/11 21:51:48 2.32 --- moduleobject.c 2001/05/12 20:24:22 2.33 *************** *** 181,185 **** PyErr_Format(PyExc_AttributeError, "'%.50s' module has no attribute '%.400s'", ! modname, name); } else --- 181,185 ---- PyErr_Format(PyExc_AttributeError, "'%.50s' module has no attribute '%.400s'", ! modname, sname); } else From gvanrossum@users.sourceforge.net Sat May 12 21:40:49 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 12 May 2001 13:40:49 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects moduleobject.c,2.31.6.1,2.31.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3206 Modified Files: Tag: descr-branch moduleobject.c Log Message: Make modules subclassable. This is interesting because they already have their own __dict__. Index: moduleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/moduleobject.c,v retrieving revision 2.31.6.1 retrieving revision 2.31.6.2 diff -C2 -r2.31.6.1 -r2.31.6.2 *** moduleobject.c 2001/05/11 20:14:07 2.31.6.1 --- moduleobject.c 2001/05/12 20:40:47 2.31.6.2 *************** *** 135,138 **** --- 135,149 ---- /* Methods */ + static PyObject * + module_construct(PyModuleObject *m, PyObject *args, PyObject *kw) + { + if (m == NULL) + return PyModule_New("?"); + m->md_dict = PyDict_New(); + if (m->md_dict == NULL) + return NULL; + return (PyObject *)m; + } + static void module_dealloc(PyModuleObject *m) *************** *** 215,219 **** 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! 0, /* tp_construct */ offsetof(PyModuleObject, md_dict), /* tp_dictoffset */ }; --- 226,230 ---- 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (ternaryfunc)module_construct, /* tp_construct */ offsetof(PyModuleObject, md_dict), /* tp_dictoffset */ }; From gvanrossum@users.sourceforge.net Sat May 12 21:41:32 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 12 May 2001 13:41:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.19,2.16.8.20 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv3393 Modified Files: Tag: descr-branch typeobject.c Log Message: Add a test to prevent subtyping of types w/o a valid tp_construct slot. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.19 retrieving revision 2.16.8.20 diff -C2 -r2.16.8.19 -r2.16.8.20 *** typeobject.c 2001/05/11 21:51:35 2.16.8.19 --- typeobject.c 2001/05/12 20:41:30 2.16.8.20 *************** *** 177,180 **** --- 177,185 ---- return NULL; } + if (base->tp_construct == NULL) { + PyErr_SetString(PyExc_TypeError, + "base type must have a constructor slot"); + return NULL; + } /* Check for a __slots__ sequence variable in dict, and count it */ From gvanrossum@users.sourceforge.net Sat May 12 21:58:26 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Sat, 12 May 2001 13:58:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.20,2.16.8.21 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6374/Objects Modified Files: Tag: descr-branch typeobject.c Log Message: Avoid endless recursion in subtype_construct() and subtype_dealloc() when a dynamic type is subtyped. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.20 retrieving revision 2.16.8.21 diff -C2 -r2.16.8.20 -r2.16.8.21 *** typeobject.c 2001/05/12 20:41:30 2.16.8.20 --- typeobject.c 2001/05/12 20:58:24 2.16.8.21 *************** *** 96,99 **** --- 96,101 ---- { PyObject *res; + PyTypeObject *base; + ternaryfunc f; if (self == NULL) { *************** *** 102,106 **** return NULL; } ! res = self->ob_type->tp_base->tp_construct(self, args, kwds); if (res == self) Py_INCREF(self->ob_type); --- 104,111 ---- return NULL; } ! base = self->ob_type->tp_base; ! while ((f = base->tp_construct) == subtype_construct) ! base = base->tp_base; ! res = f(self, args, kwds); if (res == self) Py_INCREF(self->ob_type); *************** *** 112,116 **** { int dictoffset = self->ob_type->tp_dictoffset; ! if (dictoffset && !self->ob_type->tp_base->tp_dictoffset) { PyObject **dictptr = (PyObject **) ((char *)self + dictoffset); PyObject *dict = *dictptr; --- 117,127 ---- { int dictoffset = self->ob_type->tp_dictoffset; ! PyTypeObject *base; ! destructor f; ! ! base = self->ob_type->tp_base; ! while ((f = base->tp_dealloc) == subtype_dealloc) ! base = base->tp_base; ! if (dictoffset && !base->tp_dictoffset) { PyObject **dictptr = (PyObject **) ((char *)self + dictoffset); PyObject *dict = *dictptr; *************** *** 120,124 **** } } ! self->ob_type->tp_base->tp_dealloc(self); Py_DECREF(self->ob_type); } --- 131,135 ---- } } ! base->tp_dealloc(self); Py_DECREF(self->ob_type); } From jackjansen@users.sourceforge.net Sat May 12 22:08:34 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 14:08:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Build PythonCore.exp,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv8065/Python/Mac/Build Modified Files: PythonCore.exp Log Message: Added iterobject.c to the project. And trying my first checkin at the same time. Index: PythonCore.exp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonCore.exp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** PythonCore.exp 2001/04/25 22:11:19 1.6 --- PythonCore.exp 2001/05/12 21:08:32 1.7 *************** *** 1 **** ! sSuffices GUSISetupConfig GUSISetupDevices GUSISetupFactories __vt__15GUSISIOUXDevice # GUSISIOUXDevice::__vt __vt__15GUSISIOUXSocket # GUSISIOUXSocket::__vt sInstance__15GUSISIOUXDevice # GUSISIOUXDevice::sInstance sInstance__15GUSISIOUXSocket # GUSISIOUXSocket::sInstance __dt__15GUSISIOUXDeviceFv # GUSISIOUXDevice::~GUSISIOUXDevice() GUSISetupConsoleDescriptors open__15GUSISIOUXDeviceFR13GUSIFileTokeni # GUSISIOUXDevice::open(GUSIFileToken&,int) Want__15GUSISIOUXDeviceFR13GUSIFileToken # GUSISIOUXDevice::Want(GUSIFileToken&) __dt__10GUSIDeviceFv # GUSIDevice::~GUSIDevice() Instance__15GUSISIOUXDeviceFv # GUSISIOUXDevice::Instance() select__15GUSISIOUXSocketFPbPbPb # GUSISIOUXSocket::select(bool*,bool*,bool*) isatty__15GUSISIOUXSocketFv # GUSISIOUXSocket::isatty() fstat__15GUSISIOUXSocketFP4stat # GUSISIOUXSocket::fstat(stat*) ioctl__15GUSISIOUXSocketFUiPc # GUSISIOUXSocket::ioctl(unsigned int,char*) write__15GUSISIOUXSocketFRC12GUSIGatherer # GUSISIOUXSocket::write(const GUSIGatherer&) read__15GUSISIOUXSocketFRC13GUSIScatterer # GUSISIOUXSocket::read(const GUSIScatterer&) __dt__15GUSISIOUXSocketFv # GUSISIOUXSocket::~GUSISIOUXSocket() Initialize__15GUSISIOUXSocketFv # GUSISIOUXSocket::Initialize() __ct__15GUSISIOUXSocketFv # GUSISIOUXSocket::GUSISIOUXSocket() Instance__15GUSISIOUXSocketFv # GUSISIOUXSocket::Instance() _PyBuiltin_Init _PyEval_SliceIndex PyEval_CallObjectWithKeywords PyEval_CallObject Py_FlushLine PyEval_GetNestedScopes PyEval_GetRestricted PyEval_GetFrame PyEval_GetGlobals PyEval_GetLocals PyEval_GetBuiltins PyEval_EvalCode Py_SetRecursionLimit Py_GetRecursionLimit Py_MakePendingCalls Py_AddPendingCall PyEval_RestoreThread PyEval_SaveThread PyEval_ReInitThreads PyEval_ReleaseThread PyEval_AcquireThread PyEval_ReleaseLock PyEval_AcquireLock PyEval_InitThreads PyArg_GetFloatArray PyArg_GetDoubleArray PyArg_GetShortArray PyArg_GetLongArray PyArg_GetShortArraySize PyArg_GetLongArraySize PyArg_GetChar PyArg_GetString PyArg_GetFloat PyArg_GetShort PyArg_GetLong PyArg_GetObject PyErr_ProgramText PyErr_SyntaxLocation PyErr_WarnExplicit PyErr_Warn PyErr_WriteUnraisable PyErr_NewException PyErr_Format PyErr_BadInternalCall _PyErr_BadInternalCall PyErr_SetFromErrno PyErr_SetFromErrnoWithFilename PyErr_NoMemory PyErr_BadArgument PyErr_Clear PyErr_Fetch PyErr_NormalizeException PyErr_ExceptionMatches PyErr_GivenExceptionMatches PyErr_Occurred PyErr_SetString PyErr_SetNone PyErr_SetObject PyErr_Restore PyImport_FrozenModules PyArg_ParseTupleAndKeywords PyArg_VaParse PyArg_ParseTuple PyArg_Parse Py_GetCopyright PyOS_GetLastModificationTime _PyOS_opterr _PyOS_optind _PyOS_optarg _PyOS_GetOpt Py_GetVersion _PyParser_Grammar PyImport_Inittab _PyImport_Filetab PyImport_AppendInittab PyImport_ExtendInittab initimp PyImport_Import PyImport_ReloadModule PyImport_ImportModuleEx PyImport_ImportModule PyImport_ImportFrozenModule PyImport_ExecCodeModuleEx PyImport_ExecCodeModule PyImport_AddModule _PyImport_FindExtension _PyImport_FixupExtension PyImport_GetMagicNumber PyImport_Cleanup PyImport_GetModuleDict _PyImport_Fini _PyImport_Init _PyImport_LoadDynamicModule PyMarshal_Init PyMarshal_WriteObjectToString PyMarshal_ReadObjectFromString PyMarshal_ReadObjectFromFile PyMarshal_ReadLastObjectFromFile PyMarshal_ReadLongFromFile PyMarshal_WriteObjectToFile PyMarshal_WriteLongToFile _Py_PackageContext PyModule_AddStringConstant PyModule_AddIntConstant PyModule_AddObject PyEval_CallMethod PyEval_CallFunction Py_VaBuildValue Py_BuildValue Py_InitModule4 PyOS_strtol PyOS_strtoul Py_UseClassExceptionsFlag Py_DebugFlag Py_VerboseFlag Py_InteractiveFlag Py_NoSiteFlag Py_FrozenFlag _PyThread_Started Py_UnicodeFlag PyOS_setsig PyOS_getsig Py_FdIsInteractive Py_Exit Py_AtExit Py_FatalError PyParser_SimpleParseString PyParser_SimpleParseFile Py_SymtableString Py_CompileStringFlags Py_CompileString PyRun_FileExFlags PyRun_FileFlags PyRun_StringFlags PyRun_FileEx PyRun_File PyRun_String PyErr_Display PyErr_PrintEx PyErr_Print PyRun_SimpleString PyRun_SimpleFileExFlags PyRun_SimpleFileEx PyRun_SimpleFile PyRun_InteractiveOneFlags PyRun_InteractiveOne PyRun_InteractiveLoopFlags PyRun_InteractiveLoop PyRun_AnyFileExFlags PyRun_AnyFileEx PyRun_AnyFileFlags PyRun_AnyFile Py_GetPythonHome Py_SetPythonHome Py_GetProgramName Py_SetProgramName Py_EndInterpreter Py_NewInterpreter Py_Finalize Py_Initialize Py_IsInitialized _PyThreadState_Current PyThreadState_GetDict PyThreadState_Swap PyThreadState_Get PyThreadState_DeleteCurrent PyThreadState_Delete PyThreadState_Clear PyThreadState_New PyInterpreterState_Delete PyInterpreterState_Clear PyInterpreterState_New PyMember_Set PyMember_Get PySys_WriteStderr PySys_WriteStdout PySys_SetArgv PySys_SetPath _PySys_Init PySys_AddWarnOption PySys_ResetWarnOptions PySys_SetObject PySys_GetFile PySys_GetObject PyTraceBack_Type PyTraceBack_Print PyTraceBack_Here PyCode_Type Py_OptimizeFlag PySymtable_Free PyCode_Addr2Line PyNode_CompileSymtable PyNode_CompileFlags PyNode_Compile PyCode_New PyObject_IsSubclass PyObject_IsInstance PyObject_CallMethod PyObject_CallFunction PyObject_CallObject PyMapping_HasKey PyMapping_HasKeyString PyMapping_SetItemString PyMapping_GetItemString PyMapping_Length PyMapping_Size PyMapping_Check PySequence_Index PySequence_In PySequence_Contains PySequence_Count PySequence_Fast PySequence_List PySequence_Tuple PySequence_DelSlice PySequence_SetSlice PySequence_DelItem PySequence_SetItem PySequence_GetSlice PySequence_GetItem PySequence_InPlaceRepeat PySequence_InPlaceConcat PySequence_Repeat PySequence_Concat PySequence_Length PySequence_Size PySequence_Check PyNumber_Float PyNumber_Long PyNumber_Int PyNumber_Absolute PyNumber_Invert PyNumber_Positive PyNumber_Negative PyNumber_InPlacePower PyNumber_InPlaceRemainder PyNumber_InPlaceMultiply PyNumber_InPlaceAdd PyNumber_InPlaceDivide PyNumber_InPlaceSubtract PyNumber_InPlaceRshift PyNumber_InPlaceLshift PyNumber_InPlaceAnd PyNumber_InPlaceXor PyNumber_InPlaceOr PyNumber_Power PyNumber_Remainder PyNumber_Add PyNumber_Divmod PyNumber_Divide PyNumber_Multiply PyNumber_Subtract PyNumber_Rshift PyNumber_Lshift PyNumber_And PyNumber_Xor PyNumber_Or PyNumber_Check PyObject_AsWriteBuffer PyObject_AsReadBuffer PyObject_AsCharBuffer PyObject_DelItem PyObject_SetItem PyObject_GetItem PyObject_Length PyObject_Size PyObject_Type PyObject_Cmp PyClass_Type PyInstance_Type PyMethod_Type PyMethod_Fini PyMethod_Class PyMethod_Self PyMethod_Function PyMethod_New PyInstance_New PyInstance_NewRaw PyClass_IsSubclass PyClass_New PyCObject_Type PyCObject_Import PyCObject_GetDesc PyCObject_AsVoidPtr PyCObject_FromVoidPtrAndDesc PyCObject_FromVoidPtr PyComplex_Type PyComplex_AsCComplex PyComplex_ImagAsDouble PyComplex_RealAsDouble PyComplex_FromDoubles PyComplex_FromCComplex _Py_c_pow _Py_c_quot _Py_c_prod _Py_c_neg _Py_c_diff _Py_c_sum PyDict_Type PyDict_DelItemString PyDict_SetItemString PyDict_GetItemString PyDict_Items PyDict_Values PyDict_Keys PyDict_Size PyDict_Copy PyDict_Next PyDict_Clear PyDict_DelItem PyDict_SetItem PyDict_GetItem PyDict_New PyFile_Type PyObject_AsFileDescriptor PyFile_WriteString PyFile_WriteObject PyFile_SoftSpace PyFile_GetLine PyFile_SetBufSize PyFile_FromString PyFile_FromFile PyFile_Name PyFile_AsFile PyFloat_Type PyFloat_Fini PyFloat_AsString PyFloat_AsStringEx PyFloat_AsDouble PyFloat_FromString PyFloat_FromDouble PyFrame_Type PyFrame_Fini PyFrame_LocalsToFast PyFrame_FastToLocals PyFrame_BlockPop PyFrame_BlockSetup PyFrame_New PyFunction_Type PyFunction_SetClosure PyFunction_GetClosure PyFunction_SetDefaults PyFunction_GetDefaults PyFunction_GetGlobals PyFunction_GetCode PyFunction_New _Py_ZeroStruct _Py_TrueStruct PyInt_Type PyInt_Fini PyInt_FromUnicode PyInt_FromString PyInt_AsLong PyInt_FromLong PyInt_GetMax PyList_Type PyList_AsTuple PyList_Reverse PyList_Sort PyList_SetSlice PyList_GetSlice PyList_Append PyList_Insert PyList_SetItem PyList_GetItem PyList_Size PyList_New PyLong_Type PyLong_FromUnicode PyLong_FromString PyLong_AsVoidPtr PyLong_FromVoidPtr PyLong_AsDouble PyLong_AsUnsignedLong PyLong_AsLong PyLong_FromDouble PyLong_FromUnsignedLong PyLong_FromLong _PyLong_New PyCFunction_Type PyCFunction_Fini Py_FindMethod Py_FindMethodInChain PyCFunction_GetFlags PyCFunction_GetSelf PyCFunction_GetFunction PyCFunction_New PyModule_Type _PyModule_Clear PyModule_GetFilename PyModule_GetName PyModule_GetDict PyModule_New _Py_NoneStruct _Py_NotImplementedStruct _Py_cobject_hack _Py_abstract_hack PyObject_ClearWeakRefs _PyTrash_delete_later _PyTrash_delete_nesting _PyTrash_destroy_chain _PyTrash_deposit_object Py_ReprLeave Py_ReprEnter PyObject_Free PyObject_Realloc PyObject_Malloc PyMem_Free PyMem_Realloc PyMem_Malloc PyCallable_Check PyNumber_Coerce PyNumber_CoerceEx PyObject_Not PyObject_IsTrue PyObject_SetAttr PyObject_HasAttr PyObject_GetAttr PyObject_SetAttrString PyObject_HasAttrString PyObject_GetAttrString PyObject_Hash _Py_HashPointer _Py_HashDouble PyObject_RichCompareBool PyObject_RichCompare PyObject_Compare PyObject_Unicode PyObject_Str PyObject_Repr _PyObject_Dump PyObject_Print _PyGC_Remove _PyGC_Insert _PyObject_Del _PyObject_NewVar _PyObject_New PyObject_InitVar PyObject_Init PyRange_Type PyRange_New _Py_EllipsisObject PySlice_Type PySlice_GetIndices PySlice_New PyString_Type _Py_ReleaseInternedStrings PyString_Fini PyString_InternFromString PyString_InternInPlace PyString_Format _PyString_FormatLong _PyString_Resize PyString_ConcatAndDel PyString_Concat PyString_AsStringAndSize PyString_AsString PyString_Size PyString_AsEncodedString PyString_Encode PyString_Decode PyString_FromString PyString_FromStringAndSize PyTuple_Type PyTuple_Fini _PyTuple_Resize PyTuple_GetSlice PyTuple_SetItem PyTuple_GetItem PyTuple_Size PyTuple_New PyType_Type PyGrammar_RemoveAccelerators PyGrammar_AddAccelerators PyGrammar_LabelRepr PyGrammar_FindDFA PyOS_AfterFork PyOS_ReadlineFunctionPointer PyOS_InputHook PyOS_Readline PyOS_StdioReadline PyNode_Free PyNode_AddChild PyNode_New PyParser_AddToken PyParser_Delete PyParser_New Py_TabcheckFlag PyParser_ParseFile PyParser_ParseString _PyParser_TokenNames PyTokenizer_Get PyToken_ThreeChars PyToken_TwoChars PyToken_OneChar PyTokenizer_Free PyTokenizer_FromFile PyTokenizer_FromString array_methods initarray initaudioop initbinascii initcmath initerrno Py_GetBuildInfo initimageop initmath _Py_MD5Final _Py_MD5Update _Py_MD5Init initmd5 new_doc initnew initoperator initparser initregex _Py_re_syntax_table _Py_re_syntax _Py_re_search _Py_re_match _Py_re_compile_pattern _Py_re_compile_fastmap _Py_re_set_syntax _Py_re_compile_initialize initrgbimg initrotor initselect gethostbyname_lock init_socket initstrop initstruct inittime FindApplicationFromCreator PyMac_ApplicationFSSpec PyMac_ApplicationPath open_doc_upp open_app_upp not_upp PyMac_GetArgv PyMac_GetFullPath PyMac_init_process_location strdup Py_GetCompiler PyMac_PreferenceOptions PyMac_GetPythonPath PyMac_GetPythonDir PyMac_OpenPrefFile Py_GetPath Py_GetPlatform PyMac_ConsoleIsDead PyMac_AppearanceCompliant PyMac_OSErrException PyMac_Buildwide PyMac_Getwide PyMac_BuildFixed PyMac_GetFixed PyMac_GetEventRecord PyMac_BuildPoint PyMac_GetPoint PyMac_BuildRect PyMac_GetRect PyMac_BuildFSSpec PyMac_GetFSSpec PyMac_BuildOptStr255 PyMac_BuildStr255 PyMac_GetStr255 PyMac_BuildNumVersion PyMac_BuildOSType PyMac_GetOSType PyMac_PromptGetFile PyMac_GetDirectory SIOUXDoAboutBox PyMac_RestoreMenuBar PyMac_InitMenuBar PyMac_SetSchedParams PyMac_GetSchedParams PyMac_DoYield PyMac_HandleEvent PyMac_BuildEventRecord PyMac_HandleEventIntern PyMac_SetEventHandler PyOS_InterruptOccurred PyErr_CheckSignals PyOS_FiniInterrupts PyOS_InitInterrupts PyOS_CheckStack PyMac_Error PyErr_Mac PyMac_GetOSErrException PyMac_StrError c2pstrcpy Pstring PLstrrchr PLstrcmp PLstrcpy PyMac_StopGUSISpin RotateCursor SpinCursor PyMac_getscript PyMac_AppRefNum PyMac_options console_output_state PyMac_GetDelayConsoleFlag Py_GetExecPrefix Py_GetPrefix Py_GetArgcArgv Py_GetProgramFullPath PyMac_Exit abort PyMac_OutputNotSeen PyMac_OutputSeen PyMac_InitApplication PyMac_Initialize PyMac_InitApplet PyMac_getfiletype PyMac_setfiletype main PyMac_AddLibResources __initialize_with_resources getbootvol getwd macstat sync initgestalt initmacfs newmfssobject mfs_GetFSSpecFSSpec initmac initMacOS Pcre_Type initpcre pcre_lcc pcre_fcc pcre_cbits pcre_ctypes pcre_malloc pcre_free pcre_exec pcre_compile pcre_info pcre_version pcre_study initcPickle Pickler_setattr cPickle_PyMapping_HasKey initcStringIO PyMac_FindModuleExtension PyMac_LoadResourceModule PyMac_LoadCodeResourceModule PyMac_FindCodeResourceModule PyMac_FindResourceModule _PyImport_Inittab CtlObj_chain Control_Type initCtl CtlObj_Convert CtlObj_New DlgObj_chain Dialog_Type initDlg DlgObj_ConvertToWindow DlgObj_Convert DlgObj_New DlgObj_WhichDialog MenuObj_chain Menu_Type initMenu MenuObj_Convert MenuObj_New GrafObj_chain GrafPort_Type BMObj_chain BitMap_Type QDGlobalsAccess_Type initQd BMObj_NewCopied BMObj_Convert BMObj_New GrafObj_Convert GrafObj_New QdRGB_Convert QdRGB_New ResObj_chain Resource_Type initRes OptResObj_Convert OptResObj_New ResObj_Convert ResObj_New WinObj_chain Window_Type initWin WinObj_WhichWindow WinObj_Convert WinObj_New PyBuffer_Type PyBuffer_New PyBuffer_FromReadWriteMemory PyBuffer_FromMemory PyBuffer_FromReadWriteObject PyBuffer_FromObject _PyImport_DynLoadFiletab _PyImport_GetDynLoadFunc init_codecs _PyUnicode_Database_Records _PyUnicode_CategoryNames _PyUnicode_BidirectionalNames initunicodedata _PyCodecRegistry_Fini _PyCodecRegistry_Init PyCodec_Decode PyCodec_Encode PyCodec_StreamWriter PyCodec_StreamReader PyCodec_Decoder PyCodec_Encoder _PyCodec_Lookup PyCodec_Register _PyUnicode_TypeRecords _PyUnicode_IsAlpha _PyUnicode_ToLowercase _PyUnicode_ToUppercase _PyUnicode_IsUppercase _PyUnicode_IsLowercase _PyUnicode_IsWhitespace _PyUnicode_IsNumeric _PyUnicode_ToNumeric _PyUnicode_IsDigit _PyUnicode_ToDigit _PyUnicode_IsDecimalDigit _PyUnicode_ToDecimalDigit _PyUnicode_IsTitlecase _PyUnicode_ToTitlecase _PyUnicode_IsLinebreak PyUnicode_Type _PyUnicode_Fini _PyUnicode_Init PyUnicode_Format PyUnicode_Split PyUnicode_Replace PyUnicode_Concat PyUnicode_Contains PyUnicode_Compare PyUnicode_Splitlines PyUnicode_Join PyUnicode_Tailmatch PyUnicode_Find PyUnicode_Count PyUnicode_EncodeDecimal PyUnicode_Translate PyUnicode_TranslateCharmap PyUnicode_AsCharmapString PyUnicode_EncodeCharmap PyUnicode_DecodeCharmap PyUnicode_AsASCIIString PyUnicode_EncodeASCII PyUnicode_DecodeASCII PyUnicode_AsLatin1String PyUnicode_EncodeLatin1 PyUnicode_DecodeLatin1 PyUnicode_AsRawUnicodeEscapeString PyUnicode_EncodeRawUnicodeEscape PyUnicode_DecodeRawUnicodeEscape PyUnicode_AsUnicodeEscapeString PyUnicode_EncodeUnicodeEscape PyUnicode_DecodeUnicodeEscape PyUnicode_AsUTF16String PyUnicode_EncodeUTF16 PyUnicode_DecodeUTF16 PyUnicode_AsUTF8String PyUnicode_EncodeUTF8 PyUnicode_DecodeUTF8 PyUnicode_SetDefaultEncoding PyUnicode_GetDefaultEncoding PyUnicode_GetSize PyUnicode_AsUnicode _PyUnicode_AsDefaultEncodedString PyUnicode_AsEncodedString PyUnicode_Encode PyUnicode_Decode PyUnicode_FromEncodedObject PyUnicode_FromObject PyUnicode_AsWideChar PyUnicode_FromWideChar PyUnicode_FromUnicode PyUnicode_Resize initthread PyThread_up_sema PyThread_down_sema PyThread_free_sema PyThread_allocate_sema PyThread_release_lock PyThread_acquire_lock PyThread_free_lock PyThread_allocate_lock PyThread__exit_thread PyThread_exit_thread PyThread_get_thread_ident PyThread_start_new_thread PyThread_init_thread PyExc_Exception PyExc_StandardError PyExc_ArithmeticError PyExc_LookupError PyExc_AssertionError PyExc_AttributeError PyExc_EOFError PyExc_FloatingPointError PyExc_EnvironmentError PyExc_IOError PyExc_OSError PyExc_ImportError PyExc_IndexError PyExc_KeyError PyExc_KeyboardInterrupt PyExc_MemoryError PyExc_NameError PyExc_OverflowError PyExc_RuntimeError PyExc_NotImplementedError PyExc_SyntaxError PyExc_IndentationError PyExc_TabError PyExc_SystemError PyExc_SystemExit PyExc_UnboundLocalError PyExc_UnicodeError PyExc_TypeError PyExc_ValueError PyExc_ZeroDivisionError PyExc_MemoryErrorInst PyExc_Warning PyExc_UserWarning PyExc_DeprecationWarning PyExc_SyntaxWarning PyExc_RuntimeWarning fini_exceptions init_exceptions initNav AEDesc_chain AEDesc_Type upp_GenericEventHandler upp_AEIdleProc initAE AEDesc_Convert AEDesc_New init_locale initEvt init_sre initsha DragObj_chain DragObj_Typ e dragglue_TrackingHandlerUPP dragglue_ReceiveHandlerUPP dragglue_SendDataUPP initDrag DragObj_Convert DragObj_New initxreadlines PyCell_Type PyCell_Set PyCell_Get PyCell_New PySymtableEntry_Type PySymtableEntry_New PyNode_Future GUSISetupConsoleStdio GUSIStdioFlush GUSIStdioClose _fdopen __close_console __close_file __position_file __write_console __write_file __read_console __read_file __open_temp_file __open_file gGUSIEventMask h_errno gGUSIEventHook gGUSIExecHook gGUSISpinHook GUSI_sprintf__FPcPCce # GUSI_sprintf(char*,const char*,...) GUSI_vsprintf__FPcPCcPc # GUSI_vsprintf(char*,const char*,char*) GUSIHandleNextEvent__Fl # GUSIHandleNextEvent(long) GUSISetMacHostError__Fs # GUSISetMacHostError(short) GUSISetHostError__Fi # GUSISetHostError(int) GUSISetMacError__Fs # GUSISetMacError(short) GUSIMapMacError__Fs # GUSIMapMacError(short) GUSISetPosixError__Fi # GUSISetPosixError(int) GUSIGetHook__FUl # GUSIGetHook(unsigned long) GUSISetHook__FUlPFv_v # GUSISetHook(unsigned long,void (*)(void)) __vt__13GUSIScattGath # GUSIScattGath::__vt Peek__Q214GUSIRingBuffer6PeekerFRC13GUSIScattererRUl # GUSIRingBuffer::Peeker::Peek(const GUSIScatterer&,unsigned long&) Peek__Q214GUSIRingBuffer6PeekerFPvRUl # GUSIRingBuffer::Peeker::Peek(void*,unsigned long&) PeekBuffer__Q214GUSIRingBuffer6PeekerFRUl # GUSIRingBuffer::Peeker::PeekBuffer(unsigned long&) __dt__Q214GUSIRingBuffer6PeekerFv # GUSIRingBuffer::Peeker::~Peeker() __ct__Q214GUSIRingBuffer6PeekerFR14GUSIRingBuffer # GUSIRingBuffer::Peeker::Peeker(GUSIRingBuffer&) Valid__14GUSIRingBufferFv # GUSIRingBuffer::Valid() Free__14GUSIRingBufferFv # GUSIRingBuffer::Free() IterateIOVec__14GUSIRingBufferFRC13GUSIScattGathRUlRUlb # GUSIRingBuffer::IterateIOVec(const GUSIScattGath&,unsigned long&,unsigned long&,bool) Consume__14GUSIRingBufferFPvRUl # GUSIRingBuffer::Consume(void*,unsigned long&) Produce__14GUSIRingBufferFPvRUl # GUSIRingBuffer::Produce(void*,unsigned long&) FreeBuffer__14GUSIRingBufferFPvUl # GUSIRingBuffer::FreeBuffer(void*,unsigned long) ValidBuffer__14GUSIRingBufferFPvUl # GUSIRingBuffer::ValidBuffer(void*,unsigned long) ConsumeBuffer__14GUSIRingBufferFRUl # GUSIRingBuffer::ConsumeBuffer(unsigned long&) ProduceBuffer__14GUSIRingBufferFRUl # GUSIRingBuffer::ProduceBuffer(unsigned long&) __dt__14GUSIRingBufferFv # GUSIRingBuffer::~GUSIRingBuffer() ObsoleteBuffer__14GUSIRingBufferFv # GUSIRingBuffer::ObsoleteBuffer() PurgeBuffers__14GUSIRingBufferFv # GUSIRingBuffer::PurgeBuffers() SwitchBuffer__14GUSIRingBufferFUl # GUSIRingBuffer::SwitchBuffer(unsigned long) __ct__14GUSIRingBufferFUl # GUSIRingBuffer::GUSIRingBuffer(unsigned long) Invariant__14GUSIRingBufferFv # GUSIRingBuffer::Invariant() Distance__14GUSIRingBufferFPcPc # GUSIRingBuffer::Distance(char*,char*) __ct__13GUSIScattGathFRC13GUSIScattGath # GUSIScattGath::GUSIScattGath(const GUSIScattGath&) __as__13GUSIScattGathFRC13GUSIScattGath # GUSIScattGath::operator =(const GUSIScattGath&) __dt__13GUSIScattGathFv # GUSIScattGath::~GUSIScattGath() Buffer__13GUSIScattGathCFv # GUSIScattGath::Buffer() const __ct__13GUSIScattGathFPvUlb # GUSIScattGath::GUSIScattGath(void*,unsigned long,bool) __ct__13GUSIScattGathFPC5iovecib # GUSIScattGath::GUSIScattGath(const iovec*,int,bool) sInstance__17GUSIConfiguration # GUSIConfiguration::sInstance ConfigureHandleAppleEvents__17GUSIConfigurationFb # GUSIConfiguration::ConfigureHandleAppleEvents(bool) CmdPeriod__17GUSIConfigurationFPC11EventRecord # GUSIConfiguration::CmdPeriod(const EventRecord*) CheckInterrupt__17GUSIConfigurationFv # GUSIConfiguration::CheckInterrupt() BrokenPipe__17GUSIConfigurationFv # GUSIConfiguration::BrokenPipe() DoAutoInitGraf__17GUSIConfigurationFv # GUSIConfiguration::DoAutoInitGraf() DoAutoSpin__17GUSIConfigurationCFv # GUSIConfiguration::DoAutoSpin() const SetDefaultFType__17GUSIConfigurationCFRC12GUSIFileSpec # GUSIConfiguration::SetDefaultFType(const GUSIFileSpec&) const ConfigureSuffices__17GUSIConfigurationFsPQ217GUSIConfiguration10FileSuffix # GUSIConfiguration::ConfigureSuffices(short,GUSIConfiguration::FileSuffix*) __ct__17GUSIConfigurationFs # GUSIConfiguration::GUSIConfiguration(short) CreateInstance__17GUSIConfigurationFs # GUSIConfiguration::CreateInstance(short) __vt__22GUSIThreadManagerProxy # GUSIThreadManagerProxy::__vt __vt__18GUSIContextFactory # GUSIContextFactory::__vt __vt__11GUSIContext # GUSIContext::__vt sError__11GUSIContext # GUSIContext::sError sHasThreading__11GUSIContext # GUSIContext::sHasThreading sCurrentContext__11GUSIContext # GUSIContext::sCurrentContext sContexts__11GUSIContext # GUSIContext::sContexts sInstance__11GUSIProcess # GUSIProcess::sInstance __dt__Q211GUSIContext5QueueFv # GUSIContext::Queue::~Queue() MakeInstance__22GUSIThreadManagerProxyFv # GUSIThreadManagerProxy::MakeInstance() __dt__22GUSIThreadManagerProxyFv # GUSIThreadManagerProxy::~GUSIThreadManagerProxy() __dt__Q23std76auto_ptr<22GUSIThreadManagerProxy,Q23std33_Single<22GUSIThreadManagerProxy>>Fv # std::auto_ptr>::~auto_ptr() Instance__22GUSIThreadManagerProxyFv # GUSIThreadManagerProxy::Instance() SetThreadTerminator__22GUSIThreadManagerProxyFUlPFUlPv_vPv # GUSIThreadManagerProxy::SetThreadTerminator(unsigned long,void (*)(unsigned long, void*),void*) SetThreadSwitcher__22GUSIThreadManagerProxyFUlPFUlPv_vPvUc # GUSIThreadManagerProxy::SetThreadSwitcher(unsigned long,void (*)(unsigned long, void*),void*,unsigned char) NewThread__22GUSIThreadManagerProxyFUlPFPv_PvPvlUlPPvPUl # GUSIThreadManagerProxy::NewThread(unsigned long,void* (*)(void*),void*,long,unsigned long,void**,unsigned long*) GUSIControl__FP7IOParam # GUSIControl(IOParam*) GUSIFinishIO__FP7IOParam # GUSIFinishIO(IOParam*) GUSIStartIO__FP7IOParam # GUSIStartIO(IOParam*) Blocked__11GUSIContextFv # GUSIContext::Blocked() Pending__11GUSIContextFv # GUSIContext::Pending() Raise__11GUSIContextFb # GUSIContext::Raise(bool) Yield__11GUSIProcessF13GUSIYieldMode # GUSIProcess::Yield(GUSIYieldMode) SigSuspend__11GUSIContextFv # GUSIContext::SigSuspend() SigWait__11GUSIContextFUi # GUSIContext::SigWait(unsigned int) Yield__11GUSIContextF13GUSIYieldMode # GUSIContext::Yield(GUSIYieldMode) Done__11GUSIContextFb # GUSIContext::Done(bool) Terminate__11GUSIContextFv # GUSIContext::Terminate() SwitchOut__11GUSIContextFv # GUSIContext::SwitchOut() SwitchIn__11GUSIContextFv # GUSIContext::SwitchIn() SetTerminator__11GUSIContextFPFUlPv_vPv # GUSIContext::SetTerminator(void (*)(unsigned long, void*),void*) GUSISetThreadTerminator SetSwitchOut__11GUSIContextFPFUlPv_vPv # GUSIContext::SetSwitchOut(void (*)(unsigned long, void*),void*) SetSwitchIn__11GUSIContextFPFUlPv_vPv # GUSIContext::SetSwitchIn(void (*)(unsigned long, void*),void*) GUSISetThreadSwitcher CreateContext__18GUSIContextFactoryFUl # GUSIContextFactory::CreateContext(unsigned long) CreateContext__18GUSIContextFactoryFPFPv_PvPvlUlPPvPUl # GUSIContextFactory::CreateContext(void* (*)(void*),void*,long,unsigned long,void**,unsigned long*) __dt__18GUSIContextFactoryFv # GUSIContextFactory::~GUSIContextFactory() __ct__18GUSIContextFactoryFv # GUSIContextFactory::GUSIContextFactory() __dt__Q23std68auto_ptr<18GUSIContextFactory,Q23std29_Single<18GUSIContextFactory>>Fv # std::auto_ptr>::~auto_ptr() SetInstance__18GUSIContextFactoryFP18GUSIContextFactory # GUSIContextFactory::SetInstance(GUSIContextFactory*) Instance__18GUSIContextFactoryFv # GUSIContextFactory::Instance() GUSINewThread Wakeup__11GUSIProcessFv # GUSIProcess::Wakeup() Wakeup__11GUSIContextFv # GUSIContext::Wakeup() Liquidate__11GUSIContextFv # GUSIContext::Liquidate() LiquidateAll__Q211GUSIContext5QueueFv # GUSIContext::Queue::LiquidateAll() __dt__11GUSIContextFv # GUSIContext::~GUSIContext() Lookup__11GUSIContextFUl # GUSIContext::Lookup(unsigned long) __ct__11GUSIContextFPFPv_PvPvlUlPPvPUl # GUSIContext::GUSIContext(void* (*)(void*),void*,long,unsigned long,void**,unsigned long*) __ct__11GUSIContextFUl # GUSIContext::GUSIContext(unsigned long) FinishSetup__11GUSIContextFv # GUSIContext::FinishSetup() G USIThreadTerminator StartSetup__11GUSIContextFv # GUSIContext::StartSetup() Setup__11GUSIContextFb # GUSIContext::Setup(bool) GUSIThreadSwitchOut GUSIThreadSwitchIn __dt__11GUSIProcessFv # GUSIProcess::~GUSIProcess() QueueForClose__11GUSIProcessFP10GUSISocket # GUSIProcess::QueueForClose(GUSISocket*) __ct__11GUSIProcessFb # GUSIProcess::GUSIProcess(bool) sBlocks__Q216GUSIContextQueue7element # GUSIContextQueue::element::sBlocks Wakeup__16GUSIContextQueueFv # GUSIContextQueue::Wakeup() push_back__16GUSIContextQueueFP11GUSIContext # GUSIContextQueue::push_back(GUSIContext*) remove__16GUSIContextQueueFP11GUSIContext # GUSIContextQueue::remove(GUSIContext*) __dt__16GUSIContextQueueFv # GUSIContextQueue::~GUSIContextQueue() __dl__Q216GUSIContextQueue7elementFPvUl # GUSIContextQueue::element::operator delete(void*,unsigned long) __nw__Q216GUSIContextQueue7elementFUl # GUSIContextQueue::element::operator new(unsigned long) __vt__14GUSIDConSocket # GUSIDConSocket::__vt __vt__14GUSIDConDevice # GUSIDConDevice::__vt sInstance__14GUSIDConDevice # GUSIDConDevice::sInstance __dt__14GUSIDConDeviceFv # GUSIDConDevice::~GUSIDConDevice() isatty__14GUSIDConSocketFv # GUSIDConSocket::isatty() Supports__14GUSIDConSocketFQ210GUSISocket12ConfigOption # GUSIDConSocket::Supports(GUSISocket::ConfigOption) write__14GUSIDConSocketFRC12GUSIGatherer # GUSIDConSocket::write(const GUSIGatherer&) read__14GUSIDConSocketFRC13GUSIScatterer # GUSIDConSocket::read(const GUSIScatterer&) __dt__14GUSIDConSocketFv # GUSIDConSocket::~GUSIDConSocket() __ct__14GUSIDConSocketFPCc # GUSIDConSocket::GUSIDConSocket(const char*) open__14GUSIDConDeviceFR13GUSIFileTokeni # GUSIDConDevice::open(GUSIFileToken&,int) Want__14GUSIDConDeviceFR13GUSIFileToken # GUSIDConDevice::Want(GUSIFileToken&) GUSIwithDConSockets sGUSIDescriptorTable__19GUSIDescriptorTable # GUSIDescriptorTable::sGUSIDescriptorTable __ct__19GUSIDescriptorTableFRC19GUSIDescriptorTable # GUSIDescriptorTable::GUSIDescriptorTable(const GUSIDescriptorTable&) LookupSocket__19GUSIDescriptorTableFi # GUSIDescriptorTable::LookupSocket(int) __vc__19GUSIDescriptorTableFi # GUSIDescriptorTable::operator [](int) RemoveSocket__19GUSIDescriptorTableFi # GUSIDescriptorTable::RemoveSocket(int) InstallSocket__19GUSIDescriptorTableFP10GUSISocketi # GUSIDescriptorTable::InstallSocket(GUSISocket*,int) __dt__19GUSIDescriptorTableFv # GUSIDescriptorTable::~GUSIDescriptorTable() CloseAllDescriptors__19GUSIDescriptorTableFv # GUSIDescriptorTable::CloseAllDescriptors() SetInstance__19GUSIDescriptorTableFP19GUSIDescriptorTable # GUSIDescriptorTable::SetInstance(GUSIDescriptorTable*) Instance__19GUSIDescriptorTableFv # GUSIDescriptorTable::Instance() Instance__14GUSINullDeviceFv # GUSINullDevice::Instance() GUSIDefaultSetupConsole GUSISetupConsole __ct__19GUSIDescriptorTableFv # GUSIDescriptorTable::GUSIDescriptorTable() __vt__10GUSIDevice # GUSIDevice::__vt sInstance__18GUSIDeviceRegistry # GUSIDeviceRegistry::sInstance faccess__18GUSIDeviceRegistryFPCcPUiPv # GUSIDeviceRegistry::faccess(const char*,unsigned int*,void*) fsetfileinfo__18GUSIDeviceRegistryFPCcUlUl # GUSIDeviceRegistry::fsetfileinfo(const char*,unsigned long,unsigned long) fgetfileinfo__18GUSIDeviceRegistryFPCcPUlPUl # GUSIDeviceRegistry::fgetfileinfo(const char*,unsigned long*,unsigned long*) readlink__18GUSIDeviceRegistryFPCcPci # GUSIDeviceRegistry::readlink(const char*,char*,int) symlink__18GUSIDeviceRegistryFPCcPCc # GUSIDeviceRegistry::symlink(const char*,const char*) opendir__18GUSIDeviceRegistryFPCc # GUSIDeviceRegistry::opendir(const char*) rmdir__18GUSIDeviceRegistryFPCc # GUSIDeviceRegistry::rmdir(const char*) mkdir__18GUSIDeviceRegistryFPCc # GUSIDeviceRegistry::mkdir(const char*) access__18GUSIDeviceRegistryFPCci # GUSIDeviceRegistry::access(const char*,int) utime__18GUSIDeviceRegistryFPCcPC7utimbuf # GUSIDeviceRegistry::utime(const char*,const utimbuf*) chmod__18GUSIDeviceRegistryFPCcUs # GUSIDeviceRegistry::chmod(const char*,unsigned short) stat__18GUSIDeviceRegistryFPCcP4statb # GUSIDeviceRegistry::stat(const char*,stat*,bool) rename__18GUSIDeviceRegistryFPCcPCc # GUSIDeviceRegistry::rename(const char*,const char*) remove__18GUSIDeviceRegistryFPCc # GUSIDeviceRegistry::remove(const char*) open__18GUSIDeviceRegistryFPCci # GUSIDeviceRegistry::open(const char*,int) Lookup__18GUSIDeviceRegistryFR13GUSIFileToken # GUSIDeviceRegistry::Lookup(GUSIFileToken&) RemoveDevice__18GUSIDeviceRegistryFP10GUSIDevice # GUSIDeviceRegistry::RemoveDevice(GUSIDevice*) AddDevice__18GUSIDeviceRegistryFP10GUSIDevice # GUSIDeviceRegistry::AddDevice(GUSIDevice*) __ct__18GUSIDeviceRegistryFv # GUSIDeviceRegistry::GUSIDeviceRegistry() faccess__10GUSIDeviceFR13GUSIFileTokenPUiPv # GUSIDevice::faccess(GUSIFileToken&,unsigned int*,void*) fsetfileinfo__10GUSIDeviceFR13GUSIFileTokenUlUl # GUSIDevice::fsetfileinfo(GUSIFileToken&,unsigned long,unsigned long) fgetfileinfo__10GUSIDeviceFR13GUSIFileTokenPUlPUl # GUSIDevice::fgetfileinfo(GUSIFileToken&,unsigned long*,unsigned long*) readlink__10GUSIDeviceFR13GUSIFileTokenPci # GUSIDevice::readlink(GUSIFileToken&,char*,int) symlink__10GUSIDeviceFR13GUSIFileTokenPCc # GUSIDevice::symlink(GUSIFileToken&,const char*) opendir__10GUSIDeviceFR13GUSIFileToken # GUSIDevice::opendir(GUSIFileToken&) rmdir__10GUSIDeviceFR13GUSIFileToken # GUSIDevice::rmdir(GUSIFileToken&) mkdir__10GUSIDeviceFR13GUSIFileToken # GUSIDevice::mkdir(GUSIFileToken&) access__10GUSIDeviceFR13GUSIFileTokeni # GUSIDevice::access(GUSIFileToken&,int) utime__10GUSIDeviceFR13GUSIFileTokenPC7utimbuf # GUSIDevice::utime(GUSIFileToken&,const utimbuf*) chmod__10GUSIDeviceFR13GUSIFileTokenUs # GUSIDevice::chmod(GUSIFileToken&,unsigned short) stat__10GUSIDeviceFR13GUSIFileTokenP4stat # GUSIDevice::stat(GUSIFileToken&,stat*) rename__10GUSIDeviceFR13GUSIFileTokenPCc # GUSIDevice::rename(GUSIFileToken&,const char*) remove__10GUSIDeviceFR13GUSIFileToken # GUSIDevice::remove(GUSIFileToken&) open__10GUSIDeviceFR13GUSIFileTokeni # GUSIDevice::open(GUSIFileToken&,int) Want__10GUSIDeviceFR13GUSIFileToken # GUSIDevice::Want(GUSIFileToken&) __ct__13GUSIFileTokenFsQ213GUSIFileToken7Request # GUSIFileToken::GUSIFileToken(short,GUSIFileToken::Request) __ct__13GUSIFileTokenFRC12GUSIFileSpecQ213GUSIFileToken7Request # GUSIFileToken::GUSIFileToken(const GUSIFileSpec&,GUSIFileToken::Request) StrStdStream__13GUSIFileTokenFPCc # GUSIFileToken::StrStdStream(const char*) __ct__13GUSIFileTokenFPCcQ213GUSIFileToken7Requestb # GUSIFileToken::GUSIFileToken(const char*,GUSIFileToken::Request,bool) StrFragEqual__13GUSIFileTokenFPCcPCc # GUSIFileToken::StrFragEqual(const char*,const char*) GUSI_diag_log vdfprintf dfprintf GUSI_break GUSI_log GUSI_pos __vt__22GUSISocketTypeRegistry # GUSISocketTypeRegistry::__vt __vt__24GUSISocketDomainRegistry # GUSISocketDomainRegistry::__vt __vt__17GUSISocketFactory # GUSISocketFactory::__vt sInstance__24GUSISocketDomainRegistry # GUSISocketDomainRegistry::sInstance __dt__24GUSISocketDomainRegistryFv # GUSISocketDomainRegistry::~GUSISocketDomainRegistry() __dt__22GUSISocketTypeRegistryFv # GUSISocketTypeRegistry::~GUSISocketTypeRegistry() RemoveFactory__22GUSISocketTypeRegistryFii # GUSISocketTypeRegistry::RemoveFactory(int,int) AddFactory__22GUSISocketTypeRegistryFiiP17GUSISocketFactory # GUSISocketTypeRegistry::AddFactory(int,int,GUSISocketFactory*) socketpair__22GUSISocketTypeRegistryFiiiPP10GUSISocket # GUSISocketTypeRegistry::socketpair(int,int,int,GUSISocket**) socket__22GUSISocketTypeRegistryFiii # GUSISocketTypeRegistry::socket(int,int,int) Find__22GUSISocketTypeRegistryFiibRPQ222GUSISocketTypeRegistry5Entry # GUSISocketTypeRegistry::Find(int,int,bool,GUSISocketTypeRegistry::Entry*&) Initialize__22GUSISocketTypeRegistryFv # GUSISocketTypeRegistry::Initialize() __ct__Q222GUSISocketTypeRegistry5EntryFv # GUSISocketTypeRegistry::Entry::Entry() AddFactory__24GUSISocketDomainRegistryFiP17GUSISocketFactory # GUSISocketDomainRegistry::AddFactory(int,GUSISocketFactory*) socketpair__24GUSISocketDomainRegistryFiiiPP10GUSISocket # GUSISocketDomainRegistry::socketpair(int,int,int,GUSISocket**) socket__24GUSISoc ketDomainRegistryFiii # GUSISocketDomainRegistry::socket(int,int,int) __dt__17GUSISocketFactoryFv # GUSISocketFactory::~GUSISocketFactory() __ct__24GUSISocketDomainRegistryFv # GUSISocketDomainRegistry::GUSISocketDomainRegistry() socketpair__17GUSISocketFactoryFiiiPP10GUSISocket # GUSISocketFactory::socketpair(int,int,int,GUSISocket**) sID__16GUSITempFileSpec # GUSITempFileSpec::sID sScratchSize__12GUSIFileSpec # GUSIFileSpec::sScratchSize sScratch__12GUSIFileSpec # GUSIFileSpec::sScratch GUSIFSpGetCatInfo GUSIFSpTouchFolder GUSIFSp2Encoding GUSIFSp2DirRelPath GUSIFSp2RelPath GUSIFSp2FullPath GUSIFSpResolve GUSIFSpIndex GUSIFSpDown GUSIFSpUp GUSIMakeTempFSp GUSISpecial2FSp GUSIPath2FSp GUSIWD2FSp GUSIFRefNum2FSp TempName__16GUSITempFileSpecFPCUc # GUSITempFileSpec::TempName(const unsigned char*) TempName__16GUSITempFileSpecFv # GUSITempFileSpec::TempName() __ct__16GUSITempFileSpecFslPCUc # GUSITempFileSpec::GUSITempFileSpec(short,long,const unsigned char*) __ct__16GUSITempFileSpecFsPCUc # GUSITempFileSpec::GUSITempFileSpec(short,const unsigned char*) __ct__16GUSITempFileSpecFPCUc # GUSITempFileSpec::GUSITempFileSpec(const unsigned char*) __ct__16GUSITempFileSpecFsl # GUSITempFileSpec::GUSITempFileSpec(short,long) __ct__16GUSITempFileSpecFs # GUSITempFileSpec::GUSITempFileSpec(short) IsParentOf__12GUSIFileSpecCFRC12GUSIFileSpec # GUSIFileSpec::IsParentOf(const GUSIFileSpec&) const __eq__FRC12GUSIFileSpecRC12GUSIFileSpec # operator ==(const GUSIFileSpec&,const GUSIFileSpec&) AliasPath__12GUSIFileSpecCFv # GUSIFileSpec::AliasPath() const Resolve__12GUSIFileSpecFb # GUSIFileSpec::Resolve(bool) EncodedPath__12GUSIFileSpecCFv # GUSIFileSpec::EncodedPath() const RelativePath__12GUSIFileSpecCFv # GUSIFileSpec::RelativePath() const __as__9HFileInfoFRC9HFileInfo # HFileInfo::operator =(const HFileInfo&) __as__7DirInfoFRC7DirInfo # DirInfo::operator =(const DirInfo&) RelativePath__12GUSIFileSpecCFRC6FSSpec # GUSIFileSpec::RelativePath(const FSSpec&) const PrependPathComponent__12GUSIFileSpecCFRPcPCUcb # GUSIFileSpec::PrependPathComponent(char*&,const unsigned char*,bool) const FullPath__12GUSIFileSpecCFv # GUSIFileSpec::FullPath() const CatInfo__12GUSIFileSpecFs # GUSIFileSpec::CatInfo(short) TouchFolder__12GUSIFileSpecFv # GUSIFileSpec::TouchFolder() SetName__12GUSIFileSpecFPCc # GUSIFileSpec::SetName(const char*) SetName__12GUSIFileSpecFPCUc # GUSIFileSpec::SetName(const unsigned char*) SetParID__12GUSIFileSpecFl # GUSIFileSpec::SetParID(long) SetVRef__12GUSIFileSpecFs # GUSIFileSpec::SetVRef(short) __vc__12GUSIFileSpecFs # GUSIFileSpec::operator [](short) __pl__FRC6FSSpecPCc # operator +(const FSSpec&,const char*) __pl__FRC6FSSpecPCUc # operator +(const FSSpec&,const unsigned char*) AddPathComponent__12GUSIFileSpecFPCcib # GUSIFileSpec::AddPathComponent(const char*,int,bool) __pp__12GUSIFileSpecFv # GUSIFileSpec::operator ++() __mm__12GUSIFileSpecFv # GUSIFileSpec::operator --() GetVolume__12GUSIFileSpecFs # GUSIFileSpec::GetVolume(short) __ct__12GUSIFileSpecFPCcb # GUSIFileSpec::GUSIFileSpec(const char*,bool) __ct__12GUSIFileSpecFs # GUSIFileSpec::GUSIFileSpec(short) __ct__12GUSIFileSpecFUls # GUSIFileSpec::GUSIFileSpec(unsigned long,short) __ct__12GUSIFileSpecFsPCUcb # GUSIFileSpec::GUSIFileSpec(short,const unsigned char*,bool) __ct__12GUSIFileSpecFslPCUcb # GUSIFileSpec::GUSIFileSpec(short,long,const unsigned char*,bool) __ct__12GUSIFileSpecFRC6FSSpecb # GUSIFileSpec::GUSIFileSpec(const FSSpec&,bool) __ct__12GUSIFileSpecFRC12GUSIFileSpec # GUSIFileSpec::GUSIFileSpec(const GUSIFileSpec&) CScratch__12GUSIFileSpecFb # GUSIFileSpec::CScratch(bool) ReadHex__FPCciPc # ReadHex(const char*,int,char*) GUSIFSMoveRename GUSIFSCatMove GUSIFSCatMove__FPC6FSSpecl # GUSIFSCatMove(const FSSpec*,long) GUSIFSRename GUSIFSRstFLock GUSIFSSetFLock GUSIFSDirCreate GUSIFSDelete GUSIFSCreate GUSIFSCreate__FPC6FSSpec # GUSIFSCreate(const FSSpec*) GUSIFSGetVolParms GUSIFSHGetVolParms__FP33GUSIIOPBWrapper<14HParamBlockRec> # GUSIFSHGetVolParms(GUSIIOPBWrapper*) GUSIFSOpenRF GUSIFSOpenDF GUSIFSSetFInfo GUSIFSGetFInfo GUSIFSHSetFInfo__FP33GUSIIOPBWrapper<14HParamBlockRec> # GUSIFSHSetFInfo(GUSIIOPBWrapper*) GUSIFSHGetFInfo__FP33GUSIIOPBWrapper<14HParamBlockRec> # GUSIFSHGetFInfo(GUSIIOPBWrapper*) GUSIFSOpenDriver GUSIFSOpen__FP32GUSIIOPBWrapper<13ParamBlockRec> # GUSIFSOpen(GUSIIOPBWrapper*) GUSIFSHGetVInfo__FP33GUSIIOPBWrapper<14HParamBlockRec> # GUSIFSHGetVInfo(GUSIIOPBWrapper*) GUSIFSGetVInfo__FP32GUSIIOPBWrapper<13ParamBlockRec> # GUSIFSGetVInfo(GUSIIOPBWrapper*) GUSIFSGetFCBInfo__FP26GUSIIOPBWrapper<8FCBPBRec> # GUSIFSGetFCBInfo(GUSIIOPBWrapper*) GUSIFSSetCatInfo__FP30GUSIIOPBWrapper<11GUSICatInfo> # GUSIFSSetCatInfo(GUSIIOPBWrapper*) GUSIFSGetCatInfo__FP30GUSIIOPBWrapper<11GUSICatInfo> # GUSIFSGetCatInfo(GUSIIOPBWrapper*) gGUSIInetFactories GUSIwithInetSockets __vt__16GUSIMacDirectory # GUSIMacDirectory::__vt __vt__13GUSIDirectory # GUSIDirectory::__vt __vt__17GUSIMacFileSocket # GUSIMacFileSocket::__vt __vt__17GUSIMacFileDevice # GUSIMacFileDevice::__vt sWakeupProc__17GUSIMacFileSocket # GUSIMacFileSocket::sWakeupProc sWriteProc__17GUSIMacFileSocket # GUSIMacFileSocket::sWriteProc sReadProc__17GUSIMacFileSocket # GUSIMacFileSocket::sReadProc __dt__16GUSIMacDirectoryFv # GUSIMacDirectory::~GUSIMacDirectory() rewinddir__16GUSIMacDirectoryFv # GUSIMacDirectory::rewinddir() seekdir__16GUSIMacDirectoryFl # GUSIMacDirectory::seekdir(long) telldir__16GUSIMacDirectoryFv # GUSIMacDirectory::telldir() readdir__16GUSIMacDirectoryFv # GUSIMacDirectory::readdir() __dt__13GUSIDirectoryFv # GUSIDirectory::~GUSIDirectory() __ct__16GUSIMacDirectoryFRC6FSSpec # GUSIMacDirectory::GUSIMacDirectory(const FSSpec&) Supports__17GUSIMacFileSocketFQ210GUSISocket12ConfigOption # GUSIMacFileSocket::Supports(GUSISocket::ConfigOption) fstat__17GUSIMacFileSocketFP4stat # GUSIMacFileSocket::fstat(stat*) ftruncate__17GUSIMacFileSocketFl # GUSIMacFileSocket::ftruncate(long) lseek__17GUSIMacFileSocketFli # GUSIMacFileSocket::lseek(long,int) setsockopt__17GUSIMacFileSocketFiiPvUi # GUSIMacFileSocket::setsockopt(int,int,void*,unsigned int) getsockopt__17GUSIMacFileSocketFiiPvPUi # GUSIMacFileSocket::getsockopt(int,int,void*,unsigned int*) ioctl__17GUSIMacFileSocketFUiPc # GUSIMacFileSocket::ioctl(unsigned int,char*) fcntl__17GUSIMacFileSocketFiPc # GUSIMacFileSocket::fcntl(int,char*) fsync__17GUSIMacFileSocketFv # GUSIMacFileSocket::fsync() select__17GUSIMacFileSocketFPbPbPb # GUSIMacFileSocket::select(bool*,bool*,bool*) write__17GUSIMacFileSocketFRC12GUSIGatherer # GUSIMacFileSocket::write(const GUSIGatherer&) read__17GUSIMacFileSocketFRC13GUSIScatterer # GUSIMacFileSocket::read(const GUSIScatterer&) SyncWrite__17GUSIMacFileSocketFv # GUSIMacFileSocket::SyncWrite() SyncRead__17GUSIMacFileSocketFv # GUSIMacFileSocket::SyncRead() __dt__17GUSIMacFileSocketFv # GUSIMacFileSocket::~GUSIMacFileSocket() __dt__17GUSISMInputBufferFv # GUSISMInputBuffer::~GUSISMInputBuffer() __dt__18GUSISMOutputBufferFv # GUSISMOutputBuffer::~GUSISMOutputBuffer() __ct__17GUSIMacFileSocketFsbi # GUSIMacFileSocket::GUSIMacFileSocket(short,bool,int) faccess__17GUSIMacFileDeviceFR13GUSIFileTokenPUiPv # GUSIMacFileDevice::faccess(GUSIFileToken&,unsigned int*,void*) fsetfileinfo__17GUSIMacFileDeviceFR13GUSIFileTokenUlUl # GUSIMacFileDevice::fsetfileinfo(GUSIFileToken&,unsigned long,unsigned long) fgetfileinfo__17GUSIMacFileDeviceFR13GUSIFileTokenPUlPUl # GUSIMacFileDevice::fgetfileinfo(GUSIFileToken&,unsigned long*,unsigned long*) readlink__17GUSIMacFileDeviceFR13GUSIFileTokenPci # GUSIMacFileDevice::readlink(GUSIFileToken&,char*,int) symlink__17GUSIMacFileDeviceFR13GUSIFileTokenPCc # GUSIMacFileDevice::symlink(GUSIFileToken&,const char*) opendir__17GUSIMacFileDeviceFR13GUSIFileToken # GUSIMacFileDevice::opendir(GUSIFileToken&) rmdir__17GUSIMacFileDeviceFR13GUSIFileToken # GUSIMacFileDevice::rmdir(GUSIFileToken&) mkdir__17GUSIMacFileDeviceFR13GUSIFileToken # GUSIMacFileDevice::mkdir(GUSIFileToken&) access_ _17GUSIMacFileDeviceFR13GUSIFileTokeni # GUSIMacFileDevice::access(GUSIFileToken&,int) utime__17GUSIMacFileDeviceFR13GUSIFileTokenPC7utimbuf # GUSIMacFileDevice::utime(GUSIFileToken&,const utimbuf*) chmod__17GUSIMacFileDeviceFR13GUSIFileTokenUs # GUSIMacFileDevice::chmod(GUSIFileToken&,unsigned short) stat__17GUSIMacFileDeviceFR13GUSIFileTokenP4stat # GUSIMacFileDevice::stat(GUSIFileToken&,stat*) rename__17GUSIMacFileDeviceFR13GUSIFileTokenPCc # GUSIMacFileDevice::rename(GUSIFileToken&,const char*) CleanupTemporaries__17GUSIMacFileDeviceFb # GUSIMacFileDevice::CleanupTemporaries(bool) MarkTemporary__17GUSIMacFileDeviceFRC6FSSpec # GUSIMacFileDevice::MarkTemporary(const FSSpec&) remove__17GUSIMacFileDeviceFR13GUSIFileToken # GUSIMacFileDevice::remove(GUSIFileToken&) open__17GUSIMacFileDeviceFsi # GUSIMacFileDevice::open(short,int) open__17GUSIMacFileDeviceFR13GUSIFileTokeni # GUSIMacFileDevice::open(GUSIFileToken&,int) Want__17GUSIMacFileDeviceFR13GUSIFileToken # GUSIMacFileDevice::Want(GUSIFileToken&) __dt__17GUSIMacFileDeviceFv # GUSIMacFileDevice::~GUSIMacFileDevice() __dt__Q23std66auto_ptr<17GUSIMacFileDevice,Q23std28_Single<17GUSIMacFileDevice>>Fv # std::auto_ptr>::~auto_ptr() Instance__17GUSIMacFileDeviceFv # GUSIMacFileDevice::Instance() __dt__Q211GUSIProcess7A5SaverFv # GUSIProcess::A5Saver::~A5Saver() sDrvrState__16GUSIMTInetSocket # GUSIMTInetSocket::sDrvrState __vt__16GUSIMTInetSocket # GUSIMTInetSocket::__vt sHostAddress__16GUSIMTInetSocket # GUSIMTInetSocket::sHostAddress sDrvrRefNum__16GUSIMTInetSocket # GUSIMTInetSocket::sDrvrRefNum __dt__16GUSIMTInetSocketFv # GUSIMTInetSocket::~GUSIMTInetSocket() GUSIwithMTInetSockets Supports__16GUSIMTInetSocketFQ210GUSISocket12ConfigOption # GUSIMTInetSocket::Supports(GUSISocket::ConfigOption) setsockopt__16GUSIMTInetSocketFiiPvUi # GUSIMTInetSocket::setsockopt(int,int,void*,unsigned int) getsockopt__16GUSIMTInetSocketFiiPvPUi # GUSIMTInetSocket::getsockopt(int,int,void*,unsigned int*) ioctl__16GUSIMTInetSocketFUiPc # GUSIMTInetSocket::ioctl(unsigned int,char*) fcntl__16GUSIMTInetSocketFiPc # GUSIMTInetSocket::fcntl(int,char*) shutdown__16GUSIMTInetSocketFi # GUSIMTInetSocket::shutdown(int) getpeername__16GUSIMTInetSocketFPvPUi # GUSIMTInetSocket::getpeername(void*,unsigned int*) getsockname__16GUSIMTInetSocketFPvPUi # GUSIMTInetSocket::getsockname(void*,unsigned int*) bind__16GUSIMTInetSocketFPvUi # GUSIMTInetSocket::bind(void*,unsigned int) __ct__16GUSIMTInetSocketFv # GUSIMTInetSocket::GUSIMTInetSocket() HostAddr__16GUSIMTInetSocketFv # GUSIMTInetSocket::HostAddr() Driver__16GUSIMTInetSocketFv # GUSIMTInetSocket::Driver() uDNRDone sResolverState__11GUSIMTNetDB # GUSIMTNetDB::sResolverState __vt__11GUSIMTNetDB # GUSIMTNetDB::__vt get__49GUSISpecificData<11GUSIhostent,&.GUSIKillHostEnt>FP17GUSISpecificTable # GUSISpecificData::get(GUSISpecificTable*) __dt__11GUSIMTNetDBFv # GUSIMTNetDB::~GUSIMTNetDB() gethostid__11GUSIMTNetDBFv # GUSIMTNetDB::gethostid() inet_ntoa__11GUSIMTNetDBF7in_addr # GUSIMTNetDB::inet_ntoa(in_addr) gethostbyaddr__11GUSIMTNetDBFPCvUli # GUSIMTNetDB::gethostbyaddr(const void*,unsigned long,int) gethostbyname__11GUSIMTNetDBFPCc # GUSIMTNetDB::gethostbyname(const char*) Resolver__11GUSIMTNetDBFv # GUSIMTNetDB::Resolver() __dt__12GUSISpecificFv # GUSISpecific::~GUSISpecific() __dt__49GUSISpecificData<11GUSIhostent,&.GUSIKillHostEnt>Fv # GUSISpecificData::~GUSISpecificData() __dt__9GUSINetDBFv # GUSINetDB::~GUSINetDB() Instantiate__11GUSIMTNetDBFv # GUSIMTNetDB::Instantiate() __vt__16GUSIMTTcpFactory # GUSIMTTcpFactory::__vt __vt__15GUSIMTTcpSocket # GUSIMTTcpSocket::__vt instance__16GUSIMTTcpFactory # GUSIMTTcpFactory::instance sListenProc__15GUSIMTTcpSocket # GUSIMTTcpSocket::sListenProc sConnectProc__15GUSIMTTcpSocket # GUSIMTTcpSocket::sConnectProc sNotifyProc__15GUSIMTTcpSocket # GUSIMTTcpSocket::sNotifyProc sRecvProc__15GUSIMTTcpSocket # GUSIMTTcpSocket::sRecvProc sSendProc__15GUSIMTTcpSocket # GUSIMTTcpSocket::sSendProc __dt__16GUSIMTTcpFactoryFv # GUSIMTTcpFactory::~GUSIMTTcpFactory() GUSIwithMTTcpSockets socket__16GUSIMTTcpFactoryFiii # GUSIMTTcpFactory::socket(int,int,int) __dt__15GUSIMTTcpSocketFv # GUSIMTTcpSocket::~GUSIMTTcpSocket() shutdown__15GUSIMTTcpSocketFi # GUSIMTTcpSocket::shutdown(int) select__15GUSIMTTcpSocketFPbPbPb # GUSIMTTcpSocket::select(bool*,bool*,bool*) sendto__15GUSIMTTcpSocketFRC12GUSIGathereriPCvUi # GUSIMTTcpSocket::sendto(const GUSIGatherer&,int,const void*,unsigned int) recvfrom__15GUSIMTTcpSocketFRC13GUSIScattereriPvPUi # GUSIMTTcpSocket::recvfrom(const GUSIScatterer&,int,void*,unsigned int*) __ct__15GUSIMTTcpSocketFRQ215GUSIMTTcpSocket8Listener # GUSIMTTcpSocket::GUSIMTTcpSocket(GUSIMTTcpSocket::Listener&) accept__15GUSIMTTcpSocketFPvPUi # GUSIMTTcpSocket::accept(void*,unsigned int*) listen__15GUSIMTTcpSocketFi # GUSIMTTcpSocket::listen(int) connect__15GUSIMTTcpSocketFPvUi # GUSIMTTcpSocket::connect(void*,unsigned int) __ct__15GUSIMTTcpSocketFv # GUSIMTTcpSocket::GUSIMTTcpSocket() SetupListener__15GUSIMTTcpSocketFRQ215GUSIMTTcpSocket8Listener # GUSIMTTcpSocket::SetupListener(GUSIMTTcpSocket::Listener&) CreateStream__15GUSIMTTcpSocketFPP15GUSIMTTcpSocket # GUSIMTTcpSocket::CreateStream(GUSIMTTcpSocket**) GUSIMTTListen__FP15GUSIMTTcpSocket # GUSIMTTListen(GUSIMTTcpSocket*) GUSIMTTListenDone__FP7TCPiopb # GUSIMTTListenDone(TCPiopb*) GUSIMTTConnectDone__FP7TCPiopb # GUSIMTTConnectDone(TCPiopb*) GUSIMTTNotify GUSIMTTRecv__FP15GUSIMTTcpSocket # GUSIMTTRecv(GUSIMTTcpSocket*) GUSIMTTRecvDone__FP7TCPiopb # GUSIMTTRecvDone(TCPiopb*) GUSIMTTSend__FP15GUSIMTTcpSocket # GUSIMTTSend(GUSIMTTcpSocket*) GUSIMTTSendDone__FP7TCPiopb # GUSIMTTSendDone(TCPiopb*) __vt__16GUSIMTUdpFactory # GUSIMTUdpFactory::__vt __vt__15GUSIMTUdpSocket # GUSIMTUdpSocket::__vt instance__16GUSIMTUdpFactory # GUSIMTUdpFactory::instance sRecvProc__15GUSIMTUdpSocket # GUSIMTUdpSocket::sRecvProc sSendProc__15GUSIMTUdpSocket # GUSIMTUdpSocket::sSendProc __dt__16GUSIMTUdpFactoryFv # GUSIMTUdpFactory::~GUSIMTUdpFactory() GUSIwithMTUdpSockets socket__16GUSIMTUdpFactoryFiii # GUSIMTUdpFactory::socket(int,int,int) __dt__15GUSIMTUdpSocketFv # GUSIMTUdpSocket::~GUSIMTUdpSocket() shutdown__15GUSIMTUdpSocketFi # GUSIMTUdpSocket::shutdown(int) select__15GUSIMTUdpSocketFPbPbPb # GUSIMTUdpSocket::select(bool*,bool*,bool*) sendto__15GUSIMTUdpSocketFRC12GUSIGathereriPCvUi # GUSIMTUdpSocket::sendto(const GUSIGatherer&,int,const void*,unsigned int) recvfrom__15GUSIMTUdpSocketFRC13GUSIScattereriPvPUi # GUSIMTUdpSocket::recvfrom(const GUSIScatterer&,int,void*,unsigned int*) connect__15GUSIMTUdpSocketFPvUi # GUSIMTUdpSocket::connect(void*,unsigned int) __ct__15GUSIMTUdpSocketFv # GUSIMTUdpSocket::GUSIMTUdpSocket() CreateStream__15GUSIMTUdpSocketFv # GUSIMTUdpSocket::CreateStream() GUSIMTURecv__FP15GUSIMTUdpSocket # GUSIMTURecv(GUSIMTUdpSocket*) GUSIMTURecvDone__FP7UDPiopb # GUSIMTURecvDone(UDPiopb*) GUSIMTUSend__FP15GUSIMTUdpSocket # GUSIMTUSend(GUSIMTUdpSocket*) GUSIMTUSendDone__FP7UDPiopb # GUSIMTUSendDone(UDPiopb*) sProtocols__9GUSINetDB # GUSINetDB::sProtocols sServices__20GUSIBuiltinServiceDB # GUSIBuiltinServiceDB::sServices __vt__20GUSIBuiltinServiceDB # GUSIBuiltinServiceDB::__vt __vt__17GUSIFileServiceDB # GUSIFileServiceDB::__vt __vt__13GUSIServiceDB # GUSIServiceDB::__vt __vt__9GUSINetDB # GUSINetDB::__vt sInstance__13GUSIServiceDB # GUSIServiceDB::sInstance sData__13GUSIServiceDB # GUSIServiceDB::sData sEntry__20GUSIBuiltinServiceDB # GUSIBuiltinServiceDB::sEntry sInstance__9GUSINetDB # GUSINetDB::sInstance __dt__64GUSISpecificDataFv # GUSISpecificData::~GUSISpecificData() __dt__80GUSISpecificDataFv # GUSISpecificData::~GUSISpecificData() get__64GUSISpecificDataFP17GUSISpecificTable # GUSISpecificData ::get(GUSISpecificTable*) get__80GUSISpecificDataFP17GUSISpecificTable # GUSISpecificData::get(GUSISpecificTable*) __dt__17GUSIFileServiceDBFv # GUSIFileServiceDB::~GUSIFileServiceDB() __dt__20GUSIBuiltinServiceDBFv # GUSIBuiltinServiceDB::~GUSIBuiltinServiceDB() __ct__11GUSIserventFv # GUSIservent::GUSIservent() GUSIKillHostEnt Alloc__11GUSIhostentFUl # GUSIhostent::Alloc(unsigned long) __ct__11GUSIhostentFv # GUSIhostent::GUSIhostent() Instance__13GUSIServiceDBFv # GUSIServiceDB::Instance() GUSIKillServiceDBData Next__20GUSIBuiltinServiceDBFv # GUSIBuiltinServiceDB::Next() Reset__20GUSIBuiltinServiceDBFv # GUSIBuiltinServiceDB::Reset() GUSIKillBuiltinServiceDBEntry Next__17GUSIFileServiceDBFv # GUSIFileServiceDB::Next() Reset__17GUSIFileServiceDBFv # GUSIFileServiceDB::Reset() __dt__13GUSIServiceDBFv # GUSIServiceDB::~GUSIServiceDB() Instance__17GUSIFileServiceDBFv # GUSIFileServiceDB::Instance() getprotobynumber__9GUSINetDBFi # GUSINetDB::getprotobynumber(int) getprotobyname__9GUSINetDBFPCc # GUSINetDB::getprotobyname(const char*) endprotoent__9GUSINetDBFv # GUSINetDB::endprotoent() setprotoent__9GUSINetDBFi # GUSINetDB::setprotoent(int) getprotoent__9GUSINetDBFv # GUSINetDB::getprotoent() getservbyport__9GUSINetDBFiPCc # GUSINetDB::getservbyport(int,const char*) getservbyname__9GUSINetDBFPCcPCc # GUSINetDB::getservbyname(const char*,const char*) endservent__9GUSINetDBFv # GUSINetDB::endservent() setservent__9GUSINetDBFi # GUSINetDB::setservent(int) getservent__9GUSINetDBFv # GUSINetDB::getservent() gethostname__9GUSINetDBFPci # GUSINetDB::gethostname(char*,int) gethostid__9GUSINetDBFv # GUSINetDB::gethostid() inet_addr__9GUSINetDBFPCc # GUSINetDB::inet_addr(const char*) inet_ntoa__9GUSINetDBF7in_addr # GUSINetDB::inet_ntoa(in_addr) gethostbyaddr__9GUSINetDBFPCvUli # GUSINetDB::gethostbyaddr(const void*,unsigned long,int) gethostbyname__9GUSINetDBFPCc # GUSINetDB::gethostbyname(const char*) __ct__9GUSINetDBFv # GUSINetDB::GUSINetDB() Instance__9GUSINetDBFv # GUSINetDB::Instance() __vt__14GUSINullSocket # GUSINullSocket::__vt __vt__14GUSINullDevice # GUSINullDevice::__vt sInstance__14GUSINullDevice # GUSINullDevice::sInstance __dt__14GUSINullDeviceFv # GUSINullDevice::~GUSINullDevice() __dt__14GUSINullSocketFv # GUSINullSocket::~GUSINullSocket() Supports__14GUSINullSocketFQ210GUSISocket12ConfigOption # GUSINullSocket::Supports(GUSISocket::ConfigOption) fstat__14GUSINullSocketFP4stat # GUSINullSocket::fstat(stat*) write__14GUSINullSocketFRC12GUSIGatherer # GUSINullSocket::write(const GUSIGatherer&) read__14GUSINullSocketFRC13GUSIScatterer # GUSINullSocket::read(const GUSIScatterer&) __ct__14GUSINullSocketFv # GUSINullSocket::GUSINullSocket() stat__14GUSINullDeviceFR13GUSIFileTokenP4stat # GUSINullDevice::stat(GUSIFileToken&,stat*) open__14GUSINullDeviceFv # GUSINullDevice::open() open__14GUSINullDeviceFR13GUSIFileTokeni # GUSINullDevice::open(GUSIFileToken&,int) Want__14GUSINullDeviceFR13GUSIFileToken # GUSINullDevice::Want(GUSIFileToken&) GUSIwithNullSockets __vt__13GUSIScatterer # GUSIScatterer::__vt __vt__20GUSIOTDatagramSocket # GUSIOTDatagramSocket::__vt __vt__18GUSIOTStreamSocket # GUSIOTStreamSocket::__vt __vt__12GUSIOTSocket # GUSIOTSocket::__vt __vt__14GUSIOTStrategy # GUSIOTStrategy::__vt __vt__21GUSIOTDatagramFactory # GUSIOTDatagramFactory::__vt __vt__13GUSIOTFactory # GUSIOTFactory::__vt __vt__19GUSIOTStreamFactory # GUSIOTStreamFactory::__vt sOK__13GUSIOTFactory # GUSIOTFactory::sOK __dt__19GUSIOTStreamFactoryFv # GUSIOTStreamFactory::~GUSIOTStreamFactory() __dt__13GUSIOTFactoryFv # GUSIOTFactory::~GUSIOTFactory() __dt__21GUSIOTDatagramFactoryFv # GUSIOTDatagramFactory::~GUSIOTDatagramFactory() select__20GUSIOTDatagramSocketFPbPbPb # GUSIOTDatagramSocket::select(bool*,bool*,bool*) __dt__Q23std80auto_ptr<24GUSIOTAddr<9TUnitData,5>,Q23std35_Single<24GUSIOTAddr<9TUnitData,5>>>Fv # std::auto_ptr, std::_Single>>::~auto_ptr() sendto__20GUSIOTDatagramSocketFRC12GUSIGathereriPCvUi # GUSIOTDatagramSocket::sendto(const GUSIGatherer&,int,const void*,unsigned int) __dt__13GUSIScattererFv # GUSIScatterer::~GUSIScatterer() recvfrom__20GUSIOTDatagramSocketFRC13GUSIScattereriPvPUi # GUSIOTDatagramSocket::recvfrom(const GUSIScatterer&,int,void*,unsigned int*) connect__20GUSIOTDatagramSocketFPvUi # GUSIOTDatagramSocket::connect(void*,unsigned int) getpeername__20GUSIOTDatagramSocketFPvPUi # GUSIOTDatagramSocket::getpeername(void*,unsigned int*) BindIfUnbound__20GUSIOTDatagramSocketFv # GUSIOTDatagramSocket::BindIfUnbound() __dt__20GUSIOTDatagramSocketFv # GUSIOTDatagramSocket::~GUSIOTDatagramSocket() Clone__20GUSIOTDatagramSocketFv # GUSIOTDatagramSocket::Clone() __ct__20GUSIOTDatagramSocketFP14GUSIOTStrategy # GUSIOTDatagramSocket::GUSIOTDatagramSocket(GUSIOTStrategy*) shutdown__18GUSIOTStreamSocketFi # GUSIOTStreamSocket::shutdown(int) select__18GUSIOTStreamSocketFPbPbPb # GUSIOTStreamSocket::select(bool*,bool*,bool*) sendto__18GUSIOTStreamSocketFRC12GUSIGathereriPCvUi # GUSIOTStreamSocket::sendto(const GUSIGatherer&,int,const void*,unsigned int) __dt__Q210GUSISocket17AddContextInScopeFv # GUSISocket::AddContextInScope::~AddContextInScope() recvfrom__18GUSIOTStreamSocketFRC13GUSIScattereriPvPUi # GUSIOTStreamSocket::recvfrom(const GUSIScatterer&,int,void*,unsigned int*) connect__18GUSIOTStreamSocketFPvUi # GUSIOTStreamSocket::connect(void*,unsigned int) accept__18GUSIOTStreamSocketFPvPUi # GUSIOTStreamSocket::accept(void*,unsigned int*) getpeername__18GUSIOTStreamSocketFPvPUi # GUSIOTStreamSocket::getpeername(void*,unsigned int*) listen__18GUSIOTStreamSocketFi # GUSIOTStreamSocket::listen(int) MopupEvents__18GUSIOTStreamSocketFv # GUSIOTStreamSocket::MopupEvents() Close__18GUSIOTStreamSocketFUl # GUSIOTStreamSocket::Close(unsigned long) __dt__18GUSIOTStreamSocketFv # GUSIOTStreamSocket::~GUSIOTStreamSocket() close__18GUSIOTStreamSocketFv # GUSIOTStreamSocket::close() Clone__18GUSIOTStreamSocketFv # GUSIOTStreamSocket::Clone() __ct__18GUSIOTStreamSocketFP14GUSIOTStrategy # GUSIOTStreamSocket::GUSIOTStreamSocket(GUSIOTStrategy*) Supports__12GUSIOTSocketFQ210GUSISocket12ConfigOption # GUSIOTSocket::Supports(GUSISocket::ConfigOption) setsockopt__12GUSIOTSocketFiiPvUi # GUSIOTSocket::setsockopt(int,int,void*,unsigned int) getsockopt__12GUSIOTSocketFiiPvPUi # GUSIOTSocket::getsockopt(int,int,void*,unsigned int*) ioctl__12GUSIOTSocketFUiPc # GUSIOTSocket::ioctl(unsigned int,char*) fcntl__12GUSIOTSocketFiPc # GUSIOTSocket::fcntl(int,char*) shutdown__12GUSIOTSocketFi # GUSIOTSocket::shutdown(int) getsockname__12GUSIOTSocketFPvPUi # GUSIOTSocket::getsockname(void*,unsigned int*) Unbind__12GUSIOTSocketFv # GUSIOTSocket::Unbind() BindToAddress__12GUSIOTSocketFP20GUSIOTAddr<5TBind,1> # GUSIOTSocket::BindToAddress(GUSIOTAddr*) bind__12GUSIOTSocketFPvUi # GUSIOTSocket::bind(void*,unsigned int) __dt__12GUSIOTSocketFv # GUSIOTSocket::~GUSIOTSocket() close__12GUSIOTSocketFv # GUSIOTSocket::close() __ct__12GUSIOTSocketFP14GUSIOTStrategy # GUSIOTSocket::GUSIOTSocket(GUSIOTStrategy*) __dt__Q212GUSIOTSocket4LockFv # GUSIOTSocket::Lock::~Lock() MopupEvents__12GUSIOTSocketFv # GUSIOTSocket::MopupEvents() CopyAddress__14GUSIOTStrategyFRC7TNetbufR7TNetbuf # GUSIOTStrategy::CopyAddress(const TNetbuf&,TNetbuf&) __dt__14GUSIOTStrategyFv # GUSIOTStrategy::~GUSIOTStrategy() CreateConfiguration__14GUSIOTStrategyFv # GUSIOTStrategy::CreateConfiguration() socket__21GUSIOTDatagramFactoryFiii # GUSIOTDatagramFactory::socket(int,int,int) socket__19GUSIOTStreamFactoryFiii # GUSIOTStreamFactory::socket(int,int,int) Initialize__13GUSIOTFactoryFv # GUSIOTFactory::Initialize() GUSIOTNotify __vt__15GUSIOTUdpSocket # GUSIOTUdpSocket::__vt __vt__17GUSIOTUdpStrategy # GUSIOTUdpStrategy::__vt __vt__15GUSIOTTcpSocket # GUSIOTTcpSocket::__vt __vt__17GUSIOTTcpStrategy # GUSIOTTcpStrategy::__vt __vt__18GUSIOTInetStrategy # GUSIOTInetStrategy::__vt __vt __16GUSIOTUdpFactory # GUSIOTUdpFactory::__vt __vt__16GUSIOTTcpFactory # GUSIOTTcpFactory::__vt sInstance__16GUSIOTUdpFactory # GUSIOTUdpFactory::sInstance sInstance__16GUSIOTTcpFactory # GUSIOTTcpFactory::sInstance __dt__16GUSIOTTcpFactoryFv # GUSIOTTcpFactory::~GUSIOTTcpFactory() __dt__16GUSIOTUdpFactoryFv # GUSIOTUdpFactory::~GUSIOTUdpFactory() __dt__17GUSIOTTcpStrategyFv # GUSIOTTcpStrategy::~GUSIOTTcpStrategy() __dt__15GUSIOTTcpSocketFv # GUSIOTTcpSocket::~GUSIOTTcpSocket() __dt__17GUSIOTUdpStrategyFv # GUSIOTUdpStrategy::~GUSIOTUdpStrategy() __dt__15GUSIOTUdpSocketFv # GUSIOTUdpSocket::~GUSIOTUdpSocket() GUSIwithOTInetSockets GUSIwithOTUdpSockets GUSIwithOTTcpSockets ioctl__15GUSIOTUdpSocketFUiPc # GUSIOTUdpSocket::ioctl(unsigned int,char*) setsockopt__15GUSIOTUdpSocketFiiPvUi # GUSIOTUdpSocket::setsockopt(int,int,void*,unsigned int) getsockopt__15GUSIOTUdpSocketFiiPvPUi # GUSIOTUdpSocket::getsockopt(int,int,void*,unsigned int*) Clone__15GUSIOTUdpSocketFv # GUSIOTUdpSocket::Clone() ConfigPath__17GUSIOTUdpStrategyFv # GUSIOTUdpStrategy::ConfigPath() ioctl__15GUSIOTTcpSocketFUiPc # GUSIOTTcpSocket::ioctl(unsigned int,char*) setsockopt__15GUSIOTTcpSocketFiiPvUi # GUSIOTTcpSocket::setsockopt(int,int,void*,unsigned int) getsockopt__15GUSIOTTcpSocketFiiPvPUi # GUSIOTTcpSocket::getsockopt(int,int,void*,unsigned int*) Clone__15GUSIOTTcpSocketFv # GUSIOTTcpSocket::Clone() ConfigPath__17GUSIOTTcpStrategyFv # GUSIOTTcpStrategy::ConfigPath() DoIoctl__18GUSIOTMInetOptionsFPiUiPc # GUSIOTMInetOptions::DoIoctl(int*,unsigned int,char*) DoSetSockOpt__18GUSIOTMInetOptionsFPiP9TEndpointiiPvUi # GUSIOTMInetOptions::DoSetSockOpt(int*,TEndpoint*,int,int,void*,unsigned int) DoGetSockOpt__18GUSIOTMInetOptionsFPiP9TEndpointiiPvPUi # GUSIOTMInetOptions::DoGetSockOpt(int*,TEndpoint*,int,int,void*,unsigned int*) UnpackAddress__18GUSIOTInetStrategyFRC7TNetbufPvPUi # GUSIOTInetStrategy::UnpackAddress(const TNetbuf&,void*,unsigned int*) PackAddress__18GUSIOTInetStrategyFPCvUiR7TNetbufb # GUSIOTInetStrategy::PackAddress(const void*,unsigned int,TNetbuf&,bool) socket__16GUSIOTUdpFactoryFiii # GUSIOTUdpFactory::socket(int,int,int) Strategy__16GUSIOTUdpFactoryFiii # GUSIOTUdpFactory::Strategy(int,int,int) Instance__16GUSIOTUdpFactoryFv # GUSIOTUdpFactory::Instance() socket__16GUSIOTTcpFactoryFiii # GUSIOTTcpFactory::socket(int,int,int) __dt__18GUSIOTInetStrategyFv # GUSIOTInetStrategy::~GUSIOTInetStrategy() Strategy__16GUSIOTTcpFactoryFiii # GUSIOTTcpFactory::Strategy(int,int,int) Instance__16GUSIOTTcpFactoryFv # GUSIOTTcpFactory::Instance() __vt__11GUSIOTNetDB # GUSIOTNetDB::__vt __dt__11GUSIOTNetDBFv # GUSIOTNetDB::~GUSIOTNetDB() gethostid__11GUSIOTNetDBFv # GUSIOTNetDB::gethostid() inet_ntoa__11GUSIOTNetDBF7in_addr # GUSIOTNetDB::inet_ntoa(in_addr) gethostbyaddr__11GUSIOTNetDBFPCvUli # GUSIOTNetDB::gethostbyaddr(const void*,unsigned long,int) gethostbyname__11GUSIOTNetDBFPCc # GUSIOTNetDB::gethostbyname(const char*) Resolver__11GUSIOTNetDBFv # GUSIOTNetDB::Resolver() Instantiate__11GUSIOTNetDBFv # GUSIOTNetDB::Instantiate() __ct__11GUSIOTNetDBFv # GUSIOTNetDB::GUSIOTNetDB() GUSIOTNetDBNotify __vt__14GUSIPipeSocket # GUSIPipeSocket::__vt __vt__15GUSIPipeFactory # GUSIPipeFactory::__vt sInstance__15GUSIPipeFactory # GUSIPipeFactory::sInstance __dt__15GUSIPipeFactoryFv # GUSIPipeFactory::~GUSIPipeFactory() shutdown__14GUSIPipeSocketFi # GUSIPipeSocket::shutdown(int) __dt__14GUSIPipeSocketFv # GUSIPipeSocket::~GUSIPipeSocket() select__14GUSIPipeSocketFPbPbPb # GUSIPipeSocket::select(bool*,bool*,bool*) write__14GUSIPipeSocketFRC12GUSIGatherer # GUSIPipeSocket::write(const GUSIGatherer&) read__14GUSIPipeSocketFRC13GUSIScatterer # GUSIPipeSocket::read(const GUSIScatterer&) Supports__14GUSIPipeSocketFQ210GUSISocket12ConfigOption # GUSIPipeSocket::Supports(GUSISocket::ConfigOption) WakeupPeer__14GUSIPipeSocketFv # GUSIPipeSocket::WakeupPeer() __ct__14GUSIPipeSocketFv # GUSIPipeSocket::GUSIPipeSocket() __dt__14GUSIErrorSaverFv # GUSIErrorSaver::~GUSIErrorSaver() socketpair__15GUSIPipeFactoryFiiiPP10GUSISocket # GUSIPipeFactory::socketpair(int,int,int,GUSISocket**) socket__15GUSIPipeFactoryFiii # GUSIPipeFactory::socket(int,int,int) GUSIwithLocalSockets __vt__12GUSIGatherer # GUSIGatherer::__vt get__40GUSISpecificDataFP17GUSISpecificTable # GUSISpecificData::get(GUSISpecificTable*) faccess__FPCcPUiPv # faccess(const char*,unsigned int*,void*) fsetfileinfo fgetfileinfo getservent getservbyport getservbyname getprotoent getprotobynumber getprotobyname gethostbyname gethostbyaddr endservent endprotoent setservent setprotoent gethostname gethostid inet_ntoa inet_addr inet_aton readlink symlink usleep truncate ftruncate setsockopt getsockopt ioctl shutdown getpeername getsockname select sendmsg sendto send writev recvmsg recvfrom recv readv accept listen connect bind socketpair socket getdtablesize mktime gmtime localtime __dt__40GUSISpecificDataFv # GUSISpecificData::~GUSISpecificData() GUSIKillTM gettimeofday time getcwd chdir closedir rewinddir seekdir telldir readdir opendir rmdir mkdir access utime chmod lstat stat rename unlink remove creat open sleep isatty lseek fstat dup2 dup fcntl __dt__12GUSIGathererFv # GUSIGatherer::~GUSIGatherer() write read close fsync pipe __vt__13GUSIPPCSocket # GUSIPPCSocket::__vt __vt__14GUSIPPCFactory # GUSIPPCFactory::__vt sDoneProc__13GUSIPPCSocket # GUSIPPCSocket::sDoneProc sListenProc__13GUSIPPCSocket # GUSIPPCSocket::sListenProc sRecvProc__13GUSIPPCSocket # GUSIPPCSocket::sRecvProc sSendProc__13GUSIPPCSocket # GUSIPPCSocket::sSendProc sInstance__14GUSIPPCFactory # GUSIPPCFactory::sInstance __dt__14GUSIPPCFactoryFv # GUSIPPCFactory::~GUSIPPCFactory() GUSIPPCListen__FP13GUSIPPCSocket # GUSIPPCListen(GUSIPPCSocket*) GUSIPPCRecv__FP13GUSIPPCSocket # GUSIPPCRecv(GUSIPPCSocket*) GUSIPPCSend__FP13GUSIPPCSocket # GUSIPPCSend(GUSIPPCSocket*) __dt__13GUSIPPCSocketFv # GUSIPPCSocket::~GUSIPPCSocket() shutdown__13GUSIPPCSocketFi # GUSIPPCSocket::shutdown(int) ioctl__13GUSIPPCSocketFUiPc # GUSIPPCSocket::ioctl(unsigned int,char*) fcntl__13GUSIPPCSocketFiPc # GUSIPPCSocket::fcntl(int,char*) select__13GUSIPPCSocketFPbPbPb # GUSIPPCSocket::select(bool*,bool*,bool*) sendto__13GUSIPPCSocketFRC12GUSIGathereriPCvUi # GUSIPPCSocket::sendto(const GUSIGatherer&,int,const void*,unsigned int) recvfrom__13GUSIPPCSocketFRC13GUSIScattereriPvPUi # GUSIPPCSocket::recvfrom(const GUSIScatterer&,int,void*,unsigned int*) Supports__13GUSIPPCSocketFQ210GUSISocket12ConfigOption # GUSIPPCSocket::Supports(GUSISocket::ConfigOption) __ct__13GUSIPPCSocketFP13GUSIPPCSocketRQ213GUSIPPCSocket8Listener # GUSIPPCSocket::GUSIPPCSocket(GUSIPPCSocket*,GUSIPPCSocket::Listener&) accept__13GUSIPPCSocketFPvPUi # GUSIPPCSocket::accept(void*,unsigned int*) listen__13GUSIPPCSocketFi # GUSIPPCSocket::listen(int) connect__13GUSIPPCSocketFPvUi # GUSIPPCSocket::connect(void*,unsigned int) bind__13GUSIPPCSocketFPvUi # GUSIPPCSocket::bind(void*,unsigned int) __ct__13GUSIPPCSocketFv # GUSIPPCSocket::GUSIPPCSocket() GUSIPPCDone__FP16PPCParamBlockRec # GUSIPPCDone(PPCParamBlockRec*) GUSIPPCListenDone__FP16PPCParamBlockRec # GUSIPPCListenDone(PPCParamBlockRec*) GUSIPPCRecvDone__FP16PPCParamBlockRec # GUSIPPCRecvDone(PPCParamBlockRec*) GUSIPPCSendDone__FP16PPCParamBlockRec # GUSIPPCSendDone(PPCParamBlockRec*) SetupListener__13GUSIPPCSocketFRQ213GUSIPPCSocket8Listener # GUSIPPCSocket::SetupListener(GUSIPPCSocket::Listener&) socket__14GUSIPPCFactoryFiii # GUSIPPCFactory::socket(int,int,int) GUSIwithPPCSockets sDefault__15GUSIPThreadAttr # GUSIPThreadAttr::sDefault sDefaultAttr__15GUSIPThreadAttr # GUSIPThreadAttr::sDefaultAttr sched_yield pthread_once pthread_equal pthread_self pthread_cond_broadcast pthread_cond_signal pthread_cond_timedwait pthread_cond_wait pthread_cond_destroy pthread_cond_init pthread_condattr_destroy pthread_condattr_init pthread_mutex_unlock pthread_mutex_trylock pthread_mutex_lock pthread_mutex_destroy pthread_mutex_init pthread_mutexattr_destroy pthread_mutexattr_init pthread_setspecific pthrea d_getspecific pthread_key_delete pthread_key_create pthread_exit pthread_join pthread_detach pthread_create pthread_attr_setstacksize pthread_attr_getstacksize pthread_attr_setdetachstate pthread_attr_getdetachstate pthread_attr_destroy pthread_attr_init __vt__10GUSISocket # GUSISocket::__vt fstat__10GUSISocketFP4stat # GUSISocket::fstat(stat*) sendmsg__10GUSISocketFPC6msghdri # GUSISocket::sendmsg(const msghdr*,int) sendto__10GUSISocketFRC12GUSIGathereriPCvUi # GUSISocket::sendto(const GUSIGatherer&,int,const void*,unsigned int) write__10GUSISocketFRC12GUSIGatherer # GUSISocket::write(const GUSIGatherer&) recvmsg__10GUSISocketFP6msghdri # GUSISocket::recvmsg(msghdr*,int) recvfrom__10GUSISocketFRC13GUSIScattereriPvPUi # GUSISocket::recvfrom(const GUSIScatterer&,int,void*,unsigned int*) read__10GUSISocketFRC13GUSIScatterer # GUSISocket::read(const GUSIScatterer&) select__10GUSISocketFPbPbPb # GUSISocket::select(bool*,bool*,bool*) post_select__10GUSISocketFbbb # GUSISocket::post_select(bool,bool,bool) pre_select__10GUSISocketFbbb # GUSISocket::pre_select(bool,bool,bool) isatty__10GUSISocketFv # GUSISocket::isatty() fsync__10GUSISocketFv # GUSISocket::fsync() lseek__10GUSISocketFli # GUSISocket::lseek(long,int) accept__10GUSISocketFPvPUi # GUSISocket::accept(void*,unsigned int*) shutdown__10GUSISocketFi # GUSISocket::shutdown(int) ftruncate__10GUSISocketFl # GUSISocket::ftruncate(long) ioctl__10GUSISocketFUiPc # GUSISocket::ioctl(unsigned int,char*) fcntl__10GUSISocketFiPc # GUSISocket::fcntl(int,char*) setsockopt__10GUSISocketFiiPvUi # GUSISocket::setsockopt(int,int,void*,unsigned int) getsockopt__10GUSISocketFiiPvPUi # GUSISocket::getsockopt(int,int,void*,unsigned int*) connect__10GUSISocketFPvUi # GUSISocket::connect(void*,unsigned int) listen__10GUSISocketFi # GUSISocket::listen(int) getpeername__10GUSISocketFPvPUi # GUSISocket::getpeername(void*,unsigned int*) getsockname__10GUSISocketFPvPUi # GUSISocket::getsockname(void*,unsigned int*) bind__10GUSISocketFPvUi # GUSISocket::bind(void*,unsigned int) RemoveContext__10GUSISocketFP11GUSIContext # GUSISocket::RemoveContext(GUSIContext*) AddContext__10GUSISocketFP11GUSIContext # GUSISocket::AddContext(GUSIContext*) __dt__10GUSISocketFv # GUSISocket::~GUSISocket() Close__10GUSISocketFUl # GUSISocket::Close(unsigned long) CheckClose__10GUSISocketFUl # GUSISocket::CheckClose(unsigned long) close__10GUSISocketFv # GUSISocket::close() Dequeue__10GUSISocketFv # GUSISocket::Dequeue() Enqueue__10GUSISocketFPP10GUSISocket # GUSISocket::Enqueue(GUSISocket**) Supports__10GUSISocketFQ210GUSISocket12ConfigOption # GUSISocket::Supports(GUSISocket::ConfigOption) __ct__10GUSISocketFv # GUSISocket::GUSISocket() __ct__10GUSImsghdrFRC13GUSIScattGathPCvUi # GUSImsghdr::GUSImsghdr(const GUSIScattGath&,const void*,unsigned int) sKeyAlloc__17GUSISpecificTable # GUSISpecificTable::sKeyAlloc sKeys__17GUSISpecificTable # GUSISpecificTable::sKeys sNextID__12GUSISpecific # GUSISpecific::sNextID Destruct__17GUSISpecificTableFP12GUSISpecific # GUSISpecificTable::Destruct(GUSISpecific*) Register__17GUSISpecificTableFP12GUSISpecific # GUSISpecificTable::Register(GUSISpecific*) DeleteSpecific__17GUSISpecificTableFPC12GUSISpecific # GUSISpecificTable::DeleteSpecific(const GUSISpecific*) SetSpecific__17GUSISpecificTableFPC12GUSISpecificPv # GUSISpecificTable::SetSpecific(const GUSISpecific*,void*) __dt__17GUSISpecificTableFv # GUSISpecificTable::~GUSISpecificTable() __vt__9GUSITimer # GUSITimer::__vt sTimerQueue__9GUSITimer # GUSITimer::sTimerQueue sTimerProc__9GUSITimer # GUSITimer::sTimerProc sTimeZone__8GUSITime # GUSITime::sTimeZone sTimeOffset__8GUSITime # GUSITime::sTimeOffset __dt__53GUSISpecificDataFv # GUSISpecificData::~GUSISpecificData() get__53GUSISpecificDataFP17GUSISpecificTable # GUSISpecificData::get(GUSISpecificTable*) __dt__9GUSITimerFv # GUSITimer::~GUSITimer() Kill__9GUSITimerFv # GUSITimer::Kill() Reset__9GUSITimerFv # GUSITimer::Reset() Sleep__9GUSITimerFlb # GUSITimer::Sleep(long,bool) __ct__9GUSITimerFbP11GUSIContext # GUSITimer::GUSITimer(bool,GUSIContext*) GUSIKillTimers __dt__Q29GUSITimer10TimerQueueFv # GUSITimer::TimerQueue::~TimerQueue() Wakeup__9GUSITimerFv # GUSITimer::Wakeup() GM2LocalTime__8GUSITimeFv # GUSITime::GM2LocalTime() Local2GMTime__8GUSITimeFv # GUSITime::Local2GMTime() Zone__8GUSITimeFv # GUSITime::Zone() Now__8GUSITimeFv # GUSITime::Now() __ct__8GUSITimeFRCQ23std2tm # GUSITime::GUSITime(const std::tm&) __opQ23std2tm__8GUSITimeFv # GUSITime::operator std::tm() __op8timespec__8GUSITimeFv # GUSITime::operator timespec() __op7timeval__8GUSITimeFv # GUSITime::operator timeval() Deconstruct__8GUSITimeFRx # GUSITime::Deconstruct(long long&) Get64__8GUSITimeFQ28GUSITime6Format # GUSITime::Get64(GUSITime::Format) __ct__8GUSITimeFRC8timespec # GUSITime::GUSITime(const timespec&) __ct__8GUSITimeFRC7timeval # GUSITime::GUSITime(const timeval&) Construct__8GUSITimeFxQ28GUSITime6Format # GUSITime::Construct(long long,GUSITime::Format) __vt__9GUSIAlarm # GUSIAlarm::__vt __vt__14GUSISigFactory # GUSISigFactory::__vt __vt__14GUSISigProcess # GUSISigProcess::__vt __vt__14GUSISigContext # GUSISigContext::__vt ualarm __dt__9GUSIAlarmFv # GUSIAlarm::~GUSIAlarm() __dt__Q23std48auto_ptr<9GUSIAlarm,Q23std19_Single<9GUSIAlarm>>Fv # std::auto_ptr>::~auto_ptr() alarm Restart__9GUSIAlarmFl # GUSIAlarm::Restart(long) Wakeup__9GUSIAlarmFv # GUSIAlarm::Wakeup() _exit abort__Fv # abort() sigwait pause sigsuspend sigprocmask pthread_sigmask sigpending signal sigaction pthread_kill raise sigismember sigfillset sigemptyset sigdelset sigaddset CreateSigContext__14GUSISigFactoryFPC14GUSISigContext # GUSISigFactory::CreateSigContext(const GUSISigContext*) CreateSigProcess__14GUSISigFactoryFv # GUSISigFactory::CreateSigProcess() __dt__14GUSISigFactoryFv # GUSISigFactory::~GUSISigFactory() __dt__Q23std60auto_ptr<14GUSISigFactory,Q23std25_Single<14GUSISigFactory>>Fv # std::auto_ptr>::~auto_ptr() SetInstance__14GUSISigFactoryFP14GUSISigFactory # GUSISigFactory::SetInstance(GUSISigFactory*) Instance__14GUSISigFactoryFv # GUSISigFactory::Instance() DefaultAction__14GUSISigProcessFiRC9sigaction # GUSISigProcess::DefaultAction(int,const sigaction&) Raise__14GUSISigProcessFiP14GUSISigContext # GUSISigProcess::Raise(int,GUSISigContext*) Post__14GUSISigProcessFi # GUSISigProcess::Post(int) ClearPending__14GUSISigProcessFUi # GUSISigProcess::ClearPending(unsigned int) Pending__14GUSISigProcessCFv # GUSISigProcess::Pending() const SetAction__14GUSISigProcessFiRC9sigaction # GUSISigProcess::SetAction(int,const sigaction&) CantIgnore__14GUSISigProcessFi # GUSISigProcess::CantIgnore(int) CantCatch__14GUSISigProcessFi # GUSISigProcess::CantCatch(int) GetAction__14GUSISigProcessFi # GUSISigProcess::GetAction(int) __dt__14GUSISigProcessFv # GUSISigProcess::~GUSISigProcess() __ct__14GUSISigProcessFv # GUSISigProcess::GUSISigProcess() Raise__14GUSISigContextFP14GUSISigProcessb # GUSISigContext::Raise(GUSISigProcess*,bool) Ready__14GUSISigContextFP14GUSISigProcess # GUSISigContext::Ready(GUSISigProcess*) Pending__14GUSISigContextCFP14GUSISigProcess # GUSISigContext::Pending(GUSISigProcess*) const Post__14GUSISigContextFi # GUSISigContext::Post(int) ClearPending__14GUSISigContextFUi # GUSISigContext::ClearPending(unsigned int) Pending__14GUSISigContextCFv # GUSISigContext::Pending() const SetBlocked__14GUSISigContextFUi # GUSISigContext::SetBlocked(unsigned int) GetBlocked__14GUSISigContextCFv # GUSISigContext::GetBlocked() const CantBlock__14GUSISigContextFv # GUSISigContext::CantBlock() __dt__14GUSISigContextFv # GUSISigContext::~GUSISigContext() __ct__14GUSISigContextFPC14GUSISigContext # GUSISigContext::GUSISigContext(const GUSISigContext*) atan atan2 memmove memcpy pow exp log log10 sqrt strcmp strlen strncmp sin cos atan_d_d atan2_d_dd atan_d_pd atan2_d_pdpd atan_r_r atan2_r_rr atan_r_pr atan2_r_prpr po wer_d_dd exp_d_d exp_d_pd exp_r_r exp_r_pr log_d_d log_d_pd log10_d_d log10_d_pd sqrt_d_d sqrt_d_pd sqrt_r_r sqrt_r_pr sin_d_d sin_d_pd sin_r_r sin_r_pr cos_d_d cos_d_pd cos_r_r cos_r_pr __dc_arr __del_arr __new_arr __init_arr __copy __som_check_ev __som_check_new __vt__Q23std13bad_exception # std::bad_exception::__vt __vt__Q23std9exception # std::exception::__vt what__Q23std9exceptionCFv # std::exception::what() const what__Q23std13bad_exceptionCFv # std::bad_exception::what() const __end__catch __throw __dt__Q23std9exceptionFv # std::exception::~exception() __unexpected __dt__Q23std13bad_exceptionFv # std::bad_exception::~bad_exception() __unregister_fragment __register_fragment __global_destructor_chain __destroy_global_chain __register_global_object __destroy_new_array3 __destroy_new_array2 __destroy_new_array __destroy_arr __construct_array __dt__26__partial_array_destructorFv # __partial_array_destructor::~__partial_array_destructor() __construct_new_array __throw_catch_compare unexpected__3stdFv # std::unexpected() set_unexpected__3stdFPFv_v # std::set_unexpected(void (*)(void)) terminate__3stdFv # std::terminate() set_terminate__3stdFPFv_v # std::set_terminate(void (*)(void)) __vt__Q23std8bad_cast # std::bad_cast::__vt __vt__Q23std10bad_typeid # std::bad_typeid::__vt what__Q23std10bad_typeidCFv # std::bad_typeid::what() const what__Q23std8bad_castCFv # std::bad_cast::what() const __dynamic_cast __dt__Q23std8bad_castFv # std::bad_cast::~bad_cast() __get_typeid __dt__Q23std10bad_typeidFv # std::bad_typeid::~bad_typeid() nothrow__3std # std::nothrow __dla__FPvRCQ23std9nothrow_t # operator delete[](void*,const std::nothrow_t&) __dl__FPvRCQ23std9nothrow_t # operator delete(void*,const std::nothrow_t&) __dla__FPv # operator delete[](void*) __nwa__FUlRCQ23std9nothrow_t # operator new[](unsigned long,const std::nothrow_t&) __nwa__FUl # operator new[](unsigned long) __dl__FPv # operator delete(void*) __nw__FUlRCQ23std9nothrow_t # operator new(unsigned long,const std::nothrow_t&) __nw__FUl # operator new(unsigned long) __throws_bad_alloc__3std # std::__throws_bad_alloc __vt__Q23std9bad_alloc # std::bad_alloc::__vt __new_handler__3std # std::__new_handler what__Q23std9bad_allocCFv # std::bad_alloc::what() const __del_hdl __new_hdl set_new_handler__3stdFPFv_v # std::set_new_handler(void (*)(void)) __throw_bad_alloc__3stdFv # std::__throw_bad_alloc() __dt__Q23std9bad_allocFv # std::bad_alloc::~bad_alloc() qd exit __console_exit __stdio_exit __aborting __exit exit __atexit atexit fix_start vec_free vec_realloc vec_calloc vec_malloc __pool_free_all calloc realloc free malloc __msize deallocate_from_fixed_pools allocate_from_fixed_pools __files __flush_line_buffered_output_files __flush_all __close_all __init_file __find_unopened_file __llmod __lmod __mod __lldiv __ldiv __div __llmul __lmul __mul __lladd __ladd __add lldiv ldiv div llabs labs abs __assertion_failed bsearch setbuf setvbuf __flush_buffer __load_buffer __prep_buffer __convert_to_newlines __convert_from_newlines ccommand puts fputs putchar putc fputc __put_char __ungotten ungetc gets fgets getchar getc fgetc __get_char __ctype_map __lower_map __upper_map fwrite fread errno _splitpath _makepath _strrev _itow _itoa _strspnp _strnset _strset _strdate _strupr _wstrrev _strnicmp _stricmp _heapmin _gcvt _ultoa _strlwr _wcsspnp _wcsnset _wcsset _wcsrev _wcsnicmp _wcsicmp _wcsupr _wcslwr __temp_file_mode __set_idle_proc __get_file_modes __handle_reopen __handle_open __reopen freopen fopen fflush fclose tmpfile tmpnam __rename_file __delete_file __temp_file_name rewind fsetpos fseek _fseek fgetpos ftell _ftell __lconv localeconv setlocale wcstombs mbstowcs wctomb mbtowc mblen memcmp __memrchr memchr memset __fill_mem __copy_longs_rev_unaligned __copy_longs_unaligned __copy_longs_rev_aligned __copy_longs_aligned __move_mem __copy_mem __stdio_atexit perror ferror feof clearerr __path2fss __sys_pointer_size __sys_free __sys_alloc sprintf snprintf vsprintf vsnprintf vfprintf vprintf fprintf printf __StringWrite __FileWrite qsort srand rand sscanf vsscanf vfscanf scanf fscanf __StringRead __FileRead __strerror strerror strstr strtok strcspn strspn strpbrk strrchr strxfrm strcoll strchr strncat strcat strncpy strcpy atof strtod strtold __strtold atol atoi strtoll strtol strtoull strtoul __strtoull __strtoul system getenv __month_to_days strftime ctime asctime difftime clock __leap_year __to_gm_time __get_time __get_clock _fcntl _creat _open _mkdir _fstat _stat _write _unlink _ttyname _sleep _rmdir _read _lseek _isatty _getlogin _getcwd _exec _cuserid _close _chdir __new_umask _fileno _umask _ftype _fcreator _chmod __gettype __getcreator __ctopstring __system7present utimes _uname __float_nan __float_huge __double_min __double_max __double_epsilon __double_tiny __double_huge __double_nan __extended_min __extended_max __extended_epsilon __extended_tiny __extended_huge __extended_nan fwide fgetws fputws ungetwc fgetwc getwchar getwc fputwc putwchar putwc watof wcstod __wcstold watol watoi wcstoll wcstol wcstoull wcstoul __wcstoull __wcstoul wctrans towctrans __wctype_map __wlower_map __wupper_map iswctype wctype wctob wmemcmp wmemchr wmemset wmemmove wmemcpy vswprintf swprintf vfwprintf vwprintf fwprintf wprintf __wStringWrite __wFileWrite swscanf vswscanf vfwscanf vwscanf wscanf fwscanf __wStringRead __wFileRead wcsstr wcstok wcscspn wcsspn wcspbrk wcsrchr wcsxfrm wcscoll wcschr wcsncmp wcscmp wcsncat wcscat wcsncpy wcscpy wcslen wcsftime wctime wasctime __fminl __fmaxl __fdiml __nextafterl __remquol __copysignl __remainderl __fmodl __modfl __truncl llroundl lroundl __roundl llrintl lrintl __rintl __nearbyintl __floorl __ceill __lgammal __gammal __erfcl __erfl __hypotl __sqrtl __powl __fabsl scalblnl scalbnl __logbl __log2l __log1pl __expm1l __exp2l __log10l __logl __ldexpl __frexpl __expl __atanhl __asinhl __acoshl __tanhl __sinhl __coshl __tanl __sinl __cosl __atan2l __atanl __asinl __acosl fminf fmaxf fdimf remquof copysignf remainderf fmodf truncf llroundf lroundf roundf llrintf lrintf rintf nearbyintf floorf ceilf lgammaf gammaf erfcf erff hypotf sqrtf powf fabsf scalblnf scalbnf logbf log2f log1pf expm1f exp2f log10f logf ldexpf frexpf expf atanhf asinhf acoshf tanhf sinhf coshf tanf sinf cosf atan2f atanf asinf acosf nextafter llround lround llrint lrint scalbln scalbn clrscr getch kbhit SIOUXSetTitle __ttyname ReadCharsFromConsole WriteCharsToConsole RemoveConsole InstallConsole SIOUXHandleOneEvent SIOUXisinrange SIOUXDragRect SIOUXBigRect SIOUXSettings SIOUXTextWindow SIOUXState SIOUXUseWaitNextEvent SIOUXQuitting SIOUXselstart SIOUXDoMenuChoice SIOUXDoEditSelectAll SIOUXDoEditClear SIOUXDoEditPaste SIOUXDoEditCopy SIOUXDoEditCut SIOUXDoSaveText SIOUXUpdateMenuItems SIOUXSetupMenus SIOUXDoPrintText SIOUXDoPageSetup SIOUXYesNoCancelAlert SIOUXCantSaveAlert SIOUXSetupTextWindow SIOUXDoContentClick SIOUXMyGrowWindow SIOUXUpdateStatusLine MoveScrollBox SIOUXUpdateScrollbar SIOUXUpdateWindow SIOUXDrawGrowBox AdjustText SIOUXIsAppWindow OTAsyncOpenInternetServices OTOpenInternetServices InitOpenTransportUtilities CloseOpenTransport OTRegisterAsClient OTUnregisterAsClient OTAllocMem InitOpenTransport OTAlloc OTOpenProvider OTOpenMapper OTOpenEndpoint OTAsyncOpenProvider OTAsyncOpenMapper OTAsyncOpenEndpoint OTTransferProviderOwnership OTWhoAmI OTCloseProvider t_alloc t_open t_close __gOTClientRecord InitOpenTransportCommon SetupOpenTransport __gLibraryManager __gSLMGlobal OTCreateDeferredTask OTCreateSystemTask OTOpenProviderOnStream OTOpenEndpointOnStream OTStreamOpen OTAsyncStreamOpen stream_open stream_pipe OTStreamPipe AEGetDescData AEGetDescDataSize AEReplaceDescData GetControlBounds IsControlHilited GetControlHilite GetControlDataHandle GetControlOwner GetControlPopupMenuHandle GetControlPopupMenuID SetControlBounds SetControlDataHandle SetControlPopupMenuHandle SetControlPopupMenuID GetDialogWindow GetDialogTextEditHandle GetDialogDefaultItem GetDialogCancelItem GetDialogKeyboardFocusItem SetPortDialogPort GetDialogPort GetDialogFromWindow GetParamText GetCorrectPort GetPortPixMap GetPortBounds IsPortRegionBeingDefined IsPortPictureBeingDefined IsPortOffsc reen GetPortVisibleRegion GetPortClipRegion GetPortForeColor GetPortBackColor GetPortBackPixPatDirect GetPortBackPixPat GetPortPenPixPatDirect GetPortPenPixPat GetPortFillPixPat GetPortTextFont GetPortTextFace GetPortTextMode GetPortFracHPenLocation GetPortChExtra GetPortPenVisibility GetPortSpExtra GetPortTextSize GetPortGrafProcs GetPortOpColor GetPortHiliteColor GetPixBounds GetPixDepth GetPortPenSize GetPortPenMode GetPortPenLocation GetPortPrintingReference SetPortBounds SetPortVisibleRegion SetPortClipRegion SetPortPenPixPatDirect SetPortPenPixPat SetPortBackPixPatDirect SetPortBackPixPat SetPortOpColor SetPortPenSize SetPortPenMode SetPortFracHPenLocation SetPortGrafProcs SetPortPrintingReference GetQDGlobalsRandomSeed GetQDGlobalsScreenBits GetQDGlobalsArrow GetQDGlobalsDarkGray GetQDGlobalsLightGray GetQDGlobalsGray GetQDGlobalsBlack GetQDGlobalsWhite GetQDGlobalsThePort SetQDGlobalsArrow SetQDGlobalsRandomSeed GetRegionBounds IsRegionRectangular CreateNewPort DisposePort SetQDError GetWindowPort GetWindowKind IsWindowVisible IsWindowHilited IsWindowUpdatePending GetWindowGoAwayFlag GetWindowSpareFlag GetWindowStandardState GetWindowUserState SetWindowKind SetWindowStandardState SetWindowUserState SetPortWindowPort GetWindowPortBounds GetWindowFromPort IsTSMTEDialog GetTSMTEDialogDocumentID GetTSMTEDialogTSMTERecHandle SetTSMTEDialogDocumentID SetTSMTEDialogTSMTERecHandle GetMenuID GetMenuWidth GetMenuHeight GetMenuTitle SetMenuID SetMenuWidth SetMenuHeight SetMenuTitle GetGlobalMouse GetListViewBounds GetListPort GetListCellIndent GetListCellSize GetListVisibleCells GetListVerticalScrollBar GetListHorizontalScrollBar GetListFlags GetListSelectionFlags GetListActive GetListClickTime GetListClickLocation GetListMouseLocation GetListClickLoop GetListRefCon GetListDefinition GetListUserHandle GetListDataBounds GetListDataHandle SetListViewBounds SetListPort SetListCellIndent SetListClickTime SetListClickLoop SetListLastClick SetListRefCon SetListFlags SetListSelectionFlags SetListUserHandle GrabSpecifiedCFMSymbol CopyPascalStringToC CopyCStringToPascal p2cstrcpy GetQDGlobals GetWindowList GetNextWindow \ No newline at end of file --- 1,2586 ---- ! sSuffices ! GUSISetupConfig ! GUSISetupDevices ! GUSISetupFactories ! __vt__15GUSISIOUXDevice # GUSISIOUXDevice::__vt ! __vt__15GUSISIOUXSocket # GUSISIOUXSocket::__vt ! sInstance__15GUSISIOUXDevice # GUSISIOUXDevice::sInstance [...2559 lines suppressed...] ! GetListUserHandle ! GetListDataBounds ! GetListDataHandle ! SetListViewBounds ! SetListPort ! SetListCellIndent ! SetListClickTime ! SetListClickLoop ! SetListLastClick ! SetListRefCon ! SetListFlags ! SetListSelectionFlags ! SetListUserHandle ! GrabSpecifiedCFMSymbol ! CopyPascalStringToC ! CopyCStringToPascal ! p2cstrcpy ! GetQDGlobals ! GetWindowList ! GetNextWindow From jackjansen@users.sourceforge.net Sat May 12 22:08:48 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 14:08:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Build PythonCore.mcp,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv8100/Python/Mac/Build Modified Files: PythonCore.mcp Log Message: Added iterobject.c to the project. And trying my first checkin at the same time. Index: PythonCore.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonCore.mcp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 Binary files /tmp/cvshARD7d and /tmp/cvsep6CKj differ From jackjansen@users.sourceforge.net Sat May 12 22:08:59 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 14:08:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Build PythonCoreCarbon.exp,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv8150/Python/Mac/Build Modified Files: PythonCoreCarbon.exp Log Message: Added iterobject.c to the project. And trying my first checkin at the same time. Index: PythonCoreCarbon.exp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonCoreCarbon.exp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** PythonCoreCarbon.exp 2001/04/25 22:11:20 1.6 --- PythonCoreCarbon.exp 2001/05/12 21:08:56 1.7 *************** *** 1 **** ! sSuffices GUSISetupConfig GUSISetupDevices GUSISetupFactories __vt__15GUSISIOUXDevice # GUSISIOUXDevice::__vt __vt__15GUSISIOUXSocket # GUSISIOUXSocket::__vt sInstance__15GUSISIOUXDevice # GUSISIOUXDevice::sInstance sInstance__15GUSISIOUXSocket # GUSISIOUXSocket::sInstance __dt__15GUSISIOUXDeviceFv # GUSISIOUXDevice::~GUSISIOUXDevice() GUSISetupConsoleDescriptors open__15GUSISIOUXDeviceFR13GUSIFileTokeni # GUSISIOUXDevice::open(GUSIFileToken&,int) Want__15GUSISIOUXDeviceFR13GUSIFileToken # GUSISIOUXDevice::Want(GUSIFileToken&) __dt__10GUSIDeviceFv # GUSIDevice::~GUSIDevice() Instance__15GUSISIOUXDeviceFv # GUSISIOUXDevice::Instance() select__15GUSISIOUXSocketFPbPbPb # GUSISIOUXSocket::select(bool*,bool*,bool*) isatty__15GUSISIOUXSocketFv # GUSISIOUXSocket::isatty() fstat__15GUSISIOUXSocketFP4stat # GUSISIOUXSocket::fstat(stat*) ioctl__15GUSISIOUXSocketFUiPc # GUSISIOUXSocket::ioctl(unsigned int,char*) write__15GUSISIOUXSocketFRC12GUSIGatherer # GUSISIOUXSocket::write(const GUSIGatherer&) read__15GUSISIOUXSocketFRC13GUSIScatterer # GUSISIOUXSocket::read(const GUSIScatterer&) __dt__15GUSISIOUXSocketFv # GUSISIOUXSocket::~GUSISIOUXSocket() Initialize__15GUSISIOUXSocketFv # GUSISIOUXSocket::Initialize() __ct__15GUSISIOUXSocketFv # GUSISIOUXSocket::GUSISIOUXSocket() Instance__15GUSISIOUXSocketFv # GUSISIOUXSocket::Instance() _PyBuiltin_Init _PyEval_SliceIndex PyEval_CallObjectWithKeywords PyEval_CallObject Py_FlushLine PyEval_GetNestedScopes PyEval_GetRestricted PyEval_GetFrame PyEval_GetGlobals PyEval_GetLocals PyEval_GetBuiltins PyEval_EvalCode Py_SetRecursionLimit Py_GetRecursionLimit Py_MakePendingCalls Py_AddPendingCall PyEval_RestoreThread PyEval_SaveThread PyEval_ReInitThreads PyEval_ReleaseThread PyEval_AcquireThread PyEval_ReleaseLock PyEval_AcquireLock PyEval_InitThreads PyArg_GetFloatArray PyArg_GetDoubleArray PyArg_GetShortArray PyArg_GetLongArray PyArg_GetShortArraySize PyArg_GetLongArraySize PyArg_GetChar PyArg_GetString PyArg_GetFloat PyArg_GetShort PyArg_GetLong PyArg_GetObject PyErr_ProgramText PyErr_SyntaxLocation PyErr_WarnExplicit PyErr_Warn PyErr_WriteUnraisable PyErr_NewException PyErr_Format PyErr_BadInternalCall _PyErr_BadInternalCall PyErr_SetFromErrno PyErr_SetFromErrnoWithFilename PyErr_NoMemory PyErr_BadArgument PyErr_Clear PyErr_Fetch PyErr_NormalizeException PyErr_ExceptionMatches PyErr_GivenExceptionMatches PyErr_Occurred PyErr_SetString PyErr_SetNone PyErr_SetObject PyErr_Restore PyImport_FrozenModules PyArg_ParseTupleAndKeywords PyArg_VaParse PyArg_ParseTuple PyArg_Parse Py_GetCopyright PyOS_GetLastModificationTime _PyOS_opterr _PyOS_optind _PyOS_optarg _PyOS_GetOpt Py_GetVersion _PyParser_Grammar PyImport_Inittab _PyImport_Filetab PyImport_AppendInittab PyImport_ExtendInittab initimp PyImport_Import PyImport_ReloadModule PyImport_ImportModuleEx PyImport_ImportModule PyImport_ImportFrozenModule PyImport_ExecCodeModuleEx PyImport_ExecCodeModule PyImport_AddModule _PyImport_FindExtension _PyImport_FixupExtension PyImport_GetMagicNumber PyImport_Cleanup PyImport_GetModuleDict _PyImport_Fini _PyImport_Init _PyImport_LoadDynamicModule PyMarshal_Init PyMarshal_WriteObjectToString PyMarshal_ReadObjectFromString PyMarshal_ReadObjectFromFile PyMarshal_ReadLastObjectFromFile PyMarshal_ReadLongFromFile PyMarshal_WriteObjectToFile PyMarshal_WriteLongToFile _Py_PackageContext PyModule_AddStringConstant PyModule_AddIntConstant PyModule_AddObject PyEval_CallMethod PyEval_CallFunction Py_VaBuildValue Py_BuildValue Py_InitModule4 PyOS_strtol PyOS_strtoul Py_UseClassExceptionsFlag Py_DebugFlag Py_VerboseFlag Py_InteractiveFlag Py_NoSiteFlag Py_FrozenFlag _PyThread_Started Py_UnicodeFlag PyOS_setsig PyOS_getsig Py_FdIsInteractive Py_Exit Py_AtExit Py_FatalError PyParser_SimpleParseString PyParser_SimpleParseFile Py_SymtableString Py_CompileStringFlags Py_CompileString PyRun_FileExFlags PyRun_FileFlags PyRun_StringFlags PyRun_FileEx PyRun_File PyRun_String PyErr_Display PyErr_PrintEx PyErr_Print PyRun_SimpleString PyRun_SimpleFileExFlags PyRun_SimpleFileEx PyRun_SimpleFile PyRun_InteractiveOneFlags PyRun_InteractiveOne PyRun_InteractiveLoopFlags PyRun_InteractiveLoop PyRun_AnyFileExFlags PyRun_AnyFileEx PyRun_AnyFileFlags PyRun_AnyFile Py_GetPythonHome Py_SetPythonHome Py_GetProgramName Py_SetProgramName Py_EndInterpreter Py_NewInterpreter Py_Finalize Py_Initialize Py_IsInitialized _PyThreadState_Current PyThreadState_GetDict PyThreadState_Swap PyThreadState_Get PyThreadState_DeleteCurrent PyThreadState_Delete PyThreadState_Clear PyThreadState_New PyInterpreterState_Delete PyInterpreterState_Clear PyInterpreterState_New PyMember_Set PyMember_Get PySys_WriteStderr PySys_WriteStdout PySys_SetArgv PySys_SetPath _PySys_Init PySys_AddWarnOption PySys_ResetWarnOptions PySys_SetObject PySys_GetFile PySys_GetObject PyTraceBack_Type PyTraceBack_Print PyTraceBack_Here PyCode_Type Py_OptimizeFlag PySymtable_Free PyCode_Addr2Line PyNode_CompileSymtable PyNode_CompileFlags PyNode_Compile PyCode_New PyObject_IsSubclass PyObject_IsInstance PyObject_CallMethod PyObject_CallFunction PyObject_CallObject PyMapping_HasKey PyMapping_HasKeyString PyMapping_SetItemString PyMapping_GetItemString PyMapping_Length PyMapping_Size PyMapping_Check PySequence_Index PySequence_In PySequence_Contains PySequence_Count PySequence_Fast PySequence_List PySequence_Tuple PySequence_DelSlice PySequence_SetSlice PySequence_DelItem PySequence_SetItem PySequence_GetSlice PySequence_GetItem PySequence_InPlaceRepeat PySequence_InPlaceConcat PySequence_Repeat PySequence_Concat PySequence_Length PySequence_Size PySequence_Check PyNumber_Float PyNumber_Long PyNumber_Int PyNumber_Absolute PyNumber_Invert PyNumber_Positive PyNumber_Negative PyNumber_InPlacePower PyNumber_InPlaceRemainder PyNumber_InPlaceMultiply PyNumber_InPlaceAdd PyNumber_InPlaceDivide PyNumber_InPlaceSubtract PyNumber_InPlaceRshift PyNumber_InPlaceLshift PyNumber_InPlaceAnd PyNumber_InPlaceXor PyNumber_InPlaceOr PyNumber_Power PyNumber_Remainder PyNumber_Add PyNumber_Divmod PyNumber_Divide PyNumber_Multiply PyNumber_Subtract PyNumber_Rshift PyNumber_Lshift PyNumber_And PyNumber_Xor PyNumber_Or PyNumber_Check PyObject_AsWriteBuffer PyObject_AsReadBuffer PyObject_AsCharBuffer PyObject_DelItem PyObject_SetItem PyObject_GetItem PyObject_Length PyObject_Size PyObject_Type PyObject_Cmp PyClass_Type PyInstance_Type PyMethod_Type PyMethod_Fini PyMethod_Class PyMethod_Self PyMethod_Function PyMethod_New PyInstance_New PyInstance_NewRaw PyClass_IsSubclass PyClass_New PyCObject_Type PyCObject_Import PyCObject_GetDesc PyCObject_AsVoidPtr PyCObject_FromVoidPtrAndDesc PyCObject_FromVoidPtr PyComplex_Type PyComplex_AsCComplex PyComplex_ImagAsDouble PyComplex_RealAsDouble PyComplex_FromDoubles PyComplex_FromCComplex _Py_c_pow _Py_c_quot _Py_c_prod _Py_c_neg _Py_c_diff _Py_c_sum PyDict_Type PyDict_DelItemString PyDict_SetItemString PyDict_GetItemString PyDict_Items PyDict_Values PyDict_Keys PyDict_Size PyDict_Copy PyDict_Next PyDict_Clear PyDict_DelItem PyDict_SetItem PyDict_GetItem PyDict_New PyFile_Type PyObject_AsFileDescriptor PyFile_WriteString PyFile_WriteObject PyFile_SoftSpace PyFile_GetLine PyFile_SetBufSize PyFile_FromString PyFile_FromFile PyFile_Name PyFile_AsFile PyFloat_Type PyFloat_Fini PyFloat_AsString PyFloat_AsStringEx PyFloat_AsDouble PyFloat_FromString PyFloat_FromDouble PyFrame_Type PyFrame_Fini PyFrame_LocalsToFast PyFrame_FastToLocals PyFrame_BlockPop PyFrame_BlockSetup PyFrame_New PyFunction_Type PyFunction_SetClosure PyFunction_GetClosure PyFunction_SetDefaults PyFunction_GetDefaults PyFunction_GetGlobals PyFunction_GetCode PyFunction_New _Py_ZeroStruct _Py_TrueStruct PyInt_Type PyInt_Fini PyInt_FromUnicode PyInt_FromString PyInt_AsLong PyInt_FromLong PyInt_GetMax PyList_Type PyList_AsTuple PyList_Reverse PyList_Sort PyList_SetSlice PyList_GetSlice PyList_Append PyList_Insert PyList_SetItem PyList_GetItem PyList_Size PyList_New PyLong_Type PyLong_FromUnicode PyLong_FromString PyLong_AsVoidPtr PyLong_FromVoidPtr PyLong_AsDouble PyLong_AsUnsignedLong PyLong_AsLong PyLong_FromDouble PyLong_FromUnsignedLong PyLong_FromLong _PyLong_New PyCFunction_Type PyCFunction_Fini Py_FindMethod Py_FindMethodInChain PyCFunction_GetFlags PyCFunction_GetSelf PyCFunction_GetFunction PyCFunction_New PyModule_Type _PyModule_Clear PyModule_GetFilename PyModule_GetName PyModule_GetDict PyModule_New _Py_NoneStruct _Py_NotImplementedStruct _Py_cobject_hack _Py_abstract_hack PyObject_ClearWeakRefs _PyTrash_delete_later _PyTrash_delete_nesting _PyTrash_destroy_chain _PyTrash_deposit_object Py_ReprLeave Py_ReprEnter PyObject_Free PyObject_Realloc PyObject_Malloc PyMem_Free PyMem_Realloc PyMem_Malloc PyCallable_Check PyNumber_Coerce PyNumber_CoerceEx PyObject_Not PyObject_IsTrue PyObject_SetAttr PyObject_HasAttr PyObject_GetAttr PyObject_SetAttrString PyObject_HasAttrString PyObject_GetAttrString PyObject_Hash _Py_HashPointer _Py_HashDouble PyObject_RichCompareBool PyObject_RichCompare PyObject_Compare PyObject_Unicode PyObject_Str PyObject_Repr _PyObject_Dump PyObject_Print _PyGC_Remove _PyGC_Insert _PyObject_Del _PyObject_NewVar _PyObject_New PyObject_InitVar PyObject_Init PyRange_Type PyRange_New _Py_EllipsisObject PySlice_Type PySlice_GetIndices PySlice_New PyString_Type _Py_ReleaseInternedStrings PyString_Fini PyString_InternFromString PyString_InternInPlace PyString_Format _PyString_FormatLong _PyString_Resize PyString_ConcatAndDel PyString_Concat PyString_AsStringAndSize PyString_AsString PyString_Size PyString_AsEncodedString PyString_Encode PyString_Decode PyString_FromString PyString_FromStringAndSize PyTuple_Type PyTuple_Fini _PyTuple_Resize PyTuple_GetSlice PyTuple_SetItem PyTuple_GetItem PyTuple_Size PyTuple_New PyType_Type PyGrammar_RemoveAccelerators PyGrammar_AddAccelerators PyGrammar_LabelRepr PyGrammar_FindDFA PyOS_AfterFork PyOS_ReadlineFunctionPointer PyOS_InputHook PyOS_Readline PyOS_StdioReadline PyNode_Free PyNode_AddChild PyNode_New PyParser_AddToken PyParser_Delete PyParser_New Py_TabcheckFlag PyParser_ParseFile PyParser_ParseString _PyParser_TokenNames PyTokenizer_Get PyToken_ThreeChars PyToken_TwoChars PyToken_OneChar PyTokenizer_Free PyTokenizer_FromFile PyTokenizer_FromString array_methods initarray initaudioop initbinascii initcmath initerrno Py_GetBuildInfo initimageop initmath _Py_MD5Final _Py_MD5Update _Py_MD5Init initmd5 new_doc initnew initoperator initparser initregex _Py_re_syntax_table _Py_re_syntax _Py_re_search _Py_re_match _Py_re_compile_pattern _Py_re_compile_fastmap _Py_re_set_syntax _Py_re_compile_initialize initrgbimg initrotor initselect gethostbyname_lock init_socket initstrop initstruct inittime FindApplicationFromCreator PyMac_ApplicationFSSpec PyMac_ApplicationPath open_doc_upp open_app_upp not_upp PyMac_GetArgv PyMac_GetFullPath PyMac_init_process_location strdup Py_GetCompiler PyMac_PreferenceOptions PyMac_GetPythonPath PyMac_GetPythonDir PyMac_OpenPrefFile Py_GetPath Py_GetPlatform PyMac_ConsoleIsDead PyMac_AppearanceCompliant PyMac_OSErrException PyMac_Buildwide PyMac_Getwide PyMac_BuildFixed PyMac_GetFixed PyMac_GetEventRecord PyMac_BuildPoint PyMac_GetPoint PyMac_BuildRect PyMac_GetRect PyMac_BuildFSSpec PyMac_GetFSSpec PyMac_BuildOptStr255 PyMac_BuildStr255 PyMac_GetStr255 PyMac_BuildNumVersion PyMac_BuildOSType PyMac_GetOSType SIOUXDoAboutBox PyMac_RestoreMenuBar PyMac_InitMenuBar PyMac_SetSchedParams PyMac_GetSchedParams PyMac_DoYield PyMac_HandleEvent PyMac_BuildEventRecord PyMac_HandleEventIntern PyMac_SetEventHandler PyOS_InterruptOccurred PyErr_CheckSignals PyOS_FiniInterrupts PyOS_InitInterrupts PyOS_CheckStack PyMac_Error PyErr_Mac PyMac_GetOSErrException PyMac_StrError Pstring PyMac_StopGUSISpin RotateCursor SpinCursor PyMac_getscript PyMac_AppRefNum PyMac_options console_output_state PyMac_GetDelayConsoleFlag Py_GetExecPrefix Py_GetPrefix Py_GetArgcArgv Py_GetProgramFullPath PyMac_Exit abort PyMac_OutputNotSeen PyMac_OutputSeen PyMac_InitApplication PyMac_Initialize PyMac_InitApplet PyMac_getfiletype PyMac_setfiletype main PyMac_AddLibResources __initialize_with_resources getwd macstat sync initgestalt initmacfs newmfssobject mfs_GetFSSpecFSSpec initmac initMacOS Pcre_Type initpcre pcre_lcc pcre_fcc pcre_cbits pcre_ctypes pcre_malloc pcre_free pcre_exec pcre_compile pcre_info pcre_version pcre_study initcPickle Pickler_setattr cPickle_PyMapping_HasKey initcStringIO PyMac_FindModuleExtension PyMac_LoadResourceModule PyMac_LoadCodeResourceModule PyMac_FindCodeResourceModule PyMac_FindResourceModule _PyImport_Inittab CtlObj_chain Control_Type initCtl CtlObj_Convert CtlObj_New DlgObj_chain Dialog_Type initDlg DlgObj_ConvertToWindow DlgObj_Convert DlgObj_New DlgObj_WhichDialog MenuObj_chain Menu_Type initMenu MenuObj_Convert MenuObj_New GrafObj_chain GrafPort_Type BMObj_chain BitMap_Type QDGlobalsAccess_Type initQd BMObj_NewCopied BMObj_Convert BMObj_New GrafObj_Convert GrafObj_New QdRGB_Convert QdRGB_New ResObj_chain Resource_Type initRes OptResObj_Convert OptResObj_New ResObj_Convert ResObj_New WinObj_chain Window_Type initWin WinObj_WhichWindow WinObj_Convert WinObj_New PyBuffer_Type PyBuffer_New PyBuffer_FromReadWriteMemory PyBuffer_FromMemory PyBuffer_FromReadWriteObject PyBuffer_FromObject _PyImport_DynLoadFiletab _PyImport_GetDynLoadFunc init_codecs _PyUnicode_Database_Records _PyUnicode_CategoryNames _PyUnicode_BidirectionalNames initunicodedata _PyCodecRegistry_Fini _PyCodecRegistry_Init PyCodec_Decode PyCodec_Encode PyCodec_StreamWriter PyCodec_StreamReader PyCodec_Decoder PyCodec_Encoder _PyCodec_Lookup PyCodec_Register _PyUnicode_TypeRecords _PyUnicode_IsAlpha _PyUnicode_ToLowercase _PyUnicode_ToUppercase _PyUnicode_IsUppercase _PyUnicode_IsLowercase _PyUnicode_IsWhitespace _PyUnicode_IsNumeric _PyUnicode_ToNumeric _PyUnicode_IsDigit _PyUnicode_ToDigit _PyUnicode_IsDecimalDigit _PyUnicode_ToDecimalDigit _PyUnicode_IsTitlecase _PyUnicode_ToTitlecase _PyUnicode_IsLinebreak PyUnicode_Type _PyUnicode_Fini _PyUnicode_Init PyUnicode_Format PyUnicode_Split PyUnicode_Replace PyUnicode_Concat PyUnicode_Contains PyUnicode_Compare PyUnicode_Splitlines PyUnicode_Join PyUnicode_Tailmatch PyUnicode_Find PyUnicode_Count PyUnicode_EncodeDecimal PyUnicode_Translate PyUnicode_TranslateCharmap PyUnicode_AsCharmapString PyUnicode_EncodeCharmap PyUnicode_DecodeCharmap PyUnicode_AsASCIIString PyUnicode_EncodeASCII PyUnicode_DecodeASCII PyUnicode_AsLatin1String PyUnicode_EncodeLatin1 PyUnicode_DecodeLatin1 PyUnicode_AsRawUnicodeEscapeString PyUnicode_EncodeRawUnicodeEscape PyUnicode_DecodeRawUnicodeEscape PyUnicode_AsUnicodeEscapeString PyUnicode_EncodeUnicodeEscape PyUnicode_DecodeUnicodeEscape PyUnicode_AsUTF16String PyUnicode_EncodeUTF16 PyUnicode_DecodeUTF16 PyUnicode_AsUTF8String PyUnicode_EncodeUTF8 PyUnicode_DecodeUTF8 PyUnicode_SetDefaultEncoding PyUnicode_GetDefaultEncoding PyUnicode_GetSize PyUnicode_AsUnicode _PyUnicode_AsDefaultEncodedString PyUnicode_AsEncodedString PyUnicode_Encode PyUnicode_Decode PyUnicode_FromEncodedObject PyUnicode_FromObject PyUnicode_AsWideChar PyUnicode_FromWideChar PyUnicode_FromUnicode PyUnicode_Resize initthread PyThread_up_sema PyThread_down_sema PyThread_free_sema PyThread_allocate_sema PyThread_release_lock PyThread_acquire_lock PyThread_free_lock PyThread_allocate_lock PyThread__exit_thread PyThread_exit_thread PyThread_get_thread_ident PyThread_start_new_thread PyThread_init_thread PyExc_Exception PyExc_StandardError PyExc_ArithmeticError PyExc_LookupError PyExc_AssertionError PyExc_AttributeError PyExc_EOFError PyExc_FloatingPointError PyExc_EnvironmentError PyExc_IOError PyExc_OSError PyExc_ImportError PyExc_IndexError PyExc_KeyError PyExc_KeyboardInterrupt PyExc_MemoryError PyExc_NameError PyExc_OverflowError PyExc_RuntimeError PyExc_NotImplementedError PyExc_SyntaxError PyExc_IndentationError PyExc_TabError PyExc_SystemError PyExc_SystemExit PyExc_UnboundLocalError PyExc_UnicodeError PyExc_TypeError PyExc_ValueError PyExc_ZeroDivisionError PyExc_MemoryErrorInst PyExc_Warning PyExc_UserWarning PyExc_DeprecationWarning PyExc_SyntaxWarning PyExc_RuntimeWarning fini_exceptions init_exceptions initNav AEDesc_chain AEDesc_Type upp_GenericEventHandler upp_AEIdleProc initAE AEDesc_Convert AEDesc_New init_locale initEvt init_sre initsha DragObj_chain DragObj_Type dragglue_TrackingHandlerUPP dragglue_ReceiveHandlerUPP dragglue_SendDataUPP initDrag D ragObj_Convert DragObj_New initxreadlines PyCell_Type PyCell_Set PyCell_Get PyCell_New PySymtableEntry_Type PySymtableEntry_New PyNode_Future GUSISetupConsoleStdio GUSIStdioFlush GUSIStdioClose _fdopen __close_console __close_file __position_file __write_console __write_file __read_console __read_file __open_temp_file __open_file gGUSIEventMask h_errno gGUSIEventHook gGUSIExecHook gGUSISpinHook GUSI_sprintf__FPcPCce # GUSI_sprintf(char*,const char*,...) GUSI_vsprintf__FPcPCcPc # GUSI_vsprintf(char*,const char*,char*) GUSIHandleNextEvent__Fl # GUSIHandleNextEvent(long) GUSISetMacHostError__Fs # GUSISetMacHostError(short) GUSISetHostError__Fi # GUSISetHostError(int) GUSISetMacError__Fs # GUSISetMacError(short) GUSIMapMacError__Fs # GUSIMapMacError(short) GUSISetPosixError__Fi # GUSISetPosixError(int) GUSIGetHook__FUl # GUSIGetHook(unsigned long) GUSISetHook__FUlPFv_v # GUSISetHook(unsigned long,void (*)(void)) __vt__13GUSIScattGath # GUSIScattGath::__vt Peek__Q214GUSIRingBuffer6PeekerFRC13GUSIScattererRUl # GUSIRingBuffer::Peeker::Peek(const GUSIScatterer&,unsigned long&) Peek__Q214GUSIRingBuffer6PeekerFPvRUl # GUSIRingBuffer::Peeker::Peek(void*,unsigned long&) PeekBuffer__Q214GUSIRingBuffer6PeekerFRUl # GUSIRingBuffer::Peeker::PeekBuffer(unsigned long&) __dt__Q214GUSIRingBuffer6PeekerFv # GUSIRingBuffer::Peeker::~Peeker() __ct__Q214GUSIRingBuffer6PeekerFR14GUSIRingBuffer # GUSIRingBuffer::Peeker::Peeker(GUSIRingBuffer&) Valid__14GUSIRingBufferFv # GUSIRingBuffer::Valid() Free__14GUSIRingBufferFv # GUSIRingBuffer::Free() IterateIOVec__14GUSIRingBufferFRC13GUSIScattGathRUlRUlb # GUSIRingBuffer::IterateIOVec(const GUSIScattGath&,unsigned long&,unsigned long&,bool) Consume__14GUSIRingBufferFPvRUl # GUSIRingBuffer::Consume(void*,unsigned long&) Produce__14GUSIRingBufferFPvRUl # GUSIRingBuffer::Produce(void*,unsigned long&) FreeBuffer__14GUSIRingBufferFPvUl # GUSIRingBuffer::FreeBuffer(void*,unsigned long) ValidBuffer__14GUSIRingBufferFPvUl # GUSIRingBuffer::ValidBuffer(void*,unsigned long) ConsumeBuffer__14GUSIRingBufferFRUl # GUSIRingBuffer::ConsumeBuffer(unsigned long&) ProduceBuffer__14GUSIRingBufferFRUl # GUSIRingBuffer::ProduceBuffer(unsigned long&) __dt__14GUSIRingBufferFv # GUSIRingBuffer::~GUSIRingBuffer() ObsoleteBuffer__14GUSIRingBufferFv # GUSIRingBuffer::ObsoleteBuffer() PurgeBuffers__14GUSIRingBufferFv # GUSIRingBuffer::PurgeBuffers() SwitchBuffer__14GUSIRingBufferFUl # GUSIRingBuffer::SwitchBuffer(unsigned long) __ct__14GUSIRingBufferFUl # GUSIRingBuffer::GUSIRingBuffer(unsigned long) Invariant__14GUSIRingBufferFv # GUSIRingBuffer::Invariant() Distance__14GUSIRingBufferFPcPc # GUSIRingBuffer::Distance(char*,char*) __ct__13GUSIScattGathFRC13GUSIScattGath # GUSIScattGath::GUSIScattGath(const GUSIScattGath&) __as__13GUSIScattGathFRC13GUSIScattGath # GUSIScattGath::operator =(const GUSIScattGath&) __dt__13GUSIScattGathFv # GUSIScattGath::~GUSIScattGath() Buffer__13GUSIScattGathCFv # GUSIScattGath::Buffer() const __ct__13GUSIScattGathFPvUlb # GUSIScattGath::GUSIScattGath(void*,unsigned long,bool) __ct__13GUSIScattGathFPC5iovecib # GUSIScattGath::GUSIScattGath(const iovec*,int,bool) sInstance__17GUSIConfiguration # GUSIConfiguration::sInstance ConfigureHandleAppleEvents__17GUSIConfigurationFb # GUSIConfiguration::ConfigureHandleAppleEvents(bool) CmdPeriod__17GUSIConfigurationFPC11EventRecord # GUSIConfiguration::CmdPeriod(const EventRecord*) CheckInterrupt__17GUSIConfigurationFv # GUSIConfiguration::CheckInterrupt() BrokenPipe__17GUSIConfigurationFv # GUSIConfiguration::BrokenPipe() DoAutoInitGraf__17GUSIConfigurationFv # GUSIConfiguration::DoAutoInitGraf() DoAutoSpin__17GUSIConfigurationCFv # GUSIConfiguration::DoAutoSpin() const SetDefaultFType__17GUSIConfigurationCFRC12GUSIFileSpec # GUSIConfiguration::SetDefaultFType(const GUSIFileSpec&) const ConfigureSuffices__17GUSIConfigurationFsPQ217GUSIConfiguration10FileSuffix # GUSIConfiguration::ConfigureSuffices(short,GUSIConfiguration::FileSuffix*) __ct__17GUSIConfigurationFs # GUSIConfiguration::GUSIConfiguration(short) CreateInstance__17GUSIConfigurationFs # GUSIConfiguration::CreateInstance(short) __vt__22GUSIThreadManagerProxy # GUSIThreadManagerProxy::__vt __vt__18GUSIContextFactory # GUSIContextFactory::__vt __vt__11GUSIContext # GUSIContext::__vt sError__11GUSIContext # GUSIContext::sError sHasThreading__11GUSIContext # GUSIContext::sHasThreading sCurrentContext__11GUSIContext # GUSIContext::sCurrentContext sContexts__11GUSIContext # GUSIContext::sContexts sInstance__11GUSIProcess # GUSIProcess::sInstance __dt__Q211GUSIContext5QueueFv # GUSIContext::Queue::~Queue() MakeInstance__22GUSIThreadManagerProxyFv # GUSIThreadManagerProxy::MakeInstance() __dt__22GUSIThreadManagerProxyFv # GUSIThreadManagerProxy::~GUSIThreadManagerProxy() __dt__Q23std76auto_ptr<22GUSIThreadManagerProxy,Q23std33_Single<22GUSIThreadManagerProxy>>Fv # std::auto_ptr>::~auto_ptr() Instance__22GUSIThreadManagerProxyFv # GUSIThreadManagerProxy::Instance() SetThreadTerminator__22GUSIThreadManagerProxyFUlPFUlPv_vPv # GUSIThreadManagerProxy::SetThreadTerminator(unsigned long,void (*)(unsigned long, void*),void*) SetThreadSwitcher__22GUSIThreadManagerProxyFUlPFUlPv_vPvUc # GUSIThreadManagerProxy::SetThreadSwitcher(unsigned long,void (*)(unsigned long, void*),void*,unsigned char) NewThread__22GUSIThreadManagerProxyFUlPFPv_PvPvlUlPPvPUl # GUSIThreadManagerProxy::NewThread(unsigned long,void* (*)(void*),void*,long,unsigned long,void**,unsigned long*) GUSIControl__FP7IOParam # GUSIControl(IOParam*) GUSIFinishIO__FP7IOParam # GUSIFinishIO(IOParam*) GUSIStartIO__FP7IOParam # GUSIStartIO(IOParam*) Blocked__11GUSIContextFv # GUSIContext::Blocked() Pending__11GUSIContextFv # GUSIContext::Pending() Raise__11GUSIContextFb # GUSIContext::Raise(bool) Yield__11GUSIProcessF13GUSIYieldMode # GUSIProcess::Yield(GUSIYieldMode) SigSuspend__11GUSIContextFv # GUSIContext::SigSuspend() SigWait__11GUSIContextFUi # GUSIContext::SigWait(unsigned int) Yield__11GUSIContextF13GUSIYieldMode # GUSIContext::Yield(GUSIYieldMode) Done__11GUSIContextFb # GUSIContext::Done(bool) Terminate__11GUSIContextFv # GUSIContext::Terminate() SwitchOut__11GUSIContextFv # GUSIContext::SwitchOut() SwitchIn__11GUSIContextFv # GUSIContext::SwitchIn() SetTerminator__11GUSIContextFPFUlPv_vPv # GUSIContext::SetTerminator(void (*)(unsigned long, void*),void*) GUSISetThreadTerminator SetSwitchOut__11GUSIContextFPFUlPv_vPv # GUSIContext::SetSwitchOut(void (*)(unsigned long, void*),void*) SetSwitchIn__11GUSIContextFPFUlPv_vPv # GUSIContext::SetSwitchIn(void (*)(unsigned long, void*),void*) GUSISetThreadSwitcher CreateContext__18GUSIContextFactoryFUl # GUSIContextFactory::CreateContext(unsigned long) CreateContext__18GUSIContextFactoryFPFPv_PvPvlUlPPvPUl # GUSIContextFactory::CreateContext(void* (*)(void*),void*,long,unsigned long,void**,unsigned long*) __dt__18GUSIContextFactoryFv # GUSIContextFactory::~GUSIContextFactory() __ct__18GUSIContextFactoryFv # GUSIContextFactory::GUSIContextFactory() __dt__Q23std68auto_ptr<18GUSIContextFactory,Q23std29_Single<18GUSIContextFactory>>Fv # std::auto_ptr>::~auto_ptr() SetInstance__18GUSIContextFactoryFP18GUSIContextFactory # GUSIContextFactory::SetInstance(GUSIContextFactory*) Instance__18GUSIContextFactoryFv # GUSIContextFactory::Instance() GUSINewThread Wakeup__11GUSIProcessFv # GUSIProcess::Wakeup() Wakeup__11GUSIContextFv # GUSIContext::Wakeup() Liquidate__11GUSIContextFv # GUSIContext::Liquidate() LiquidateAll__Q211GUSIContext5QueueFv # GUSIContext::Queue::LiquidateAll() __dt__11GUSIContextFv # GUSIContext::~GUSIContext() Lookup__11GUSIContextFUl # GUSIContext::Lookup(unsigned long) __ct__11GUSIContextFPFPv_PvPvlUlPPvPUl # GUSIContext::GUSIContext(void* (*)(void*),void*,long,unsigned long,void**,unsigned long*) __ct__11GUSIContextFUl # GUSIContext::GUSIContext(unsigned long) FinishSetup__11GUSIContextFv # GUSIContext::FinishSetup() GUSIThreadTerminator StartSetup__11GUSIContextFv # GUSIContext::StartSetup() Setup__11GU SIContextFb # GUSIContext::Setup(bool) GUSIThreadSwitchOut GUSIThreadSwitchIn __dt__11GUSIProcessFv # GUSIProcess::~GUSIProcess() QueueForClose__11GUSIProcessFP10GUSISocket # GUSIProcess::QueueForClose(GUSISocket*) __ct__11GUSIProcessFb # GUSIProcess::GUSIProcess(bool) sBlocks__Q216GUSIContextQueue7element # GUSIContextQueue::element::sBlocks Wakeup__16GUSIContextQueueFv # GUSIContextQueue::Wakeup() push_back__16GUSIContextQueueFP11GUSIContext # GUSIContextQueue::push_back(GUSIContext*) remove__16GUSIContextQueueFP11GUSIContext # GUSIContextQueue::remove(GUSIContext*) __dt__16GUSIContextQueueFv # GUSIContextQueue::~GUSIContextQueue() __dl__Q216GUSIContextQueue7elementFPvUl # GUSIContextQueue::element::operator delete(void*,unsigned long) __nw__Q216GUSIContextQueue7elementFUl # GUSIContextQueue::element::operator new(unsigned long) __vt__14GUSIDConSocket # GUSIDConSocket::__vt __vt__14GUSIDConDevice # GUSIDConDevice::__vt sInstance__14GUSIDConDevice # GUSIDConDevice::sInstance __dt__14GUSIDConDeviceFv # GUSIDConDevice::~GUSIDConDevice() isatty__14GUSIDConSocketFv # GUSIDConSocket::isatty() Supports__14GUSIDConSocketFQ210GUSISocket12ConfigOption # GUSIDConSocket::Supports(GUSISocket::ConfigOption) write__14GUSIDConSocketFRC12GUSIGatherer # GUSIDConSocket::write(const GUSIGatherer&) read__14GUSIDConSocketFRC13GUSIScatterer # GUSIDConSocket::read(const GUSIScatterer&) __dt__14GUSIDConSocketFv # GUSIDConSocket::~GUSIDConSocket() __ct__14GUSIDConSocketFPCc # GUSIDConSocket::GUSIDConSocket(const char*) open__14GUSIDConDeviceFR13GUSIFileTokeni # GUSIDConDevice::open(GUSIFileToken&,int) Want__14GUSIDConDeviceFR13GUSIFileToken # GUSIDConDevice::Want(GUSIFileToken&) GUSIwithDConSockets sGUSIDescriptorTable__19GUSIDescriptorTable # GUSIDescriptorTable::sGUSIDescriptorTable __ct__19GUSIDescriptorTableFRC19GUSIDescriptorTable # GUSIDescriptorTable::GUSIDescriptorTable(const GUSIDescriptorTable&) LookupSocket__19GUSIDescriptorTableFi # GUSIDescriptorTable::LookupSocket(int) __vc__19GUSIDescriptorTableFi # GUSIDescriptorTable::operator [](int) RemoveSocket__19GUSIDescriptorTableFi # GUSIDescriptorTable::RemoveSocket(int) InstallSocket__19GUSIDescriptorTableFP10GUSISocketi # GUSIDescriptorTable::InstallSocket(GUSISocket*,int) __dt__19GUSIDescriptorTableFv # GUSIDescriptorTable::~GUSIDescriptorTable() CloseAllDescriptors__19GUSIDescriptorTableFv # GUSIDescriptorTable::CloseAllDescriptors() SetInstance__19GUSIDescriptorTableFP19GUSIDescriptorTable # GUSIDescriptorTable::SetInstance(GUSIDescriptorTable*) Instance__19GUSIDescriptorTableFv # GUSIDescriptorTable::Instance() Instance__14GUSINullDeviceFv # GUSINullDevice::Instance() GUSIDefaultSetupConsole GUSISetupConsole __ct__19GUSIDescriptorTableFv # GUSIDescriptorTable::GUSIDescriptorTable() __vt__10GUSIDevice # GUSIDevice::__vt sInstance__18GUSIDeviceRegistry # GUSIDeviceRegistry::sInstance faccess__18GUSIDeviceRegistryFPCcPUiPv # GUSIDeviceRegistry::faccess(const char*,unsigned int*,void*) fsetfileinfo__18GUSIDeviceRegistryFPCcUlUl # GUSIDeviceRegistry::fsetfileinfo(const char*,unsigned long,unsigned long) fgetfileinfo__18GUSIDeviceRegistryFPCcPUlPUl # GUSIDeviceRegistry::fgetfileinfo(const char*,unsigned long*,unsigned long*) readlink__18GUSIDeviceRegistryFPCcPci # GUSIDeviceRegistry::readlink(const char*,char*,int) symlink__18GUSIDeviceRegistryFPCcPCc # GUSIDeviceRegistry::symlink(const char*,const char*) opendir__18GUSIDeviceRegistryFPCc # GUSIDeviceRegistry::opendir(const char*) rmdir__18GUSIDeviceRegistryFPCc # GUSIDeviceRegistry::rmdir(const char*) mkdir__18GUSIDeviceRegistryFPCc # GUSIDeviceRegistry::mkdir(const char*) access__18GUSIDeviceRegistryFPCci # GUSIDeviceRegistry::access(const char*,int) utime__18GUSIDeviceRegistryFPCcPC7utimbuf # GUSIDeviceRegistry::utime(const char*,const utimbuf*) chmod__18GUSIDeviceRegistryFPCcUs # GUSIDeviceRegistry::chmod(const char*,unsigned short) stat__18GUSIDeviceRegistryFPCcP4statb # GUSIDeviceRegistry::stat(const char*,stat*,bool) rename__18GUSIDeviceRegistryFPCcPCc # GUSIDeviceRegistry::rename(const char*,const char*) remove__18GUSIDeviceRegistryFPCc # GUSIDeviceRegistry::remove(const char*) open__18GUSIDeviceRegistryFPCci # GUSIDeviceRegistry::open(const char*,int) Lookup__18GUSIDeviceRegistryFR13GUSIFileToken # GUSIDeviceRegistry::Lookup(GUSIFileToken&) RemoveDevice__18GUSIDeviceRegistryFP10GUSIDevice # GUSIDeviceRegistry::RemoveDevice(GUSIDevice*) AddDevice__18GUSIDeviceRegistryFP10GUSIDevice # GUSIDeviceRegistry::AddDevice(GUSIDevice*) __ct__18GUSIDeviceRegistryFv # GUSIDeviceRegistry::GUSIDeviceRegistry() faccess__10GUSIDeviceFR13GUSIFileTokenPUiPv # GUSIDevice::faccess(GUSIFileToken&,unsigned int*,void*) fsetfileinfo__10GUSIDeviceFR13GUSIFileTokenUlUl # GUSIDevice::fsetfileinfo(GUSIFileToken&,unsigned long,unsigned long) fgetfileinfo__10GUSIDeviceFR13GUSIFileTokenPUlPUl # GUSIDevice::fgetfileinfo(GUSIFileToken&,unsigned long*,unsigned long*) readlink__10GUSIDeviceFR13GUSIFileTokenPci # GUSIDevice::readlink(GUSIFileToken&,char*,int) symlink__10GUSIDeviceFR13GUSIFileTokenPCc # GUSIDevice::symlink(GUSIFileToken&,const char*) opendir__10GUSIDeviceFR13GUSIFileToken # GUSIDevice::opendir(GUSIFileToken&) rmdir__10GUSIDeviceFR13GUSIFileToken # GUSIDevice::rmdir(GUSIFileToken&) mkdir__10GUSIDeviceFR13GUSIFileToken # GUSIDevice::mkdir(GUSIFileToken&) access__10GUSIDeviceFR13GUSIFileTokeni # GUSIDevice::access(GUSIFileToken&,int) utime__10GUSIDeviceFR13GUSIFileTokenPC7utimbuf # GUSIDevice::utime(GUSIFileToken&,const utimbuf*) chmod__10GUSIDeviceFR13GUSIFileTokenUs # GUSIDevice::chmod(GUSIFileToken&,unsigned short) stat__10GUSIDeviceFR13GUSIFileTokenP4stat # GUSIDevice::stat(GUSIFileToken&,stat*) rename__10GUSIDeviceFR13GUSIFileTokenPCc # GUSIDevice::rename(GUSIFileToken&,const char*) remove__10GUSIDeviceFR13GUSIFileToken # GUSIDevice::remove(GUSIFileToken&) open__10GUSIDeviceFR13GUSIFileTokeni # GUSIDevice::open(GUSIFileToken&,int) Want__10GUSIDeviceFR13GUSIFileToken # GUSIDevice::Want(GUSIFileToken&) __ct__13GUSIFileTokenFsQ213GUSIFileToken7Request # GUSIFileToken::GUSIFileToken(short,GUSIFileToken::Request) __ct__13GUSIFileTokenFRC12GUSIFileSpecQ213GUSIFileToken7Request # GUSIFileToken::GUSIFileToken(const GUSIFileSpec&,GUSIFileToken::Request) StrStdStream__13GUSIFileTokenFPCc # GUSIFileToken::StrStdStream(const char*) __ct__13GUSIFileTokenFPCcQ213GUSIFileToken7Requestb # GUSIFileToken::GUSIFileToken(const char*,GUSIFileToken::Request,bool) StrFragEqual__13GUSIFileTokenFPCcPCc # GUSIFileToken::StrFragEqual(const char*,const char*) GUSI_diag_log vdfprintf dfprintf GUSI_break GUSI_log GUSI_pos __vt__22GUSISocketTypeRegistry # GUSISocketTypeRegistry::__vt __vt__24GUSISocketDomainRegistry # GUSISocketDomainRegistry::__vt __vt__17GUSISocketFactory # GUSISocketFactory::__vt sInstance__24GUSISocketDomainRegistry # GUSISocketDomainRegistry::sInstance __dt__24GUSISocketDomainRegistryFv # GUSISocketDomainRegistry::~GUSISocketDomainRegistry() __dt__22GUSISocketTypeRegistryFv # GUSISocketTypeRegistry::~GUSISocketTypeRegistry() RemoveFactory__22GUSISocketTypeRegistryFii # GUSISocketTypeRegistry::RemoveFactory(int,int) AddFactory__22GUSISocketTypeRegistryFiiP17GUSISocketFactory # GUSISocketTypeRegistry::AddFactory(int,int,GUSISocketFactory*) socketpair__22GUSISocketTypeRegistryFiiiPP10GUSISocket # GUSISocketTypeRegistry::socketpair(int,int,int,GUSISocket**) socket__22GUSISocketTypeRegistryFiii # GUSISocketTypeRegistry::socket(int,int,int) Find__22GUSISocketTypeRegistryFiibRPQ222GUSISocketTypeRegistry5Entry # GUSISocketTypeRegistry::Find(int,int,bool,GUSISocketTypeRegistry::Entry*&) Initialize__22GUSISocketTypeRegistryFv # GUSISocketTypeRegistry::Initialize() __ct__Q222GUSISocketTypeRegistry5EntryFv # GUSISocketTypeRegistry::Entry::Entry() AddFactory__24GUSISocketDomainRegistryFiP17GUSISocketFactory # GUSISocketDomainRegistry::AddFactory(int,GUSISocketFactory*) socketpair__24GUSISocketDomainRegistryFiiiPP10GUSISocket # GUSISocketDomainRegistry::socketpair(int,int,int,GUSISocket**) socket__24GUSISocketDomainRegistryFiii # GUSISocketDomainRegistry::socket(int,int,int) __dt__17GUSISocke tFactoryFv # GUSISocketFactory::~GUSISocketFactory() __ct__24GUSISocketDomainRegistryFv # GUSISocketDomainRegistry::GUSISocketDomainRegistry() socketpair__17GUSISocketFactoryFiiiPP10GUSISocket # GUSISocketFactory::socketpair(int,int,int,GUSISocket**) sID__16GUSITempFileSpec # GUSITempFileSpec::sID sScratchSize__12GUSIFileSpec # GUSIFileSpec::sScratchSize sScratch__12GUSIFileSpec # GUSIFileSpec::sScratch GUSIFSpGetCatInfo GUSIFSpTouchFolder GUSIFSp2Encoding GUSIFSp2DirRelPath GUSIFSp2RelPath GUSIFSp2FullPath GUSIFSpResolve GUSIFSpIndex GUSIFSpDown GUSIFSpUp GUSIMakeTempFSp GUSISpecial2FSp GUSIPath2FSp GUSIWD2FSp GUSIFRefNum2FSp TempName__16GUSITempFileSpecFPCUc # GUSITempFileSpec::TempName(const unsigned char*) TempName__16GUSITempFileSpecFv # GUSITempFileSpec::TempName() __ct__16GUSITempFileSpecFslPCUc # GUSITempFileSpec::GUSITempFileSpec(short,long,const unsigned char*) __ct__16GUSITempFileSpecFsPCUc # GUSITempFileSpec::GUSITempFileSpec(short,const unsigned char*) __ct__16GUSITempFileSpecFPCUc # GUSITempFileSpec::GUSITempFileSpec(const unsigned char*) __ct__16GUSITempFileSpecFsl # GUSITempFileSpec::GUSITempFileSpec(short,long) __ct__16GUSITempFileSpecFs # GUSITempFileSpec::GUSITempFileSpec(short) IsParentOf__12GUSIFileSpecCFRC12GUSIFileSpec # GUSIFileSpec::IsParentOf(const GUSIFileSpec&) const __eq__FRC12GUSIFileSpecRC12GUSIFileSpec # operator ==(const GUSIFileSpec&,const GUSIFileSpec&) AliasPath__12GUSIFileSpecCFv # GUSIFileSpec::AliasPath() const Resolve__12GUSIFileSpecFb # GUSIFileSpec::Resolve(bool) EncodedPath__12GUSIFileSpecCFv # GUSIFileSpec::EncodedPath() const RelativePath__12GUSIFileSpecCFv # GUSIFileSpec::RelativePath() const __as__9HFileInfoFRC9HFileInfo # HFileInfo::operator =(const HFileInfo&) __as__7DirInfoFRC7DirInfo # DirInfo::operator =(const DirInfo&) RelativePath__12GUSIFileSpecCFRC6FSSpec # GUSIFileSpec::RelativePath(const FSSpec&) const PrependPathComponent__12GUSIFileSpecCFRPcPCUcb # GUSIFileSpec::PrependPathComponent(char*&,const unsigned char*,bool) const FullPath__12GUSIFileSpecCFv # GUSIFileSpec::FullPath() const CatInfo__12GUSIFileSpecFs # GUSIFileSpec::CatInfo(short) TouchFolder__12GUSIFileSpecFv # GUSIFileSpec::TouchFolder() SetName__12GUSIFileSpecFPCc # GUSIFileSpec::SetName(const char*) SetName__12GUSIFileSpecFPCUc # GUSIFileSpec::SetName(const unsigned char*) SetParID__12GUSIFileSpecFl # GUSIFileSpec::SetParID(long) SetVRef__12GUSIFileSpecFs # GUSIFileSpec::SetVRef(short) __vc__12GUSIFileSpecFs # GUSIFileSpec::operator [](short) __pl__FRC6FSSpecPCc # operator +(const FSSpec&,const char*) __pl__FRC6FSSpecPCUc # operator +(const FSSpec&,const unsigned char*) AddPathComponent__12GUSIFileSpecFPCcib # GUSIFileSpec::AddPathComponent(const char*,int,bool) __pp__12GUSIFileSpecFv # GUSIFileSpec::operator ++() __mm__12GUSIFileSpecFv # GUSIFileSpec::operator --() GetVolume__12GUSIFileSpecFs # GUSIFileSpec::GetVolume(short) __ct__12GUSIFileSpecFPCcb # GUSIFileSpec::GUSIFileSpec(const char*,bool) __ct__12GUSIFileSpecFs # GUSIFileSpec::GUSIFileSpec(short) __ct__12GUSIFileSpecFUls # GUSIFileSpec::GUSIFileSpec(unsigned long,short) __ct__12GUSIFileSpecFsPCUcb # GUSIFileSpec::GUSIFileSpec(short,const unsigned char*,bool) __ct__12GUSIFileSpecFslPCUcb # GUSIFileSpec::GUSIFileSpec(short,long,const unsigned char*,bool) __ct__12GUSIFileSpecFRC6FSSpecb # GUSIFileSpec::GUSIFileSpec(const FSSpec&,bool) __ct__12GUSIFileSpecFRC12GUSIFileSpec # GUSIFileSpec::GUSIFileSpec(const GUSIFileSpec&) CScratch__12GUSIFileSpecFb # GUSIFileSpec::CScratch(bool) ReadHex__FPCciPc # ReadHex(const char*,int,char*) GUSIFSMoveRename GUSIFSCatMove GUSIFSCatMove__FPC6FSSpecl # GUSIFSCatMove(const FSSpec*,long) GUSIFSRename GUSIFSRstFLock GUSIFSSetFLock GUSIFSDirCreate GUSIFSDelete GUSIFSCreate GUSIFSCreate__FPC6FSSpec # GUSIFSCreate(const FSSpec*) GUSIFSGetVolParms GUSIFSHGetVolParms__FP33GUSIIOPBWrapper<14HParamBlockRec> # GUSIFSHGetVolParms(GUSIIOPBWrapper*) GUSIFSOpenRF GUSIFSOpenDF GUSIFSSetFInfo GUSIFSGetFInfo GUSIFSHSetFInfo__FP33GUSIIOPBWrapper<14HParamBlockRec> # GUSIFSHSetFInfo(GUSIIOPBWrapper*) GUSIFSHGetFInfo__FP33GUSIIOPBWrapper<14HParamBlockRec> # GUSIFSHGetFInfo(GUSIIOPBWrapper*) GUSIFSHGetVInfo__FP33GUSIIOPBWrapper<14HParamBlockRec> # GUSIFSHGetVInfo(GUSIIOPBWrapper*) GUSIFSGetFCBInfo__FP26GUSIIOPBWrapper<8FCBPBRec> # GUSIFSGetFCBInfo(GUSIIOPBWrapper*) GUSIFSSetCatInfo__FP30GUSIIOPBWrapper<11GUSICatInfo> # GUSIFSSetCatInfo(GUSIIOPBWrapper*) GUSIFSGetCatInfo__FP30GUSIIOPBWrapper<11GUSICatInfo> # GUSIFSGetCatInfo(GUSIIOPBWrapper*) gGUSIInetFactories GUSIwithInetSockets __vt__16GUSIMacDirectory # GUSIMacDirectory::__vt __vt__13GUSIDirectory # GUSIDirectory::__vt __vt__17GUSIMacFileSocket # GUSIMacFileSocket::__vt __vt__17GUSIMacFileDevice # GUSIMacFileDevice::__vt sWakeupProc__17GUSIMacFileSocket # GUSIMacFileSocket::sWakeupProc sWriteProc__17GUSIMacFileSocket # GUSIMacFileSocket::sWriteProc sReadProc__17GUSIMacFileSocket # GUSIMacFileSocket::sReadProc __dt__16GUSIMacDirectoryFv # GUSIMacDirectory::~GUSIMacDirectory() rewinddir__16GUSIMacDirectoryFv # GUSIMacDirectory::rewinddir() seekdir__16GUSIMacDirectoryFl # GUSIMacDirectory::seekdir(long) telldir__16GUSIMacDirectoryFv # GUSIMacDirectory::telldir() readdir__16GUSIMacDirectoryFv # GUSIMacDirectory::readdir() __dt__13GUSIDirectoryFv # GUSIDirectory::~GUSIDirectory() __ct__16GUSIMacDirectoryFRC6FSSpec # GUSIMacDirectory::GUSIMacDirectory(const FSSpec&) Supports__17GUSIMacFileSocketFQ210GUSISocket12ConfigOption # GUSIMacFileSocket::Supports(GUSISocket::ConfigOption) fstat__17GUSIMacFileSocketFP4stat # GUSIMacFileSocket::fstat(stat*) ftruncate__17GUSIMacFileSocketFl # GUSIMacFileSocket::ftruncate(long) lseek__17GUSIMacFileSocketFli # GUSIMacFileSocket::lseek(long,int) setsockopt__17GUSIMacFileSocketFiiPvUi # GUSIMacFileSocket::setsockopt(int,int,void*,unsigned int) getsockopt__17GUSIMacFileSocketFiiPvPUi # GUSIMacFileSocket::getsockopt(int,int,void*,unsigned int*) ioctl__17GUSIMacFileSocketFUiPc # GUSIMacFileSocket::ioctl(unsigned int,char*) fcntl__17GUSIMacFileSocketFiPc # GUSIMacFileSocket::fcntl(int,char*) fsync__17GUSIMacFileSocketFv # GUSIMacFileSocket::fsync() select__17GUSIMacFileSocketFPbPbPb # GUSIMacFileSocket::select(bool*,bool*,bool*) write__17GUSIMacFileSocketFRC12GUSIGatherer # GUSIMacFileSocket::write(const GUSIGatherer&) read__17GUSIMacFileSocketFRC13GUSIScatterer # GUSIMacFileSocket::read(const GUSIScatterer&) SyncWrite__17GUSIMacFileSocketFv # GUSIMacFileSocket::SyncWrite() SyncRead__17GUSIMacFileSocketFv # GUSIMacFileSocket::SyncRead() __dt__17GUSIMacFileSocketFv # GUSIMacFileSocket::~GUSIMacFileSocket() __dt__17GUSISMInputBufferFv # GUSISMInputBuffer::~GUSISMInputBuffer() __dt__18GUSISMOutputBufferFv # GUSISMOutputBuffer::~GUSISMOutputBuffer() __ct__17GUSIMacFileSocketFsbi # GUSIMacFileSocket::GUSIMacFileSocket(short,bool,int) faccess__17GUSIMacFileDeviceFR13GUSIFileTokenPUiPv # GUSIMacFileDevice::faccess(GUSIFileToken&,unsigned int*,void*) fsetfileinfo__17GUSIMacFileDeviceFR13GUSIFileTokenUlUl # GUSIMacFileDevice::fsetfileinfo(GUSIFileToken&,unsigned long,unsigned long) fgetfileinfo__17GUSIMacFileDeviceFR13GUSIFileTokenPUlPUl # GUSIMacFileDevice::fgetfileinfo(GUSIFileToken&,unsigned long*,unsigned long*) readlink__17GUSIMacFileDeviceFR13GUSIFileTokenPci # GUSIMacFileDevice::readlink(GUSIFileToken&,char*,int) symlink__17GUSIMacFileDeviceFR13GUSIFileTokenPCc # GUSIMacFileDevice::symlink(GUSIFileToken&,const char*) opendir__17GUSIMacFileDeviceFR13GUSIFileToken # GUSIMacFileDevice::opendir(GUSIFileToken&) rmdir__17GUSIMacFileDeviceFR13GUSIFileToken # GUSIMacFileDevice::rmdir(GUSIFileToken&) mkdir__17GUSIMacFileDeviceFR13GUSIFileToken # GUSIMacFileDevice::mkdir(GUSIFileToken&) access__17GUSIMacFileDeviceFR13GUSIFileTokeni # GUSIMacFileDevice::access(GUSIFileToken&,int) utime__17GUSIMacFileDeviceFR13GUSIFileTokenPC7utimbuf # GUSIMacFileDevice::utime(GUSIFileToken&,const utimbuf*) chmod__17GUSIMacFileDeviceFR13GUSIFileTokenUs # GUSIMacFileDevice::chmod(GUSIFileToken&,unsigned short) stat__17GUSIMacFileDeviceFR13GUSIFileTokenP4stat # GUSIMacFileDevice::stat(GUSIFileToken&,stat*) rename__17GUSIMacFileDeviceFR13GUSIFileTokenPCc # GUSIMacFileDevice::rename(GUSIFileToken&,const char*) CleanupTemporaries__17GUSIMacFileDeviceFb # GUSIMacFileDevice::CleanupTemporaries(bool) MarkTemporary__17GUSIMacFileDeviceFRC6FSSpec # GUSIMacFileDevice::MarkTemporary(const FSSpec&) remove__17GUSIMacFileDeviceFR13GUSIFileToken # GUSIMacFileDevice::remove(GUSIFileToken&) open__17GUSIMacFileDeviceFsi # GUSIMacFileDevice::open(short,int) open__17GUSIMacFileDeviceFR13GUSIFileTokeni # GUSIMacFileDevice::open(GUSIFileToken&,int) Want__17GUSIMacFileDeviceFR13GUSIFileToken # GUSIMacFileDevice::Want(GUSIFileToken&) __dt__17GUSIMacFileDeviceFv # GUSIMacFileDevice::~GUSIMacFileDevice() __dt__Q23std66auto_ptr<17GUSIMacFileDevice,Q23std28_Single<17GUSIMacFileDevice>>Fv # std::auto_ptr>::~auto_ptr() Instance__17GUSIMacFileDeviceFv # GUSIMacFileDevice::Instance() sProtocols__9GUSINetDB # GUSINetDB::sProtocols sServices__20GUSIBuiltinServiceDB # GUSIBuiltinServiceDB::sServices __vt__20GUSIBuiltinServiceDB # GUSIBuiltinServiceDB::__vt __vt__17GUSIFileServiceDB # GUSIFileServiceDB::__vt __vt__13GUSIServiceDB # GUSIServiceDB::__vt __vt__9GUSINetDB # GUSINetDB::__vt sInstance__13GUSIServiceDB # GUSIServiceDB::sInstance sData__13GUSIServiceDB # GUSIServiceDB::sData sEntry__20GUSIBuiltinServiceDB # GUSIBuiltinServiceDB::sEntry sInstance__9GUSINetDB # GUSINetDB::sInstance __dt__12GUSISpecificFv # GUSISpecific::~GUSISpecific() __dt__64GUSISpecificDataFv # GUSISpecificData::~GUSISpecificData() __dt__80GUSISpecificDataFv # GUSISpecificData::~GUSISpecificData() get__64GUSISpecificDataFP17GUSISpecificTable # GUSISpecificData::get(GUSISpecificTable*) get__80GUSISpecificDataFP17GUSISpecificTable # GUSISpecificData::get(GUSISpecificTable*) __dt__9GUSINetDBFv # GUSINetDB::~GUSINetDB() __dt__17GUSIFileServiceDBFv # GUSIFileServiceDB::~GUSIFileServiceDB() __dt__20GUSIBuiltinServiceDBFv # GUSIBuiltinServiceDB::~GUSIBuiltinServiceDB() __ct__11GUSIserventFv # GUSIservent::GUSIservent() GUSIKillHostEnt Alloc__11GUSIhostentFUl # GUSIhostent::Alloc(unsigned long) __ct__11GUSIhostentFv # GUSIhostent::GUSIhostent() Instance__13GUSIServiceDBFv # GUSIServiceDB::Instance() GUSIKillServiceDBData Next__20GUSIBuiltinServiceDBFv # GUSIBuiltinServiceDB::Next() Reset__20GUSIBuiltinServiceDBFv # GUSIBuiltinServiceDB::Reset() GUSIKillBuiltinServiceDBEntry Next__17GUSIFileServiceDBFv # GUSIFileServiceDB::Next() Reset__17GUSIFileServiceDBFv # GUSIFileServiceDB::Reset() __dt__13GUSIServiceDBFv # GUSIServiceDB::~GUSIServiceDB() Instance__17GUSIFileServiceDBFv # GUSIFileServiceDB::Instance() getprotobynumber__9GUSINetDBFi # GUSINetDB::getprotobynumber(int) getprotobyname__9GUSINetDBFPCc # GUSINetDB::getprotobyname(const char*) endprotoent__9GUSINetDBFv # GUSINetDB::endprotoent() setprotoent__9GUSINetDBFi # GUSINetDB::setprotoent(int) getprotoent__9GUSINetDBFv # GUSINetDB::getprotoent() getservbyport__9GUSINetDBFiPCc # GUSINetDB::getservbyport(int,const char*) getservbyname__9GUSINetDBFPCcPCc # GUSINetDB::getservbyname(const char*,const char*) endservent__9GUSINetDBFv # GUSINetDB::endservent() setservent__9GUSINetDBFi # GUSINetDB::setservent(int) getservent__9GUSINetDBFv # GUSINetDB::getservent() gethostname__9GUSINetDBFPci # GUSINetDB::gethostname(char*,int) gethostid__9GUSINetDBFv # GUSINetDB::gethostid() inet_addr__9GUSINetDBFPCc # GUSINetDB::inet_addr(const char*) inet_ntoa__9GUSINetDBF7in_addr # GUSINetDB::inet_ntoa(in_addr) gethostbyaddr__9GUSINetDBFPCvUli # GUSINetDB::gethostbyaddr(const void*,unsigned long,int) gethostbyname__9GUSINetDBFPCc # GUSINetDB::gethostbyname(const char*) __ct__9GUSINetDBFv # GUSINetDB::GUSINetDB() Instance__9GUSINetDBFv # GUSINetDB::Instance() __vt__14GUSINullSocket # GUSINullSocket::__vt __vt__14GUSINullDevice # GUSINullDevice::__vt sInstance__14GUSINullDevice # GUSINullDevice::sInstance __dt__14GUSINullDeviceFv # GUSINullDevice::~GUSINullDevice() __dt__14GUSINullSocketFv # GUSINullSocket::~GUSINullSocket() Supports__14GUSINullSocketFQ210GUSISocket12ConfigOption # GUSINullSocket::Supports(GUSISocket::ConfigOption) fstat__14GUSINullSocketFP4stat # GUSINullSocket::fstat(stat*) write__14GUSINullSocketFRC12GUSIGatherer # GUSINullSocket::write(const GUSIGatherer&) read__14GUSINullSocketFRC13GUSIScatterer # GUSINullSocket::read(const GUSIScatterer&) __ct__14GUSINullSocketFv # GUSINullSocket::GUSINullSocket() stat__14GUSINullDeviceFR13GUSIFileTokenP4stat # GUSINullDevice::stat(GUSIFileToken&,stat*) open__14GUSINullDeviceFv # GUSINullDevice::open() open__14GUSINullDeviceFR13GUSIFileTokeni # GUSINullDevice::open(GUSIFileToken&,int) Want__14GUSINullDeviceFR13GUSIFileToken # GUSINullDevice::Want(GUSIFileToken&) GUSIwithNullSockets __vt__14GUSIPipeSocket # GUSIPipeSocket::__vt __vt__15GUSIPipeFactory # GUSIPipeFactory::__vt sInstance__15GUSIPipeFactory # GUSIPipeFactory::sInstance __dt__15GUSIPipeFactoryFv # GUSIPipeFactory::~GUSIPipeFactory() shutdown__14GUSIPipeSocketFi # GUSIPipeSocket::shutdown(int) __dt__14GUSIPipeSocketFv # GUSIPipeSocket::~GUSIPipeSocket() select__14GUSIPipeSocketFPbPbPb # GUSIPipeSocket::select(bool*,bool*,bool*) write__14GUSIPipeSocketFRC12GUSIGatherer # GUSIPipeSocket::write(const GUSIGatherer&) read__14GUSIPipeSocketFRC13GUSIScatterer # GUSIPipeSocket::read(const GUSIScatterer&) Supports__14GUSIPipeSocketFQ210GUSISocket12ConfigOption # GUSIPipeSocket::Supports(GUSISocket::ConfigOption) WakeupPeer__14GUSIPipeSocketFv # GUSIPipeSocket::WakeupPeer() __ct__14GUSIPipeSocketFv # GUSIPipeSocket::GUSIPipeSocket() __dt__14GUSIErrorSaverFv # GUSIErrorSaver::~GUSIErrorSaver() socketpair__15GUSIPipeFactoryFiiiPP10GUSISocket # GUSIPipeFactory::socketpair(int,int,int,GUSISocket**) socket__15GUSIPipeFactoryFiii # GUSIPipeFactory::socket(int,int,int) GUSIwithLocalSockets __vt__12GUSIGatherer # GUSIGatherer::__vt __vt__13GUSIScatterer # GUSIScatterer::__vt get__40GUSISpecificDataFP17GUSISpecificTable # GUSISpecificData::get(GUSISpecificTable*) faccess__FPCcPUiPv # faccess(const char*,unsigned int*,void*) fsetfileinfo fgetfileinfo getservent getservbyport getservbyname getprotoent getprotobynumber getprotobyname gethostbyname gethostbyaddr endservent endprotoent setservent setprotoent gethostname gethostid inet_ntoa inet_addr inet_aton readlink symlink usleep truncate ftruncate setsockopt getsockopt ioctl shutdown getpeername getsockname select sendmsg sendto send writev recvmsg recvfrom recv readv accept listen connect bind socketpair socket getdtablesize mktime gmtime localtime __dt__40GUSISpecificDataFv # GUSISpecificData::~GUSISpecificData() GUSIKillTM gettimeofday time getcwd chdir closedir rewinddir seekdir telldir readdir opendir rmdir mkdir access utime chmod lstat stat rename unlink remove creat open sleep isatty lseek fstat dup2 dup fcntl __dt__12GUSIGathererFv # GUSIGatherer::~GUSIGatherer() write __dt__13GUSIScattererFv # GUSIScatterer::~GUSIScatterer() read close fsync pipe sDefault__15GUSIPThreadAttr # GUSIPThreadAttr::sDefault sDefaultAttr__15GUSIPThreadAttr # GUSIPThreadAttr::sDefaultAttr sched_yield pthread_once pthread_equal pthread_self pthread_cond_broadcast pthread_cond_signal pthread_cond_timedwait pthread_cond_wait pthread_cond_destroy pthread_cond_init pthread_condattr_destroy pthread_condattr_init pthread_mutex_unlock pthread_mutex_trylock pthread_mutex_lock pthread_mutex_destroy pthread_mutex_init pthread_mutexattr_destroy pthread_mutexattr_init pthread_setspecific pthr ead_getspecific pthread_key_delete pthread_key_create pthread_exit pthread_join pthread_detach pthread_create pthread_attr_setstacksize pthread_attr_getstacksize pthread_attr_setdetachstate pthread_attr_getdetachstate pthread_attr_destroy pthread_attr_init __vt__10GUSISocket # GUSISocket::__vt fstat__10GUSISocketFP4stat # GUSISocket::fstat(stat*) sendmsg__10GUSISocketFPC6msghdri # GUSISocket::sendmsg(const msghdr*,int) sendto__10GUSISocketFRC12GUSIGathereriPCvUi # GUSISocket::sendto(const GUSIGatherer&,int,const void*,unsigned int) write__10GUSISocketFRC12GUSIGatherer # GUSISocket::write(const GUSIGatherer&) recvmsg__10GUSISocketFP6msghdri # GUSISocket::recvmsg(msghdr*,int) recvfrom__10GUSISocketFRC13GUSIScattereriPvPUi # GUSISocket::recvfrom(const GUSIScatterer&,int,void*,unsigned int*) read__10GUSISocketFRC13GUSIScatterer # GUSISocket::read(const GUSIScatterer&) select__10GUSISocketFPbPbPb # GUSISocket::select(bool*,bool*,bool*) post_select__10GUSISocketFbbb # GUSISocket::post_select(bool,bool,bool) pre_select__10GUSISocketFbbb # GUSISocket::pre_select(bool,bool,bool) isatty__10GUSISocketFv # GUSISocket::isatty() fsync__10GUSISocketFv # GUSISocket::fsync() lseek__10GUSISocketFli # GUSISocket::lseek(long,int) accept__10GUSISocketFPvPUi # GUSISocket::accept(void*,unsigned int*) shutdown__10GUSISocketFi # GUSISocket::shutdown(int) ftruncate__10GUSISocketFl # GUSISocket::ftruncate(long) ioctl__10GUSISocketFUiPc # GUSISocket::ioctl(unsigned int,char*) fcntl__10GUSISocketFiPc # GUSISocket::fcntl(int,char*) setsockopt__10GUSISocketFiiPvUi # GUSISocket::setsockopt(int,int,void*,unsigned int) getsockopt__10GUSISocketFiiPvPUi # GUSISocket::getsockopt(int,int,void*,unsigned int*) connect__10GUSISocketFPvUi # GUSISocket::connect(void*,unsigned int) listen__10GUSISocketFi # GUSISocket::listen(int) getpeername__10GUSISocketFPvPUi # GUSISocket::getpeername(void*,unsigned int*) getsockname__10GUSISocketFPvPUi # GUSISocket::getsockname(void*,unsigned int*) bind__10GUSISocketFPvUi # GUSISocket::bind(void*,unsigned int) RemoveContext__10GUSISocketFP11GUSIContext # GUSISocket::RemoveContext(GUSIContext*) AddContext__10GUSISocketFP11GUSIContext # GUSISocket::AddContext(GUSIContext*) __dt__10GUSISocketFv # GUSISocket::~GUSISocket() Close__10GUSISocketFUl # GUSISocket::Close(unsigned long) CheckClose__10GUSISocketFUl # GUSISocket::CheckClose(unsigned long) close__10GUSISocketFv # GUSISocket::close() Dequeue__10GUSISocketFv # GUSISocket::Dequeue() Enqueue__10GUSISocketFPP10GUSISocket # GUSISocket::Enqueue(GUSISocket**) Supports__10GUSISocketFQ210GUSISocket12ConfigOption # GUSISocket::Supports(GUSISocket::ConfigOption) __ct__10GUSISocketFv # GUSISocket::GUSISocket() __ct__10GUSImsghdrFRC13GUSIScattGathPCvUi # GUSImsghdr::GUSImsghdr(const GUSIScattGath&,const void*,unsigned int) sKeyAlloc__17GUSISpecificTable # GUSISpecificTable::sKeyAlloc sKeys__17GUSISpecificTable # GUSISpecificTable::sKeys sNextID__12GUSISpecific # GUSISpecific::sNextID Destruct__17GUSISpecificTableFP12GUSISpecific # GUSISpecificTable::Destruct(GUSISpecific*) Register__17GUSISpecificTableFP12GUSISpecific # GUSISpecificTable::Register(GUSISpecific*) DeleteSpecific__17GUSISpecificTableFPC12GUSISpecific # GUSISpecificTable::DeleteSpecific(const GUSISpecific*) SetSpecific__17GUSISpecificTableFPC12GUSISpecificPv # GUSISpecificTable::SetSpecific(const GUSISpecific*,void*) __dt__17GUSISpecificTableFv # GUSISpecificTable::~GUSISpecificTable() __vt__9GUSITimer # GUSITimer::__vt sTimerQueue__9GUSITimer # GUSITimer::sTimerQueue sTimerProc__9GUSITimer # GUSITimer::sTimerProc sTimeZone__8GUSITime # GUSITime::sTimeZone sTimeOffset__8GUSITime # GUSITime::sTimeOffset __dt__53GUSISpecificDataFv # GUSISpecificData::~GUSISpecificData() get__53GUSISpecificDataFP17GUSISpecificTable # GUSISpecificData::get(GUSISpecificTable*) __dt__9GUSITimerFv # GUSITimer::~GUSITimer() Kill__9GUSITimerFv # GUSITimer::Kill() Reset__9GUSITimerFv # GUSITimer::Reset() Sleep__9GUSITimerFlb # GUSITimer::Sleep(long,bool) __ct__9GUSITimerFbP11GUSIContext # GUSITimer::GUSITimer(bool,GUSIContext*) GUSIKillTimers __dt__Q29GUSITimer10TimerQueueFv # GUSITimer::TimerQueue::~TimerQueue() Wakeup__9GUSITimerFv # GUSITimer::Wakeup() GM2LocalTime__8GUSITimeFv # GUSITime::GM2LocalTime() Local2GMTime__8GUSITimeFv # GUSITime::Local2GMTime() Zone__8GUSITimeFv # GUSITime::Zone() Now__8GUSITimeFv # GUSITime::Now() __ct__8GUSITimeFRCQ23std2tm # GUSITime::GUSITime(const std::tm&) __opQ23std2tm__8GUSITimeFv # GUSITime::operator std::tm() __op8timespec__8GUSITimeFv # GUSITime::operator timespec() __op7timeval__8GUSITimeFv # GUSITime::operator timeval() Deconstruct__8GUSITimeFRx # GUSITime::Deconstruct(long long&) Get64__8GUSITimeFQ28GUSITime6Format # GUSITime::Get64(GUSITime::Format) __ct__8GUSITimeFRC8timespec # GUSITime::GUSITime(const timespec&) __ct__8GUSITimeFRC7timeval # GUSITime::GUSITime(const timeval&) Construct__8GUSITimeFxQ28GUSITime6Format # GUSITime::Construct(long long,GUSITime::Format) __vt__9GUSIAlarm # GUSIAlarm::__vt __vt__14GUSISigFactory # GUSISigFactory::__vt __vt__14GUSISigProcess # GUSISigProcess::__vt __vt__14GUSISigContext # GUSISigContext::__vt ualarm __dt__9GUSIAlarmFv # GUSIAlarm::~GUSIAlarm() __dt__Q23std48auto_ptr<9GUSIAlarm,Q23std19_Single<9GUSIAlarm>>Fv # std::auto_ptr>::~auto_ptr() alarm Restart__9GUSIAlarmFl # GUSIAlarm::Restart(long) Wakeup__9GUSIAlarmFv # GUSIAlarm::Wakeup() _exit abort__Fv # abort() sigwait pause sigsuspend sigprocmask pthread_sigmask sigpending signal sigaction pthread_kill raise sigismember sigfillset sigemptyset sigdelset sigaddset CreateSigContext__14GUSISigFactoryFPC14GUSISigContext # GUSISigFactory::CreateSigContext(const GUSISigContext*) CreateSigProcess__14GUSISigFactoryFv # GUSISigFactory::CreateSigProcess() __dt__14GUSISigFactoryFv # GUSISigFactory::~GUSISigFactory() __dt__Q23std60auto_ptr<14GUSISigFactory,Q23std25_Single<14GUSISigFactory>>Fv # std::auto_ptr>::~auto_ptr() SetInstance__14GUSISigFactoryFP14GUSISigFactory # GUSISigFactory::SetInstance(GUSISigFactory*) Instance__14GUSISigFactoryFv # GUSISigFactory::Instance() DefaultAction__14GUSISigProcessFiRC9sigaction # GUSISigProcess::DefaultAction(int,const sigaction&) Raise__14GUSISigProcessFiP14GUSISigContext # GUSISigProcess::Raise(int,GUSISigContext*) Post__14GUSISigProcessFi # GUSISigProcess::Post(int) ClearPending__14GUSISigProcessFUi # GUSISigProcess::ClearPending(unsigned int) Pending__14GUSISigProcessCFv # GUSISigProcess::Pending() const SetAction__14GUSISigProcessFiRC9sigaction # GUSISigProcess::SetAction(int,const sigaction&) CantIgnore__14GUSISigProcessFi # GUSISigProcess::CantIgnore(int) CantCatch__14GUSISigProcessFi # GUSISigProcess::CantCatch(int) GetAction__14GUSISigProcessFi # GUSISigProcess::GetAction(int) __dt__14GUSISigProcessFv # GUSISigProcess::~GUSISigProcess() __ct__14GUSISigProcessFv # GUSISigProcess::GUSISigProcess() Raise__14GUSISigContextFP14GUSISigProcessb # GUSISigContext::Raise(GUSISigProcess*,bool) Ready__14GUSISigContextFP14GUSISigProcess # GUSISigContext::Ready(GUSISigProcess*) Pending__14GUSISigContextCFP14GUSISigProcess # GUSISigContext::Pending(GUSISigProcess*) const Post__14GUSISigContextFi # GUSISigContext::Post(int) ClearPending__14GUSISigContextFUi # GUSISigContext::ClearPending(unsigned int) Pending__14GUSISigContextCFv # GUSISigContext::Pending() const SetBlocked__14GUSISigContextFUi # GUSISigContext::SetBlocked(unsigned int) GetBlocked__14GUSISigContextCFv # GUSISigContext::GetBlocked() const CantBlock__14GUSISigContextFv # GUSISigContext::CantBlock() __dt__14GUSISigContextFv # GUSISigContext::~GUSISigContext() __ct__14GUSISigContextFPC14GUSISigContext # GUSISigContext::GUSISigContext(const GUSISigContext*) __vt__20GUSIOTDatagramSocket # GUSIOTDatagramSocket::__vt __vt__18GUSIOTStreamSocket # GUSIOTStreamSocket::__vt __vt__12GUSIOTSocket # GUSIOTSocket::__vt __vt__14 GUSIOTStrategy # GUSIOTStrategy::__vt __vt__21GUSIOTDatagramFactory # GUSIOTDatagramFactory::__vt __vt__13GUSIOTFactory # GUSIOTFactory::__vt __vt__19GUSIOTStreamFactory # GUSIOTStreamFactory::__vt sOK__13GUSIOTFactory # GUSIOTFactory::sOK __dt__19GUSIOTStreamFactoryFv # GUSIOTStreamFactory::~GUSIOTStreamFactory() __dt__13GUSIOTFactoryFv # GUSIOTFactory::~GUSIOTFactory() __dt__21GUSIOTDatagramFactoryFv # GUSIOTDatagramFactory::~GUSIOTDatagramFactory() select__20GUSIOTDatagramSocketFPbPbPb # GUSIOTDatagramSocket::select(bool*,bool*,bool*) __dt__Q23std80auto_ptr<24GUSIOTAddr<9TUnitData,5>,Q23std35_Single<24GUSIOTAddr<9TUnitData,5>>>Fv # std::auto_ptr, std::_Single>>::~auto_ptr() sendto__20GUSIOTDatagramSocketFRC12GUSIGathereriPCvUi # GUSIOTDatagramSocket::sendto(const GUSIGatherer&,int,const void*,unsigned int) recvfrom__20GUSIOTDatagramSocketFRC13GUSIScattereriPvPUi # GUSIOTDatagramSocket::recvfrom(const GUSIScatterer&,int,void*,unsigned int*) connect__20GUSIOTDatagramSocketFPvUi # GUSIOTDatagramSocket::connect(void*,unsigned int) getpeername__20GUSIOTDatagramSocketFPvPUi # GUSIOTDatagramSocket::getpeername(void*,unsigned int*) BindIfUnbound__20GUSIOTDatagramSocketFv # GUSIOTDatagramSocket::BindIfUnbound() __dt__20GUSIOTDatagramSocketFv # GUSIOTDatagramSocket::~GUSIOTDatagramSocket() Clone__20GUSIOTDatagramSocketFv # GUSIOTDatagramSocket::Clone() __ct__20GUSIOTDatagramSocketFP14GUSIOTStrategy # GUSIOTDatagramSocket::GUSIOTDatagramSocket(GUSIOTStrategy*) shutdown__18GUSIOTStreamSocketFi # GUSIOTStreamSocket::shutdown(int) select__18GUSIOTStreamSocketFPbPbPb # GUSIOTStreamSocket::select(bool*,bool*,bool*) sendto__18GUSIOTStreamSocketFRC12GUSIGathereriPCvUi # GUSIOTStreamSocket::sendto(const GUSIGatherer&,int,const void*,unsigned int) __dt__Q210GUSISocket17AddContextInScopeFv # GUSISocket::AddContextInScope::~AddContextInScope() recvfrom__18GUSIOTStreamSocketFRC13GUSIScattereriPvPUi # GUSIOTStreamSocket::recvfrom(const GUSIScatterer&,int,void*,unsigned int*) connect__18GUSIOTStreamSocketFPvUi # GUSIOTStreamSocket::connect(void*,unsigned int) accept__18GUSIOTStreamSocketFPvPUi # GUSIOTStreamSocket::accept(void*,unsigned int*) getpeername__18GUSIOTStreamSocketFPvPUi # GUSIOTStreamSocket::getpeername(void*,unsigned int*) listen__18GUSIOTStreamSocketFi # GUSIOTStreamSocket::listen(int) MopupEvents__18GUSIOTStreamSocketFv # GUSIOTStreamSocket::MopupEvents() Close__18GUSIOTStreamSocketFUl # GUSIOTStreamSocket::Close(unsigned long) __dt__18GUSIOTStreamSocketFv # GUSIOTStreamSocket::~GUSIOTStreamSocket() close__18GUSIOTStreamSocketFv # GUSIOTStreamSocket::close() Clone__18GUSIOTStreamSocketFv # GUSIOTStreamSocket::Clone() __ct__18GUSIOTStreamSocketFP14GUSIOTStrategy # GUSIOTStreamSocket::GUSIOTStreamSocket(GUSIOTStrategy*) Supports__12GUSIOTSocketFQ210GUSISocket12ConfigOption # GUSIOTSocket::Supports(GUSISocket::ConfigOption) setsockopt__12GUSIOTSocketFiiPvUi # GUSIOTSocket::setsockopt(int,int,void*,unsigned int) getsockopt__12GUSIOTSocketFiiPvPUi # GUSIOTSocket::getsockopt(int,int,void*,unsigned int*) ioctl__12GUSIOTSocketFUiPc # GUSIOTSocket::ioctl(unsigned int,char*) fcntl__12GUSIOTSocketFiPc # GUSIOTSocket::fcntl(int,char*) shutdown__12GUSIOTSocketFi # GUSIOTSocket::shutdown(int) getsockname__12GUSIOTSocketFPvPUi # GUSIOTSocket::getsockname(void*,unsigned int*) Unbind__12GUSIOTSocketFv # GUSIOTSocket::Unbind() BindToAddress__12GUSIOTSocketFP20GUSIOTAddr<5TBind,1> # GUSIOTSocket::BindToAddress(GUSIOTAddr*) bind__12GUSIOTSocketFPvUi # GUSIOTSocket::bind(void*,unsigned int) __dt__12GUSIOTSocketFv # GUSIOTSocket::~GUSIOTSocket() close__12GUSIOTSocketFv # GUSIOTSocket::close() __ct__12GUSIOTSocketFP14GUSIOTStrategy # GUSIOTSocket::GUSIOTSocket(GUSIOTStrategy*) __dt__Q212GUSIOTSocket4LockFv # GUSIOTSocket::Lock::~Lock() MopupEvents__12GUSIOTSocketFv # GUSIOTSocket::MopupEvents() CopyAddress__14GUSIOTStrategyFRC7TNetbufR7TNetbuf # GUSIOTStrategy::CopyAddress(const TNetbuf&,TNetbuf&) __dt__14GUSIOTStrategyFv # GUSIOTStrategy::~GUSIOTStrategy() CreateConfiguration__14GUSIOTStrategyFv # GUSIOTStrategy::CreateConfiguration() socket__21GUSIOTDatagramFactoryFiii # GUSIOTDatagramFactory::socket(int,int,int) socket__19GUSIOTStreamFactoryFiii # GUSIOTStreamFactory::socket(int,int,int) Initialize__13GUSIOTFactoryFv # GUSIOTFactory::Initialize() GUSIOTNotify __vt__15GUSIOTUdpSocket # GUSIOTUdpSocket::__vt __vt__17GUSIOTUdpStrategy # GUSIOTUdpStrategy::__vt __vt__15GUSIOTTcpSocket # GUSIOTTcpSocket::__vt __vt__17GUSIOTTcpStrategy # GUSIOTTcpStrategy::__vt __vt__18GUSIOTInetStrategy # GUSIOTInetStrategy::__vt __vt__16GUSIOTUdpFactory # GUSIOTUdpFactory::__vt __vt__16GUSIOTTcpFactory # GUSIOTTcpFactory::__vt sInstance__16GUSIOTUdpFactory # GUSIOTUdpFactory::sInstance sInstance__16GUSIOTTcpFactory # GUSIOTTcpFactory::sInstance __dt__16GUSIOTTcpFactoryFv # GUSIOTTcpFactory::~GUSIOTTcpFactory() __dt__16GUSIOTUdpFactoryFv # GUSIOTUdpFactory::~GUSIOTUdpFactory() __dt__17GUSIOTTcpStrategyFv # GUSIOTTcpStrategy::~GUSIOTTcpStrategy() __dt__15GUSIOTTcpSocketFv # GUSIOTTcpSocket::~GUSIOTTcpSocket() __dt__17GUSIOTUdpStrategyFv # GUSIOTUdpStrategy::~GUSIOTUdpStrategy() __dt__15GUSIOTUdpSocketFv # GUSIOTUdpSocket::~GUSIOTUdpSocket() GUSIwithOTInetSockets GUSIwithOTUdpSockets GUSIwithOTTcpSockets ioctl__15GUSIOTUdpSocketFUiPc # GUSIOTUdpSocket::ioctl(unsigned int,char*) setsockopt__15GUSIOTUdpSocketFiiPvUi # GUSIOTUdpSocket::setsockopt(int,int,void*,unsigned int) getsockopt__15GUSIOTUdpSocketFiiPvPUi # GUSIOTUdpSocket::getsockopt(int,int,void*,unsigned int*) Clone__15GUSIOTUdpSocketFv # GUSIOTUdpSocket::Clone() ConfigPath__17GUSIOTUdpStrategyFv # GUSIOTUdpStrategy::ConfigPath() ioctl__15GUSIOTTcpSocketFUiPc # GUSIOTTcpSocket::ioctl(unsigned int,char*) setsockopt__15GUSIOTTcpSocketFiiPvUi # GUSIOTTcpSocket::setsockopt(int,int,void*,unsigned int) getsockopt__15GUSIOTTcpSocketFiiPvPUi # GUSIOTTcpSocket::getsockopt(int,int,void*,unsigned int*) Clone__15GUSIOTTcpSocketFv # GUSIOTTcpSocket::Clone() ConfigPath__17GUSIOTTcpStrategyFv # GUSIOTTcpStrategy::ConfigPath() DoIoctl__18GUSIOTMInetOptionsFPiUiPc # GUSIOTMInetOptions::DoIoctl(int*,unsigned int,char*) DoSetSockOpt__18GUSIOTMInetOptionsFPiP9TEndpointiiPvUi # GUSIOTMInetOptions::DoSetSockOpt(int*,TEndpoint*,int,int,void*,unsigned int) DoGetSockOpt__18GUSIOTMInetOptionsFPiP9TEndpointiiPvPUi # GUSIOTMInetOptions::DoGetSockOpt(int*,TEndpoint*,int,int,void*,unsigned int*) UnpackAddress__18GUSIOTInetStrategyFRC7TNetbufPvPUi # GUSIOTInetStrategy::UnpackAddress(const TNetbuf&,void*,unsigned int*) PackAddress__18GUSIOTInetStrategyFPCvUiR7TNetbufb # GUSIOTInetStrategy::PackAddress(const void*,unsigned int,TNetbuf&,bool) socket__16GUSIOTUdpFactoryFiii # GUSIOTUdpFactory::socket(int,int,int) Strategy__16GUSIOTUdpFactoryFiii # GUSIOTUdpFactory::Strategy(int,int,int) Instance__16GUSIOTUdpFactoryFv # GUSIOTUdpFactory::Instance() socket__16GUSIOTTcpFactoryFiii # GUSIOTTcpFactory::socket(int,int,int) __dt__18GUSIOTInetStrategyFv # GUSIOTInetStrategy::~GUSIOTInetStrategy() Strategy__16GUSIOTTcpFactoryFiii # GUSIOTTcpFactory::Strategy(int,int,int) Instance__16GUSIOTTcpFactoryFv # GUSIOTTcpFactory::Instance() __vt__11GUSIOTNetDB # GUSIOTNetDB::__vt get__49GUSISpecificData<11GUSIhostent,&.GUSIKillHostEnt>FP17GUSISpecificTable # GUSISpecificData::get(GUSISpecificTable*) __dt__11GUSIOTNetDBFv # GUSIOTNetDB::~GUSIOTNetDB() gethostid__11GUSIOTNetDBFv # GUSIOTNetDB::gethostid() inet_ntoa__11GUSIOTNetDBF7in_addr # GUSIOTNetDB::inet_ntoa(in_addr) gethostbyaddr__11GUSIOTNetDBFPCvUli # GUSIOTNetDB::gethostbyaddr(const void*,unsigned long,int) gethostbyname__11GUSIOTNetDBFPCc # GUSIOTNetDB::gethostbyname(const char*) Resolver__11GUSIOTNetDBFv # GUSIOTNetDB::Resolver() Instantiate__11GUSIOTNetDBFv # GUSIOTNetDB::Instantiate() __dt__49GUSISpecificData<11GUSIhostent,&.GUSIKillHostEnt>Fv # GUSISpecificData::~GUSISpecificData() __ct__11GUSIOTNetDBFv # GUSIOTNetDB::GUSIOTNetDB() GUSIOTNetDBNotify __dc_arr __del_arr __new_arr __init_arr __copy __ som_check_ev __som_check_new __vt__Q23std13bad_exception # std::bad_exception::__vt __vt__Q23std9exception # std::exception::__vt what__Q23std9exceptionCFv # std::exception::what() const what__Q23std13bad_exceptionCFv # std::bad_exception::what() const __end__catch __throw __dt__Q23std9exceptionFv # std::exception::~exception() __unexpected __dt__Q23std13bad_exceptionFv # std::bad_exception::~bad_exception() __unregister_fragment __register_fragment __global_destructor_chain __destroy_global_chain __register_global_object __destroy_new_array3 __destroy_new_array2 __destroy_new_array __destroy_arr __construct_array __dt__26__partial_array_destructorFv # __partial_array_destructor::~__partial_array_destructor() __construct_new_array __throw_catch_compare unexpected__3stdFv # std::unexpected() set_unexpected__3stdFPFv_v # std::set_unexpected(void (*)(void)) terminate__3stdFv # std::terminate() set_terminate__3stdFPFv_v # std::set_terminate(void (*)(void)) __vt__Q23std8bad_cast # std::bad_cast::__vt __vt__Q23std10bad_typeid # std::bad_typeid::__vt what__Q23std10bad_typeidCFv # std::bad_typeid::what() const what__Q23std8bad_castCFv # std::bad_cast::what() const __dynamic_cast __dt__Q23std8bad_castFv # std::bad_cast::~bad_cast() __get_typeid __dt__Q23std10bad_typeidFv # std::bad_typeid::~bad_typeid() nothrow__3std # std::nothrow __dla__FPvRCQ23std9nothrow_t # operator delete[](void*,const std::nothrow_t&) __dl__FPvRCQ23std9nothrow_t # operator delete(void*,const std::nothrow_t&) __dla__FPv # operator delete[](void*) __nwa__FUlRCQ23std9nothrow_t # operator new[](unsigned long,const std::nothrow_t&) __nwa__FUl # operator new[](unsigned long) __dl__FPv # operator delete(void*) __nw__FUlRCQ23std9nothrow_t # operator new(unsigned long,const std::nothrow_t&) __nw__FUl # operator new(unsigned long) __throws_bad_alloc__3std # std::__throws_bad_alloc __vt__Q23std9bad_alloc # std::bad_alloc::__vt __new_handler__3std # std::__new_handler what__Q23std9bad_allocCFv # std::bad_alloc::what() const __del_hdl __new_hdl set_new_handler__3stdFPFv_v # std::set_new_handler(void (*)(void)) __throw_bad_alloc__3stdFv # std::__throw_bad_alloc() __dt__Q23std9bad_allocFv # std::bad_alloc::~bad_alloc() qd exit clrscr getch kbhit SIOUXSetTitle __ttyname ReadCharsFromConsole WriteCharsToConsole RemoveConsole InstallConsole SIOUXHandleOneEvent SIOUXisinrange SIOUXDragRect SIOUXBigRect SIOUXSettings SIOUXTextWindow SIOUXState SIOUXUseWaitNextEvent SIOUXQuitting SIOUXselstart SIOUXDoMenuChoice SIOUXDoEditSelectAll SIOUXDoEditClear SIOUXDoEditPaste SIOUXDoEditCopy SIOUXDoEditCut SIOUXDoSaveText SIOUXUpdateMenuItems SIOUXSetupMenus SIOUXDoPrintText SIOUXDoPageSetup SIOUXYesNoCancelAlert SIOUXCantSaveAlert SIOUXSetupTextWindow SIOUXDoContentClick SIOUXMyGrowWindow SIOUXUpdateStatusLine MoveScrollBox SIOUXUpdateScrollbar SIOUXUpdateWindow SIOUXDrawGrowBox AdjustText SIOUXIsAppWindow __console_exit __stdio_exit __aborting __exit exit __atexit atexit fix_start vec_free vec_realloc vec_calloc vec_malloc __pool_free_all calloc realloc free malloc __msize deallocate_from_fixed_pools allocate_from_fixed_pools __files __flush_line_buffered_output_files __flush_all __close_all __init_file __find_unopened_file __llmod __lmod __mod __lldiv __ldiv __div __llmul __lmul __mul __lladd __ladd __add lldiv ldiv div llabs labs abs __assertion_failed bsearch setbuf setvbuf __flush_buffer __load_buffer __prep_buffer __convert_to_newlines __convert_from_newlines ccommand puts fputs putchar putc fputc __put_char __ungotten ungetc gets fgets getchar getc fgetc __get_char __ctype_map __lower_map __upper_map fwrite fread errno _splitpath _makepath _strrev _itow _itoa _strspnp _strnset _strset _strdate _strupr _wstrrev _strnicmp _stricmp _heapmin _gcvt _ultoa _strlwr _wcsspnp _wcsnset _wcsset _wcsrev _wcsnicmp _wcsicmp _wcsupr _wcslwr __temp_file_mode __set_idle_proc __get_file_modes __handle_reopen __handle_open __reopen freopen fopen fflush fclose tmpfile tmpnam __rename_file __delete_file __temp_file_name rewind fsetpos fseek _fseek fgetpos ftell _ftell __lconv localeconv setlocale wcstombs mbstowcs wctomb mbtowc mblen memcmp __memrchr memchr memset memmove memcpy __fill_mem __copy_longs_rev_unaligned __copy_longs_unaligned __copy_longs_rev_aligned __copy_longs_aligned __move_mem __copy_mem __stdio_atexit perror ferror feof clearerr __path2fss __sys_pointer_size __sys_free __sys_alloc sprintf snprintf vsprintf vsnprintf vfprintf vprintf fprintf printf __StringWrite __FileWrite qsort srand rand sscanf vsscanf vfscanf scanf fscanf __StringRead __FileRead __strerror strerror strstr strtok strcspn strspn strpbrk strrchr strxfrm strcoll strchr strncmp strcmp strncat strcat strncpy strcpy strlen atof strtod strtold __strtold atol atoi strtoll strtol strtoull strtoul __strtoull __strtoul system getenv __month_to_days strftime ctime asctime difftime clock __leap_year __to_gm_time __get_time __get_clock _fcntl _creat _open _mkdir _fstat _stat _write _unlink _ttyname _sleep _rmdir _read _lseek _isatty _getlogin _getcwd _exec _cuserid _close _chdir __new_umask _fileno _umask _ftype _fcreator _chmod __gettype __getcreator __ctopstring __system7present utimes _uname __float_nan __float_huge __double_min __double_max __double_epsilon __double_tiny __double_huge __double_nan __extended_min __extended_max __extended_epsilon __extended_tiny __extended_huge __extended_nan fwide fgetws fputws ungetwc fgetwc getwchar getwc fputwc putwchar putwc watof wcstod __wcstold watol watoi wcstoll wcstol wcstoull wcstoul __wcstoull __wcstoul wctrans towctrans __wctype_map __wlower_map __wupper_map iswctype wctype wctob wmemcmp wmemchr wmemset wmemmove wmemcpy vswprintf swprintf vfwprintf vwprintf fwprintf wprintf __wStringWrite __wFileWrite swscanf vswscanf vfwscanf vwscanf wscanf fwscanf __wStringRead __wFileRead wcsstr wcstok wcscspn wcsspn wcspbrk wcsrchr wcsxfrm wcscoll wcschr wcsncmp wcscmp wcsncat wcscat wcsncpy wcscpy wcslen wcsftime wctime wasctime __fminl __fmaxl __fdiml __nextafterl __remquol __copysignl __remainderl __fmodl __modfl __truncl llroundl lroundl __roundl llrintl lrintl __rintl __nearbyintl __floorl __ceill __lgammal __gammal __erfcl __erfl __hypotl __sqrtl __powl __fabsl scalblnl scalbnl __logbl __log2l __log1pl __expm1l __exp2l __log10l __logl __ldexpl __frexpl __expl __atanhl __asinhl __acoshl __tanhl __sinhl __coshl __tanl __sinl __cosl __atan2l __atanl __asinl __acosl fminf fmaxf fdimf remquof copysignf remainderf fmodf truncf llroundf lroundf roundf llrintf lrintf rintf nearbyintf floorf ceilf lgammaf gammaf erfcf erff hypotf sqrtf powf fabsf scalblnf scalbnf logbf log2f log1pf expm1f exp2f log10f logf ldexpf frexpf expf atanhf asinhf acoshf tanhf sinhf coshf tanf sinf cosf atan2f atanf asinf acosf nextafter llround lround llrint lrint scalbln scalbn \ No newline at end of file --- 1,2242 ---- ! sSuffices ! GUSISetupConfig ! GUSISetupDevices ! GUSISetupFactories ! __vt__15GUSISIOUXDevice # GUSISIOUXDevice::__vt ! __vt__15GUSISIOUXSocket # GUSISIOUXSocket::__vt ! sInstance__15GUSISIOUXDevice # GUSISIOUXDevice::sInstance [...2215 lines suppressed...] ! atanhf ! asinhf ! acoshf ! tanhf ! sinhf ! coshf ! tanf ! sinf ! cosf ! atan2f ! atanf ! asinf ! acosf ! nextafter ! llround ! lround ! llrint ! lrint ! scalbln ! scalbn From jackjansen@users.sourceforge.net Sat May 12 22:09:17 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 14:09:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Build PythonStandalone.mcp,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv8178/Python/Mac/Build Modified Files: PythonStandalone.mcp Log Message: Added iterobject.c to the project. And trying my first checkin at the same time. Index: PythonStandalone.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonStandalone.mcp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 Binary files /tmp/cvsyU5MZN and /tmp/cvsoVo10q differ From jackjansen@users.sourceforge.net Sat May 12 22:09:48 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 14:09:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Build PythonStandSmall.mcp,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv8265/Python/Mac/Build Modified Files: PythonStandSmall.mcp Log Message: Added iterobject.c to the project. And trying my first checkin at the same time. Index: PythonStandSmall.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonStandSmall.mcp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 Binary files /tmp/cvsj8lHga and /tmp/cvsGrlkxd differ From tim.one@home.com Sat May 12 22:28:23 2001 From: tim.one@home.com (Tim Peters) Date: Sat, 12 May 2001 17:28:23 -0400 Subject: [Python-checkins] CVS: python/dist/src/Mac/Build PythonCore.exp,1.6,1.7 In-Reply-To: Message-ID: [Jack Jansen] > Added iterobject.c to the project. And trying my first checkin at > the same time. Congratulations, Jack! Welcome to the exclusive working-checkin club -- far fewer than 100 sentient beings in the entire history of the universe have made a successful checkin to this repository . From jackjansen@users.sourceforge.net Sat May 12 22:30:04 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 14:30:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Include macglue.h,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv11903/Python/Mac/Include Modified Files: macglue.h Log Message: Be more sensible about when to use TARGET_API_MAC_OS8 in stead of !TARGET_API_MAC_CARBON. This should greatly facilitate porting stuff to OSX in its MachO/BSD incarnation. Index: macglue.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/macglue.h,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -r1.52 -r1.53 *** macglue.h 2001/04/25 22:07:42 1.52 --- macglue.h 2001/05/12 21:30:02 1.53 *************** *** 85,93 **** struct filedescr *PyMac_FindModuleExtension(char *, size_t *, char *); /* Look for module in single folder */ ! #if !TARGET_API_MAC_CARBON int PyMac_GetDirectory(FSSpec *dirfss, char *prompt); /* Ask user for a directory */ void PyMac_PromptGetFile(short numTypes, ConstSFTypeListPtr typeList, StandardFileReply *reply, char *prompt); /* Ask user for file, with prompt */ ! #endif /* TARGET_API_MAC_CARBON */ int PyMac_GetOSType(PyObject *, OSType *); /* argument parser for OSType */ --- 85,93 ---- struct filedescr *PyMac_FindModuleExtension(char *, size_t *, char *); /* Look for module in single folder */ ! #if TARGET_API_MAC_OS8 int PyMac_GetDirectory(FSSpec *dirfss, char *prompt); /* Ask user for a directory */ void PyMac_PromptGetFile(short numTypes, ConstSFTypeListPtr typeList, StandardFileReply *reply, char *prompt); /* Ask user for file, with prompt */ ! #endif /* TARGET_API_MAC_OS8 */ int PyMac_GetOSType(PyObject *, OSType *); /* argument parser for OSType */ From jackjansen@users.sourceforge.net Sat May 12 22:31:28 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 14:31:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Python macglue.c,1.90,1.91 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv12197/Python/Mac/Python Modified Files: macglue.c Log Message: Be more sensible about when to use TARGET_API_MAC_OS8 in stead of !TARGET_API_MAC_CARBON. This should greatly facilitate porting stuff to OSX in its MachO/BSD incarnation. Index: macglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macglue.c,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -r1.90 -r1.91 *** macglue.c 2001/04/25 22:07:27 1.90 --- macglue.c 2001/05/12 21:31:25 1.91 *************** *** 33,37 **** #include ! #if TARGET_API_MAC_CARBON /* Unfortunately this call is probably slower... */ #define LMGetTicks() TickCount() --- 33,37 ---- #include ! #if !TARGET_API_MAC_OS8 /* Unfortunately this call is probably slower... */ #define LMGetTicks() TickCount() *************** *** 172,176 **** char *prompt; /* The prompt */ }; ! #if TARGET_API_MAC_CARBON /* The StandardFile hooks don't exist in Carbon. This breaks GetDirectory, ** but the macfsn code will replace it by a NavServices version anyway. --- 172,176 ---- char *prompt; /* The prompt */ }; ! #if !TARGET_API_MAC_OS8 /* The StandardFile hooks don't exist in Carbon. This breaks GetDirectory, ** but the macfsn code will replace it by a NavServices version anyway. *************** *** 298,302 **** } ! #if !TARGET_API_MAC_CARBON /* ** Replacement routines for the PLstr... functions so we don't need --- 298,302 ---- } ! #if TARGET_API_MAC_OS8 /* ** Replacement routines for the PLstr... functions so we don't need *************** *** 339,343 **** } ! #endif /* !TARGET_API_MAC_CARBON */ #endif /* USE_GUSI */ --- 339,343 ---- } ! #endif /* TARGET_API_MAC_OS8 */ #endif /* USE_GUSI */ *************** *** 358,362 **** } ! #if !TARGET_API_MAC_CARBON void c2pstrcpy(unsigned char *dst, const char *src) --- 358,362 ---- } ! #if TARGET_API_MAC_OS8 void c2pstrcpy(unsigned char *dst, const char *src) *************** *** 369,373 **** dst[0] = len; } ! #endif /* !TARGET_API_MAC_CARBON */ /* Like strerror() but for Mac OS error numbers */ --- 369,373 ---- dst[0] = len; } ! #endif /* TARGET_API_MAC_OS8 */ /* Like strerror() but for Mac OS error numbers */ *************** *** 499,503 **** int flush; { ! #if TARGET_API_MAC_CARBON if ( CheckEventQueueForUserCancel() ) interrupted = 1; --- 499,503 ---- int flush; { ! #if !TARGET_API_MAC_OS8 if ( CheckEventQueueForUserCancel() ) interrupted = 1; *************** *** 609,613 **** EventRecord *evp; { ! #if !TARGET_API_MAC_CARBON if ( evp->what == mouseDown ) { WindowPtr wp; --- 609,613 ---- EventRecord *evp; { ! #if TARGET_API_MAC_OS8 if ( evp->what == mouseDown ) { WindowPtr wp; *************** *** 687,691 **** (python_event_handler && !maycallpython) ) { if ( maxsleep >= 0 ) { ! #if !TARGET_API_MAC_CARBON SystemTask(); #else --- 687,691 ---- (python_event_handler && !maycallpython) ) { if ( maxsleep >= 0 ) { ! #if TARGET_API_MAC_OS8 SystemTask(); #else *************** *** 879,883 **** return item; } ! #if !TARGET_API_MAC_CARBON /* ** Ask the user for a directory. I still can't understand --- 879,883 ---- return item; } ! #if TARGET_API_MAC_OS8 /* ** Ask the user for a directory. I still can't understand *************** *** 932,936 **** myhook_upp, NULL, NULL, NULL, (void *)&hook_args); } ! #endif /* TARGET_API_MAC_CARBON */ /* Convert a 4-char string object argument to an OSType value */ --- 932,936 ---- myhook_upp, NULL, NULL, NULL, (void *)&hook_args); } ! #endif /* TARGET_API_MAC_OS8 */ /* Convert a 4-char string object argument to an OSType value */ From jackjansen@users.sourceforge.net Sat May 12 22:31:32 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 14:31:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules macmodule.c,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12223/Python/Mac/Modules Modified Files: macmodule.c Log Message: Be more sensible about when to use TARGET_API_MAC_OS8 in stead of !TARGET_API_MAC_CARBON. This should greatly facilitate porting stuff to OSX in its MachO/BSD incarnation. Index: macmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macmodule.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -r1.42 -r1.43 *** macmodule.c 2001/01/12 23:37:14 1.42 --- macmodule.c 2001/05/12 21:31:30 1.43 *************** *** 32,36 **** #include ! #if !TARGET_API_MAC_CARBON /* Skip for Carbon */ #include "macstat.h" --- 32,36 ---- #include ! #if TARGET_API_MAC_OS8 /* Skip for Carbon */ #include "macstat.h" *************** *** 52,56 **** #include #else /* USE_GUSI */ ! #if !TARGET_API_MAC_CARBON #define stat macstat #endif --- 52,56 ---- #include #else /* USE_GUSI */ ! #if TARGET_API_MAC_OS8 #define stat macstat #endif *************** *** 260,264 **** #endif ! #if !TARGET_API_MAC_CARBON static PyObject * mac_getbootvol(self, args) --- 260,264 ---- #endif ! #if TARGET_API_MAC_OS8 static PyObject * mac_getbootvol(self, args) *************** *** 500,504 **** #endif /* WEHAVE_FSTAT */ ! #if !TARGET_API_MAC_CARBON static PyObject * mac_xstat(self, args) --- 500,504 ---- #endif /* WEHAVE_FSTAT */ ! #if TARGET_API_MAC_OS8 static PyObject * mac_xstat(self, args) *************** *** 612,616 **** {"fstat", mac_fstat}, #endif ! #if !TARGET_API_MAC_CARBON {"getbootvol", mac_getbootvol}, /* non-standard */ #endif --- 612,616 ---- {"fstat", mac_fstat}, #endif ! #if TARGET_API_MAC_OS8 {"getbootvol", mac_getbootvol}, /* non-standard */ #endif *************** *** 624,628 **** {"rmdir", mac_rmdir}, {"stat", mac_stat}, ! #if !TARGET_API_MAC_CARBON {"xstat", mac_xstat}, #endif --- 624,628 ---- {"rmdir", mac_rmdir}, {"stat", mac_stat}, ! #if TARGET_API_MAC_OS8 {"xstat", mac_xstat}, #endif From jackjansen@users.sourceforge.net Sat May 12 22:31:37 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 14:31:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules macosmodule.c,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12246/Python/Mac/Modules Modified Files: macosmodule.c Log Message: Be more sensible about when to use TARGET_API_MAC_OS8 in stead of !TARGET_API_MAC_CARBON. This should greatly facilitate porting stuff to OSX in its MachO/BSD incarnation. Index: macosmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macosmodule.c,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -r1.52 -r1.53 *** macosmodule.c 2001/01/23 22:38:23 1.52 --- macosmodule.c 2001/05/12 21:31:34 1.53 *************** *** 361,365 **** #include ! #if !TARGET_API_MAC_CARBON static char accepthle_doc[] = "Get arguments of pending high-level event"; --- 361,365 ---- #include ! #if TARGET_API_MAC_OS8 static char accepthle_doc[] = "Get arguments of pending high-level event"; *************** *** 705,709 **** static PyMethodDef MacOS_Methods[] = { ! #if !TARGET_API_MAC_CARBON {"AcceptHighLevelEvent", MacOS_AcceptHighLevelEvent, 1, accepthle_doc}, #endif --- 705,709 ---- static PyMethodDef MacOS_Methods[] = { ! #if TARGET_API_MAC_OS8 {"AcceptHighLevelEvent", MacOS_AcceptHighLevelEvent, 1, accepthle_doc}, #endif *************** *** 761,768 **** return; #if TARGET_API_MAC_CARBON - /* Will need a different name for MachO-carbon later (macho?) */ #define PY_RUNTIMEMODEL "carbon" ! #else #define PY_RUNTIMEMODEL "ppc" #endif if (PyDict_SetItemString(d, "runtimemodel", --- 761,771 ---- return; #if TARGET_API_MAC_CARBON #define PY_RUNTIMEMODEL "carbon" ! #elif TARGET_API_MAC_OS8 #define PY_RUNTIMEMODEL "ppc" + #elif TARGET_API_MAC_OSX + #define PY_RUNTIMEMODEL "macho" + #else + #error "None of the TARGET_API_MAC_XXX I know about is set" #endif if (PyDict_SetItemString(d, "runtimemodel", From jack@oratrix.nl Sat May 12 22:47:04 2001 From: jack@oratrix.nl (Jack Jansen) Date: Sat, 12 May 2001 23:47:04 +0200 Subject: [Python-checkins] CVS: python/dist/src/Mac/Build PythonCore.exp,1.6,1.7 In-Reply-To: Message by "Tim Peters" , Sat, 12 May 2001 17:28:23 -0400 , Message-ID: <20010512214710.28828E9391@oratrix.oratrix.nl> Recently, "Tim Peters" said: > [Jack Jansen] > > Added iterobject.c to the project. And trying my first checkin at > > the same time. > > Congratulations, Jack! > > Welcome to the exclusive working-checkin club -- far fewer than 100 sentient > beings in the entire history of the universe have made a successful checkin > to this repository . Well, if you had had your windows open you could probably have heard me screaming and cursing all the way from Amsterdam. MacCVS was a pretty decent CVS client that allowed you to get basically at the bowels of the command line, and had all the Mac niceties like creator/type mapping, etc. This braindead MacCVS Pro I'm now using is completely un-cvs-like, and has none of the niceties either. I dearly hope someone will finally add ssh support to MacCVS so I can get back to a decent client, I'm already starting to regret the merging of the Mac tree into the main tree (half a :-). And it does a checkin per file. Sheesh. Sorry folks, you'll have to bear with me:-( -- Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++ Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++ www.oratrix.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm From jackjansen@users.sourceforge.net Sat May 12 23:46:37 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 15:46:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Python macglue.c,1.91,1.92 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv24671/python Modified Files: macglue.c Log Message: Got the first MacPython module working under MacOSX/MachO (gestalt). Main changes are including Carbon/Carbon.h in stead of the old headers (unless WITHOUT_FRAMEWORKS is defined, as it will be for classic MacPython) and selectively disabling all the stuff that is unneeded in a unix-Python (event handling, etc). Index: macglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macglue.c,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -r1.91 -r1.92 *** macglue.c 2001/05/12 21:31:25 1.91 --- macglue.c 2001/05/12 22:46:35 1.92 *************** *** 23,44 **** ******************************************************************/ - #ifdef __CFM68K__ - /* cfm68k InterfaceLib exports GetEventQueue, but Events.h doesn't know this - ** and defines it as GetEvQHdr (which is correct for PPC). This fix is for - ** CW9, check that the workaround is still needed for the next release. - */ - #define GetEvQHdr GetEventQueue - #endif /* __CFM68K__ */ - - #include - - #if !TARGET_API_MAC_OS8 - /* Unfortunately this call is probably slower... */ - #define LMGetTicks() TickCount() - #endif - - #ifdef __CFM68K__ - #undef GetEventQueue - #endif /* __CFM68K__ */ #include "Python.h" --- 23,26 ---- *************** *** 51,54 **** --- 33,37 ---- #include "pythonresources.h" + #ifdef WITHOUT_FRAMEWORKS #include /* for Set(Current)A5 */ #include *************** *** 62,65 **** --- 45,71 ---- #include #include + #include + #ifdef __CFM68K__ + /* cfm68k InterfaceLib exports GetEventQueue, but Events.h doesn't know this + ** and defines it as GetEvQHdr (which is correct for PPC). This fix is for + ** CW9, check that the workaround is still needed for the next release. + */ + #define GetEvQHdr GetEventQueue + #endif /* __CFM68K__ */ + + #include + + #ifdef __CFM68K__ + #undef GetEventQueue + #endif /* __CFM68K__ */ + #else + #include + #endif + + #if !TARGET_API_MAC_OS8 + /* Unfortunately this call is probably slower... */ + #define LMGetTicks() TickCount() + #endif + #ifdef __MWERKS__ #include *************** *** 81,85 **** #include #endif - #include /* The ID of the Sioux apple menu */ --- 87,90 ---- *************** *** 133,137 **** --- 138,144 ---- static RETSIGTYPE intcatcher(int); + #if !TARGET_API_MAC_OSX static int PyMac_Yield(void); + #endif /* *************** *** 467,470 **** --- 474,478 ---- #endif /* USE_STACKCHECK */ + #if !TARGET_API_MAC_OSX /* The catcher routine (which may not be used for all compilers) */ static RETSIGTYPE *************** *** 540,562 **** } - #if 0 - /* - ** This routine is called if we know that an external library yielded - ** to background tasks, so we shouldn't count that time in our computation - ** of how much CPU we used. - ** This happens with SIOUX, and the routine is called from our modified - ** GUSISIOUX. - */ - void - PyMac_LibraryDidYield(int howlong) - { - unsigned long maxnextcheck = (unsigned long)LMGetTicks() + schedparams.check_interval; - - schedparams.next_check = schedparams.next_check + howlong; - if (schedparams.next_check > maxnextcheck ) - schedparams.next_check = maxnextcheck; - } - #endif - int PyOS_InterruptOccurred() --- 548,551 ---- *************** *** 565,568 **** --- 554,558 ---- return interrupted; } + /* Check whether we are in the foreground */ static int *************** *** 583,588 **** eq = 1; return (int)eq; - } int --- 573,578 ---- eq = 1; return (int)eq; } + #endif int *************** *** 656,659 **** --- 646,650 ---- } + #if !TARGET_API_MAC_OSX /* ** Yield the CPU to other tasks without processing events. *************** *** 846,861 **** } ! #if 0 ! int ! PyMac_FileExists(char *name) ! { ! FSSpec fss; ! ! if ( FSMakeFSSpec(0, 0, Pstring(name), &fss) == noErr ) ! return 1; ! return 0; ! } ! #endif /* ** Helper routine for GetDirectory --- 837,843 ---- } ! #endif /* !TARGET_API_MAC_OSX */ + #if TARGET_API_MAC_OS8 /* ** Helper routine for GetDirectory *************** *** 879,883 **** return item; } ! #if TARGET_API_MAC_OS8 /* ** Ask the user for a directory. I still can't understand --- 861,865 ---- return item; } ! /* ** Ask the user for a directory. I still can't understand *************** *** 1017,1020 **** --- 999,1004 ---- FSSpec *fs2; + #if !TARGET_API_MAC_OSX + /* XXX This #if is temporary */ /* first check whether it already is an FSSpec */ fs2 = mfs_GetFSSpecFSSpec(v); *************** *** 1023,1026 **** --- 1007,1011 ---- return 1; } + #endif if ( PyString_Check(v) ) { /* It's a pathname */ *************** *** 1046,1050 **** --- 1031,1040 ---- PyObject *PyMac_BuildFSSpec(FSSpec *v) { + #if TARGET_API_MAC_OSX + PyErr_SetString(PyExc_NotImplementedError, "FSSpec not yet done for OSX"); + return NULL; + #else return newmfssobject(v); + #endif } From jackjansen@users.sourceforge.net Sat May 12 23:46:37 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 15:46:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules gestaltmodule.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv24671/Modules Modified Files: gestaltmodule.c Log Message: Got the first MacPython module working under MacOSX/MachO (gestalt). Main changes are including Carbon/Carbon.h in stead of the old headers (unless WITHOUT_FRAMEWORKS is defined, as it will be for classic MacPython) and selectively disabling all the stuff that is unneeded in a unix-Python (event handling, etc). Index: gestaltmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/gestaltmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** gestaltmodule.c 1999/08/23 11:37:51 1.6 --- gestaltmodule.c 2001/05/12 22:46:35 1.7 *************** *** 28,33 **** --- 28,37 ---- #include "macglue.h" + #ifdef WITHOUT_FRAMEWORKS #include #include + #else + #include + #endif static PyObject * From jackjansen@users.sourceforge.net Sat May 12 23:46:37 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 12 May 2001 15:46:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Include macglue.h,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv24671/Include Modified Files: macglue.h Log Message: Got the first MacPython module working under MacOSX/MachO (gestalt). Main changes are including Carbon/Carbon.h in stead of the old headers (unless WITHOUT_FRAMEWORKS is defined, as it will be for classic MacPython) and selectively disabling all the stuff that is unneeded in a unix-Python (event handling, etc). Index: macglue.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/macglue.h,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -r1.53 -r1.54 *** macglue.h 2001/05/12 21:30:02 1.53 --- macglue.h 2001/05/12 22:46:35 1.54 *************** *** 23,30 **** --- 23,34 ---- ******************************************************************/ + #ifdef WITHOUT_FRAMEWORKS #include #include #include #include + #else + #include + #endif #ifdef __cplusplus *************** *** 48,51 **** --- 52,57 ---- char *PyMac_StrError(int); /* strerror with mac errors */ + PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */ + PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ unsigned char *Pstring(char *str); /* Convert c-string to pascal-string in static buffer */ *************** *** 66,82 **** PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */ void PyMac_GetSchedParams(PyMacSchedParams *); /* Get schedulers params */ void PyMac_SetSchedParams(PyMacSchedParams *); /* Set schedulers params */ - PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */ - PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ int PyMac_DoYield(int, int); /* Yield cpu. First arg is maxtime, second ok to call python */ int PyMac_HandleEvent(EventRecord *); /* Handle one event, possibly in Python */ void PyMac_HandleEventIntern(EventRecord *); /* Handle one event internal only */ int PyMac_SetEventHandler(PyObject *); /* set python-coded event handler */ void PyMac_InitMenuBar(void); /* Setup menu bar as we want it */ void PyMac_RestoreMenuBar(void); /* Restore menu bar for ease of exiting */ void PyMac_RaiseConsoleWindow(); /* Bring console window to front, if it exists */ ! int PyMac_FindResourceModule(PyStringObject *, char *, char *); /* Test for 'PYC ' resource in a file */ PyObject * PyMac_LoadResourceModule(char *, char *); /* Load 'PYC ' resource from file */ --- 72,89 ---- PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */ + #if !TARGET_API_MAC_OSX void PyMac_GetSchedParams(PyMacSchedParams *); /* Get schedulers params */ void PyMac_SetSchedParams(PyMacSchedParams *); /* Set schedulers params */ int PyMac_DoYield(int, int); /* Yield cpu. First arg is maxtime, second ok to call python */ + #endif int PyMac_HandleEvent(EventRecord *); /* Handle one event, possibly in Python */ void PyMac_HandleEventIntern(EventRecord *); /* Handle one event internal only */ int PyMac_SetEventHandler(PyObject *); /* set python-coded event handler */ + #if !TARGET_API_MAC_OSX void PyMac_InitMenuBar(void); /* Setup menu bar as we want it */ void PyMac_RestoreMenuBar(void); /* Restore menu bar for ease of exiting */ void PyMac_RaiseConsoleWindow(); /* Bring console window to front, if it exists */ ! #endif int PyMac_FindResourceModule(PyStringObject *, char *, char *); /* Test for 'PYC ' resource in a file */ PyObject * PyMac_LoadResourceModule(char *, char *); /* Load 'PYC ' resource from file */ From tim_one@users.sourceforge.net Sun May 13 01:19:33 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 12 May 2001 17:19:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib Cookie.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1323/python/dist/src/Lib Modified Files: Cookie.py Log Message: Get rid of the superstitious "~" in dict hashing's "i = (~hash) & mask". The comment following used to say: /* We use ~hash instead of hash, as degenerate hash functions, such as for ints , can have lots of leading zeros. It's not really a performance risk, but better safe than sorry. 12-Dec-00 tim: so ~hash produces lots of leading ones instead -- what's the gain? */ That is, there was never a good reason for doing it. And to the contrary, as explained on Python-Dev last December, it tended to make the *sum* (i + incr) & mask (which is the first table index examined in case of collison) the same "too often" across distinct hashes. Changing to the simpler "i = hash & mask" reduced the number of string-dict collisions (== # number of times we go around the lookup for-loop) from about 6 million to 5 million during a full run of the test suite (these are approximate because the test suite does some random stuff from run to run). The number of collisions in non-string dicts also decreased, but not as dramatically. Note that this may, for a given dict, change the order (wrt previous releases) of entries exposed by .keys(), .values() and .items(). A number of std tests suffered bogus failures as a result. For dicts keyed by small ints, or (less so) by characters, the order is much more likely to be in increasing order of key now; e.g., >>> d = {} >>> for i in range(10): ... d[i] = i ... >>> d {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9} >>> Unfortunately. people may latch on to that in small examples and draw a bogus conclusion. test_support.py Moved test_extcall's sortdict() into test_support, made it stronger, and imported sortdict into other std tests that needed it. test_unicode.py Excluced cp875 from the "roundtrip over range(128)" test, because cp875 doesn't have a well-defined inverse for unicode("?", "cp875"). See Python-Dev for excruciating details. Cookie.py Chaged various output functions to sort dicts before building strings from them. test_extcall Fiddled the expected-result file. This remains sensitive to native dict ordering, because, e.g., if there are multiple errors in a keyword-arg dict (and test_extcall sets up many cases like that), the specific error Python complains about first depends on native dict ordering. Index: Cookie.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/Cookie.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** Cookie.py 2001/04/06 19:39:11 1.8 --- Cookie.py 2001/05/13 00:19:31 1.9 *************** *** 71,76 **** >>> C["sugar"] = "wafer" >>> print C - Set-Cookie: sugar=wafer; Set-Cookie: fig=newton; Notice that the printable representation of a Cookie is the --- 71,76 ---- >>> C["sugar"] = "wafer" >>> print C Set-Cookie: fig=newton; + Set-Cookie: sugar=wafer; Notice that the printable representation of a Cookie is the *************** *** 94,99 **** >>> C.load("chips=ahoy; vienna=finger") >>> print C - Set-Cookie: vienna=finger; Set-Cookie: chips=ahoy; The load() method is darn-tootin smart about identifying cookies --- 94,99 ---- >>> C.load("chips=ahoy; vienna=finger") >>> print C Set-Cookie: chips=ahoy; + Set-Cookie: vienna=finger; The load() method is darn-tootin smart about identifying cookies *************** *** 494,498 **** if attrs is None: attrs = self._reserved_keys ! for K,V in self.items(): if V == "": continue if K not in attrs: continue --- 494,500 ---- if attrs is None: attrs = self._reserved_keys ! items = self.items() ! items.sort() ! for K,V in items: if V == "": continue if K not in attrs: continue *************** *** 587,591 **** """Return a string suitable for HTTP.""" result = [] ! for K,V in self.items(): result.append( V.output(attrs, header) ) return string.join(result, sep) --- 589,595 ---- """Return a string suitable for HTTP.""" result = [] ! items = self.items() ! items.sort() ! for K,V in items: result.append( V.output(attrs, header) ) return string.join(result, sep) *************** *** 596,600 **** def __repr__(self): L = [] ! for K,V in self.items(): L.append( '%s=%s' % (K,repr(V.value) ) ) return '<%s: %s>' % (self.__class__.__name__, string.join(L)) --- 600,606 ---- def __repr__(self): L = [] ! items = self.items() ! items.sort() ! for K,V in items: L.append( '%s=%s' % (K,repr(V.value) ) ) return '<%s: %s>' % (self.__class__.__name__, string.join(L)) *************** *** 603,607 **** """Return a string suitable for JavaScript.""" result = [] ! for K,V in self.items(): result.append( V.js_output(attrs) ) return string.join(result, "") --- 609,615 ---- """Return a string suitable for JavaScript.""" result = [] ! items = self.items() ! items.sort() ! for K,V in items: result.append( V.js_output(attrs) ) return string.join(result, "") From tim_one@users.sourceforge.net Sun May 13 01:19:33 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 12 May 2001 17:19:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_cookie,1.6,1.7 test_extcall,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv1323/python/dist/src/Lib/test/output Modified Files: test_cookie test_extcall Log Message: Get rid of the superstitious "~" in dict hashing's "i = (~hash) & mask". The comment following used to say: /* We use ~hash instead of hash, as degenerate hash functions, such as for ints , can have lots of leading zeros. It's not really a performance risk, but better safe than sorry. 12-Dec-00 tim: so ~hash produces lots of leading ones instead -- what's the gain? */ That is, there was never a good reason for doing it. And to the contrary, as explained on Python-Dev last December, it tended to make the *sum* (i + incr) & mask (which is the first table index examined in case of collison) the same "too often" across distinct hashes. Changing to the simpler "i = hash & mask" reduced the number of string-dict collisions (== # number of times we go around the lookup for-loop) from about 6 million to 5 million during a full run of the test suite (these are approximate because the test suite does some random stuff from run to run). The number of collisions in non-string dicts also decreased, but not as dramatically. Note that this may, for a given dict, change the order (wrt previous releases) of entries exposed by .keys(), .values() and .items(). A number of std tests suffered bogus failures as a result. For dicts keyed by small ints, or (less so) by characters, the order is much more likely to be in increasing order of key now; e.g., >>> d = {} >>> for i in range(10): ... d[i] = i ... >>> d {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9} >>> Unfortunately. people may latch on to that in small examples and draw a bogus conclusion. test_support.py Moved test_extcall's sortdict() into test_support, made it stronger, and imported sortdict into other std tests that needed it. test_unicode.py Excluced cp875 from the "roundtrip over range(128)" test, because cp875 doesn't have a well-defined inverse for unicode("?", "cp875"). See Python-Dev for excruciating details. Cookie.py Chaged various output functions to sort dicts before building strings from them. test_extcall Fiddled the expected-result file. This remains sensitive to native dict ordering, because, e.g., if there are multiple errors in a keyword-arg dict (and test_extcall sets up many cases like that), the specific error Python complains about first depends on native dict ordering. Index: test_cookie =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_cookie,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** test_cookie 2001/04/06 21:20:58 1.6 --- test_cookie 2001/05/13 00:19:31 1.7 *************** *** 1,10 **** test_cookie ! ! Set-Cookie: vienna=finger; Set-Cookie: chips=ahoy; - vienna 'finger' 'finger' Set-Cookie: vienna=finger; chips 'ahoy' 'ahoy' Set-Cookie: chips=ahoy; Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=\012;"; --- 1,10 ---- test_cookie ! Set-Cookie: chips=ahoy; Set-Cookie: vienna=finger; chips 'ahoy' 'ahoy' Set-Cookie: chips=ahoy; + vienna 'finger' 'finger' + Set-Cookie: vienna=finger; Set-Cookie: keebler="E=mc2; L=\"Loves\"; fudge=\012;"; Index: test_extcall =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_extcall,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** test_extcall 2001/04/11 13:53:35 1.8 --- test_extcall 2001/05/13 00:19:31 1.9 *************** *** 41,45 **** za () {'d': 'dd'} -> za() got an unexpected keyword argument 'd' za () {'a': 'aa', 'd': 'dd'} -> za() got an unexpected keyword argument 'd' ! za () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() got an unexpected keyword argument 'd' za (1, 2) {} -> za() takes exactly 1 argument (2 given) za (1, 2) {'a': 'aa'} -> za() takes exactly 1 non-keyword argument (2 given) --- 41,45 ---- za () {'d': 'dd'} -> za() got an unexpected keyword argument 'd' za () {'a': 'aa', 'd': 'dd'} -> za() got an unexpected keyword argument 'd' ! za () {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> za() got an unexpected keyword argument 'b' za (1, 2) {} -> za() takes exactly 1 argument (2 given) za (1, 2) {'a': 'aa'} -> za() takes exactly 1 non-keyword argument (2 given) *************** *** 60,65 **** zade (1, 2) {'a': 'aa'} -> zade() got multiple values for keyword argument 'a' zade (1, 2) {'d': 'dd'} -> zade() got multiple values for keyword argument 'd' ! zade (1, 2) {'a': 'aa', 'd': 'dd'} -> zade() got multiple values for keyword argument 'd' ! zade (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zade() got multiple values for keyword argument 'd' zade (1, 2, 3, 4, 5) {} -> zade() takes at most 3 arguments (5 given) zade (1, 2, 3, 4, 5) {'a': 'aa'} -> zade() takes at most 3 non-keyword arguments (5 given) --- 60,65 ---- zade (1, 2) {'a': 'aa'} -> zade() got multiple values for keyword argument 'a' zade (1, 2) {'d': 'dd'} -> zade() got multiple values for keyword argument 'd' ! zade (1, 2) {'a': 'aa', 'd': 'dd'} -> zade() got multiple values for keyword argument 'a' ! zade (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zade() got multiple values for keyword argument 'a' zade (1, 2, 3, 4, 5) {} -> zade() takes at most 3 arguments (5 given) zade (1, 2, 3, 4, 5) {'a': 'aa'} -> zade() takes at most 3 non-keyword arguments (5 given) *************** *** 76,80 **** zabk (1, 2) {'d': 'dd'} -> ok zabk 1 2 D E V {'d': 'dd'} zabk (1, 2) {'a': 'aa', 'd': 'dd'} -> zabk() got multiple values for keyword argument 'a' ! zabk (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabk() got multiple values for keyword argument 'b' zabk (1, 2, 3, 4, 5) {} -> zabk() takes exactly 2 arguments (5 given) zabk (1, 2, 3, 4, 5) {'a': 'aa'} -> zabk() takes exactly 2 non-keyword arguments (5 given) --- 76,80 ---- zabk (1, 2) {'d': 'dd'} -> ok zabk 1 2 D E V {'d': 'dd'} zabk (1, 2) {'a': 'aa', 'd': 'dd'} -> zabk() got multiple values for keyword argument 'a' ! zabk (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabk() got multiple values for keyword argument 'a' zabk (1, 2, 3, 4, 5) {} -> zabk() takes exactly 2 arguments (5 given) zabk (1, 2, 3, 4, 5) {'a': 'aa'} -> zabk() takes exactly 2 non-keyword arguments (5 given) *************** *** 91,100 **** zabdv (1, 2) {'d': 'dd'} -> ok zabdv 1 2 dd E () d zabdv (1, 2) {'a': 'aa', 'd': 'dd'} -> zabdv() got multiple values for keyword argument 'a' ! zabdv (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdv() got an unexpected keyword argument 'e' zabdv (1, 2, 3, 4, 5) {} -> ok zabdv 1 2 3 E (4, 5) e zabdv (1, 2, 3, 4, 5) {'a': 'aa'} -> zabdv() got multiple values for keyword argument 'a' zabdv (1, 2, 3, 4, 5) {'d': 'dd'} -> zabdv() got multiple values for keyword argument 'd' ! zabdv (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabdv() got multiple values for keyword argument 'd' ! zabdv (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdv() got multiple values for keyword argument 'd' zabdevk () {} -> zabdevk() takes at least 2 arguments (0 given) zabdevk () {'a': 'aa'} -> zabdevk() takes at least 2 non-keyword arguments (1 given) --- 91,100 ---- zabdv (1, 2) {'d': 'dd'} -> ok zabdv 1 2 dd E () d zabdv (1, 2) {'a': 'aa', 'd': 'dd'} -> zabdv() got multiple values for keyword argument 'a' ! zabdv (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdv() got multiple values for keyword argument 'a' zabdv (1, 2, 3, 4, 5) {} -> ok zabdv 1 2 3 E (4, 5) e zabdv (1, 2, 3, 4, 5) {'a': 'aa'} -> zabdv() got multiple values for keyword argument 'a' zabdv (1, 2, 3, 4, 5) {'d': 'dd'} -> zabdv() got multiple values for keyword argument 'd' ! zabdv (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabdv() got multiple values for keyword argument 'a' ! zabdv (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdv() got multiple values for keyword argument 'a' zabdevk () {} -> zabdevk() takes at least 2 arguments (0 given) zabdevk () {'a': 'aa'} -> zabdevk() takes at least 2 non-keyword arguments (1 given) *************** *** 106,113 **** zabdevk (1, 2) {'d': 'dd'} -> ok zabdevk 1 2 dd e () {} zabdevk (1, 2) {'a': 'aa', 'd': 'dd'} -> zabdevk() got multiple values for keyword argument 'a' ! zabdevk (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdevk() got multiple values for keyword argument 'b' zabdevk (1, 2, 3, 4, 5) {} -> ok zabdevk 1 2 3 4 (5,) {} zabdevk (1, 2, 3, 4, 5) {'a': 'aa'} -> zabdevk() got multiple values for keyword argument 'a' zabdevk (1, 2, 3, 4, 5) {'d': 'dd'} -> zabdevk() got multiple values for keyword argument 'd' ! zabdevk (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabdevk() got multiple values for keyword argument 'd' ! zabdevk (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdevk() got multiple values for keyword argument 'd' --- 106,113 ---- zabdevk (1, 2) {'d': 'dd'} -> ok zabdevk 1 2 dd e () {} zabdevk (1, 2) {'a': 'aa', 'd': 'dd'} -> zabdevk() got multiple values for keyword argument 'a' ! zabdevk (1, 2) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdevk() got multiple values for keyword argument 'a' zabdevk (1, 2, 3, 4, 5) {} -> ok zabdevk 1 2 3 4 (5,) {} zabdevk (1, 2, 3, 4, 5) {'a': 'aa'} -> zabdevk() got multiple values for keyword argument 'a' zabdevk (1, 2, 3, 4, 5) {'d': 'dd'} -> zabdevk() got multiple values for keyword argument 'd' ! zabdevk (1, 2, 3, 4, 5) {'a': 'aa', 'd': 'dd'} -> zabdevk() got multiple values for keyword argument 'a' ! zabdevk (1, 2, 3, 4, 5) {'a': 'aa', 'b': 'bb', 'd': 'dd', 'e': 'ee'} -> zabdevk() got multiple values for keyword argument 'a' From tim_one@users.sourceforge.net Sun May 13 01:19:34 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 12 May 2001 17:19:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.86,2.87 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1323/python/dist/src/Objects Modified Files: dictobject.c Log Message: Get rid of the superstitious "~" in dict hashing's "i = (~hash) & mask". The comment following used to say: /* We use ~hash instead of hash, as degenerate hash functions, such as for ints , can have lots of leading zeros. It's not really a performance risk, but better safe than sorry. 12-Dec-00 tim: so ~hash produces lots of leading ones instead -- what's the gain? */ That is, there was never a good reason for doing it. And to the contrary, as explained on Python-Dev last December, it tended to make the *sum* (i + incr) & mask (which is the first table index examined in case of collison) the same "too often" across distinct hashes. Changing to the simpler "i = hash & mask" reduced the number of string-dict collisions (== # number of times we go around the lookup for-loop) from about 6 million to 5 million during a full run of the test suite (these are approximate because the test suite does some random stuff from run to run). The number of collisions in non-string dicts also decreased, but not as dramatically. Note that this may, for a given dict, change the order (wrt previous releases) of entries exposed by .keys(), .values() and .items(). A number of std tests suffered bogus failures as a result. For dicts keyed by small ints, or (less so) by characters, the order is much more likely to be in increasing order of key now; e.g., >>> d = {} >>> for i in range(10): ... d[i] = i ... >>> d {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9} >>> Unfortunately. people may latch on to that in small examples and draw a bogus conclusion. test_support.py Moved test_extcall's sortdict() into test_support, made it stronger, and imported sortdict into other std tests that needed it. test_unicode.py Excluced cp875 from the "roundtrip over range(128)" test, because cp875 doesn't have a well-defined inverse for unicode("?", "cp875"). See Python-Dev for excruciating details. Cookie.py Chaged various output functions to sort dicts before building strings from them. test_extcall Fiddled the expected-result file. This remains sensitive to native dict ordering, because, e.g., if there are multiple errors in a keyword-arg dict (and test_extcall sets up many cases like that), the specific error Python complains about first depends on native dict ordering. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.86 retrieving revision 2.87 diff -C2 -r2.86 -r2.87 *** dictobject.c 2001/05/10 21:45:19 2.86 --- dictobject.c 2001/05/13 00:19:31 2.87 *************** *** 189,198 **** and 0 < incr < ma_size and both are a function of hash. i is the initial table index and incr the initial probe offset. */ ! i = (~hash) & mask; ! /* We use ~hash instead of hash, as degenerate hash functions, such ! as for ints , can have lots of leading zeros. It's not ! really a performance risk, but better safe than sorry. ! 12-Dec-00 tim: so ~hash produces lots of leading ones instead -- ! what's the gain? */ ep = &ep0[i]; if (ep->me_key == NULL || ep->me_key == key) --- 189,193 ---- and 0 < incr < ma_size and both are a function of hash. i is the initial table index and incr the initial probe offset. */ ! i = hash & mask; ep = &ep0[i]; if (ep->me_key == NULL || ep->me_key == key) *************** *** 302,309 **** /* We must come up with (i, incr) such that 0 <= i < ma_size and 0 < incr < ma_size and both are a function of hash */ ! i = (~hash) & mask; ! /* We use ~hash instead of hash, as degenerate hash functions, such ! as for ints , can have lots of leading zeros. It's not ! really a performance risk, but better safe than sorry. */ ep = &ep0[i]; if (ep->me_key == NULL || ep->me_key == key) --- 297,301 ---- /* We must come up with (i, incr) such that 0 <= i < ma_size and 0 < incr < ma_size and both are a function of hash */ ! i = hash & mask; ep = &ep0[i]; if (ep->me_key == NULL || ep->me_key == key) From tim_one@users.sourceforge.net Sun May 13 01:19:34 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 12 May 2001 17:19:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.165,1.166 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv1323/python/dist/src/Misc Modified Files: NEWS Log Message: Get rid of the superstitious "~" in dict hashing's "i = (~hash) & mask". The comment following used to say: /* We use ~hash instead of hash, as degenerate hash functions, such as for ints , can have lots of leading zeros. It's not really a performance risk, but better safe than sorry. 12-Dec-00 tim: so ~hash produces lots of leading ones instead -- what's the gain? */ That is, there was never a good reason for doing it. And to the contrary, as explained on Python-Dev last December, it tended to make the *sum* (i + incr) & mask (which is the first table index examined in case of collison) the same "too often" across distinct hashes. Changing to the simpler "i = hash & mask" reduced the number of string-dict collisions (== # number of times we go around the lookup for-loop) from about 6 million to 5 million during a full run of the test suite (these are approximate because the test suite does some random stuff from run to run). The number of collisions in non-string dicts also decreased, but not as dramatically. Note that this may, for a given dict, change the order (wrt previous releases) of entries exposed by .keys(), .values() and .items(). A number of std tests suffered bogus failures as a result. For dicts keyed by small ints, or (less so) by characters, the order is much more likely to be in increasing order of key now; e.g., >>> d = {} >>> for i in range(10): ... d[i] = i ... >>> d {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9} >>> Unfortunately. people may latch on to that in small examples and draw a bogus conclusion. test_support.py Moved test_extcall's sortdict() into test_support, made it stronger, and imported sortdict into other std tests that needed it. test_unicode.py Excluced cp875 from the "roundtrip over range(128)" test, because cp875 doesn't have a well-defined inverse for unicode("?", "cp875"). See Python-Dev for excruciating details. Cookie.py Chaged various output functions to sort dicts before building strings from them. test_extcall Fiddled the expected-result file. This remains sensitive to native dict ordering, because, e.g., if there are multiple errors in a keyword-arg dict (and test_extcall sets up many cases like that), the specific error Python complains about first depends on native dict ordering. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.165 retrieving revision 1.166 diff -C2 -r1.165 -r1.166 *** NEWS 2001/05/11 21:51:48 1.165 --- NEWS 2001/05/13 00:19:31 1.166 *************** *** 24,27 **** --- 24,37 ---- algorithms to break. + - The implementation of dicts suffers fewer collisions, which has speed + benefits. However, the order in which dict entries appear in dict.keys(), + dict.values() and dict.items() may differ from previous releases for a + given dict. Nothing is defined about this order, so no program should + rely on it. Nevertheless, it's easy to write test cases that rely on the + order by accident, typically because of printing the str() or repr() of a + dict to an "expected results" file. See Lib/test/test_support.py's new + sortdict(dict) function for a simple way to display a dict in sorted + order. + - Dictionary objects now support the "in" operator: "x in dict" means the same as dict.has_key(x). From tim_one@users.sourceforge.net Sun May 13 01:19:33 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 12 May 2001 17:19:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_cookie.py,1.9,1.10 test_extcall.py,1.15,1.16 test_pyexpat.py,1.8,1.9 test_regex.py,1.9,1.10 test_support.py,1.21,1.22 test_unicode.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1323/python/dist/src/Lib/test Modified Files: test_cookie.py test_extcall.py test_pyexpat.py test_regex.py test_support.py test_unicode.py Log Message: Get rid of the superstitious "~" in dict hashing's "i = (~hash) & mask". The comment following used to say: /* We use ~hash instead of hash, as degenerate hash functions, such as for ints , can have lots of leading zeros. It's not really a performance risk, but better safe than sorry. 12-Dec-00 tim: so ~hash produces lots of leading ones instead -- what's the gain? */ That is, there was never a good reason for doing it. And to the contrary, as explained on Python-Dev last December, it tended to make the *sum* (i + incr) & mask (which is the first table index examined in case of collison) the same "too often" across distinct hashes. Changing to the simpler "i = hash & mask" reduced the number of string-dict collisions (== # number of times we go around the lookup for-loop) from about 6 million to 5 million during a full run of the test suite (these are approximate because the test suite does some random stuff from run to run). The number of collisions in non-string dicts also decreased, but not as dramatically. Note that this may, for a given dict, change the order (wrt previous releases) of entries exposed by .keys(), .values() and .items(). A number of std tests suffered bogus failures as a result. For dicts keyed by small ints, or (less so) by characters, the order is much more likely to be in increasing order of key now; e.g., >>> d = {} >>> for i in range(10): ... d[i] = i ... >>> d {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9} >>> Unfortunately. people may latch on to that in small examples and draw a bogus conclusion. test_support.py Moved test_extcall's sortdict() into test_support, made it stronger, and imported sortdict into other std tests that needed it. test_unicode.py Excluced cp875 from the "roundtrip over range(128)" test, because cp875 doesn't have a well-defined inverse for unicode("?", "cp875"). See Python-Dev for excruciating details. Cookie.py Chaged various output functions to sort dicts before building strings from them. test_extcall Fiddled the expected-result file. This remains sensitive to native dict ordering, because, e.g., if there are multiple errors in a keyword-arg dict (and test_extcall sets up many cases like that), the specific error Python complains about first depends on native dict ordering. Index: test_cookie.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cookie.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** test_cookie.py 2001/04/06 21:20:58 1.9 --- test_cookie.py 2001/05/13 00:19:31 1.10 *************** *** 21,25 **** print repr(C) print str(C) ! for k, v in dict.items(): print ' ', k, repr( C[k].value ), repr(v) verify(C[k].value == v) --- 21,27 ---- print repr(C) print str(C) ! items = dict.items() ! items.sort() ! for k, v in items: print ' ', k, repr( C[k].value ), repr(v) verify(C[k].value == v) Index: test_extcall.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_extcall.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** test_extcall.py 2001/05/05 03:56:37 1.15 --- test_extcall.py 2001/05/13 00:19:31 1.16 *************** *** 1,13 **** ! from test_support import verify, verbose, TestFailed from UserList import UserList - def sortdict(d): - keys = d.keys() - keys.sort() - lst = [] - for k in keys: - lst.append("%r: %r" % (k, d[k])) - return "{%s}" % ", ".join(lst) - def f(*a, **k): print a, sortdict(k) --- 1,5 ---- ! from test_support import verify, verbose, TestFailed, sortdict from UserList import UserList def f(*a, **k): print a, sortdict(k) *************** *** 229,234 **** if vararg: arglist.append('*' + vararg) if kwarg: arglist.append('**' + kwarg) ! decl = 'def %s(%s): print "ok %s", a, b, d, e, v, k' % ( ! name, ', '.join(arglist), name) exec(decl) func = eval(name) --- 221,227 ---- if vararg: arglist.append('*' + vararg) if kwarg: arglist.append('**' + kwarg) ! decl = (('def %s(%s): print "ok %s", a, b, d, e, v, ' + ! 'type(k) is type ("") and k or sortdict(k)') ! % (name, ', '.join(arglist), name)) exec(decl) func = eval(name) Index: test_pyexpat.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pyexpat.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** test_pyexpat.py 2001/04/25 16:03:54 1.8 --- test_pyexpat.py 2001/05/13 00:19:31 1.9 *************** *** 6,12 **** from xml.parsers import expat class Outputter: def StartElementHandler(self, name, attrs): ! print 'Start element:\n\t', repr(name), attrs def EndElementHandler(self, name): --- 6,14 ---- from xml.parsers import expat + from test_support import sortdict + class Outputter: def StartElementHandler(self, name, attrs): ! print 'Start element:\n\t', repr(name), sortdict(attrs) def EndElementHandler(self, name): Index: test_regex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_regex.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** test_regex.py 2001/01/17 21:51:36 1.9 --- test_regex.py 2001/05/13 00:19:31 1.10 *************** *** 1,3 **** ! from test_support import verbose import warnings warnings.filterwarnings("ignore", "the regex module is deprecated", --- 1,3 ---- ! from test_support import verbose, sortdict import warnings warnings.filterwarnings("ignore", "the regex module is deprecated", *************** *** 41,45 **** print cre.group('one', 'two') print 'realpat:', cre.realpat ! print 'groupindex:', cre.groupindex re = 'world' --- 41,45 ---- print cre.group('one', 'two') print 'realpat:', cre.realpat ! print 'groupindex:', sortdict(cre.groupindex) re = 'world' Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** test_support.py 2001/03/23 18:04:02 1.21 --- test_support.py 2001/05/13 00:19:31 1.22 *************** *** 91,94 **** --- 91,102 ---- raise TestFailed(reason) + def sortdict(dict): + "Like repr(dict), but in sorted order." + items = dict.items() + items.sort() + reprpairs = ["%r: %r" % pair for pair in items] + withcommas = ", ".join(reprpairs) + return "{%s}" % withcommas + def check_syntax(statement): try: Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** test_unicode.py 2001/05/02 14:21:52 1.32 --- test_unicode.py 2001/05/13 00:19:31 1.33 *************** *** 6,10 **** """#" ! from test_support import verify, verbose import sys --- 6,10 ---- """#" ! from test_support import verify, verbose, TestFailed import sys *************** *** 494,501 **** 'mac_greek', 'mac_iceland','mac_roman', 'mac_turkish', ! 'cp1006', 'cp875', 'iso8859_8', ### These have undefined mappings: #'cp424', ): --- 494,504 ---- 'mac_greek', 'mac_iceland','mac_roman', 'mac_turkish', ! 'cp1006', 'iso8859_8', ### These have undefined mappings: #'cp424', + + ### These fail the round-trip: + #'cp875' ): From tim_one@users.sourceforge.net Sun May 13 07:43:55 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 12 May 2001 23:43:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.87,2.88 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv14009/python/dist/src/Objects Modified Files: dictobject.c Log Message: Aggressive reordering of dict comparisons. In case of collision, it stands to reason that me_key is much more likely to match the key we're looking for than to match dummy, and if the key is absent me_key is much more likely to be NULL than dummy: most dicts don't even have a dummy entry. Running instrumented dict code over the test suite and some apps confirmed that matching dummy was 200-300x less frequent than matching key in practice. So this reorders the tests to try the common case first. It can lose if a large dict with many collisions is mostly deleted, not resized, and then frequently searched, but that's hardly a case we should be favoring. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.87 retrieving revision 2.88 diff -C2 -r2.87 -r2.88 *** dictobject.c 2001/05/13 00:19:31 2.87 --- dictobject.c 2001/05/13 06:43:53 2.88 *************** *** 220,223 **** --- 220,225 ---- if (!incr) incr = mask; + /* In the loop, me_key == dummy is by far (factor of 100s) the + least likely outcome, so test for that last. */ for (;;) { ep = &ep0[(i+incr)&mask]; *************** *** 225,243 **** if (restore_error) PyErr_Restore(err_type, err_value, err_tb); ! if (freeslot != NULL) ! return freeslot; ! else ! return ep; ! } ! if (ep->me_key == dummy) { ! if (freeslot == NULL) ! freeslot = ep; } ! else if (ep->me_key == key) { if (restore_error) PyErr_Restore(err_type, err_value, err_tb); return ep; } ! else if (ep->me_hash == hash) { if (!checked_error) { checked_error = 1; --- 227,238 ---- if (restore_error) PyErr_Restore(err_type, err_value, err_tb); ! return freeslot == NULL ? ep : freeslot; } ! if (ep->me_key == key) { if (restore_error) PyErr_Restore(err_type, err_value, err_tb); return ep; } ! else if (ep->me_hash == hash && ep->me_key != dummy) { if (!checked_error) { checked_error = 1; *************** *** 258,266 **** PyErr_Clear(); } /* Cycle through GF(2^n)-{0} */ ! incr = incr << 1; if (incr > mask) ! incr ^= mp->ma_poly; /* This will implicitly clear ! the highest bit */ } } --- 253,262 ---- PyErr_Clear(); } + else if (ep->me_key == dummy && freeslot == NULL) + freeslot = ep; /* Cycle through GF(2^n)-{0} */ ! incr <<= 1; if (incr > mask) ! incr ^= mp->ma_poly; /* clears the highest bit */ } } *************** *** 315,340 **** if (!incr) incr = mask; for (;;) { ep = &ep0[(i+incr)&mask]; ! if (ep->me_key == NULL) { ! if (freeslot != NULL) ! return freeslot; ! else ! return ep; ! } ! if (ep->me_key == dummy) { ! if (freeslot == NULL) ! freeslot = ep; ! } ! else if (ep->me_key == key ! || (ep->me_hash == hash ! && compare(ep->me_key, key) == 0)) { return ep; ! } /* Cycle through GF(2^n)-{0} */ ! incr = incr << 1; if (incr > mask) ! incr ^= mp->ma_poly; /* This will implicitly clear ! the highest bit */ } } --- 311,331 ---- if (!incr) incr = mask; + /* In the loop, me_key == dummy is by far (factor of 100s) the + least likely outcome, so test for that last. */ for (;;) { ep = &ep0[(i+incr)&mask]; ! if (ep->me_key == NULL) ! return freeslot == NULL ? ep : freeslot; ! if (ep->me_key == key ! || (ep->me_hash == hash ! && ep->me_key != dummy ! && compare(ep->me_key, key) == 0)) return ep; ! else if (ep->me_key == dummy && freeslot == NULL) ! freeslot = ep; /* Cycle through GF(2^n)-{0} */ ! incr <<= 1; if (incr > mask) ! incr ^= mp->ma_poly; /* clears the highest bit */ } } From mhammond@users.sourceforge.net Sun May 13 09:04:28 2001 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Sun, 13 May 2001 01:04:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib ntpath.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23512/Lib Modified Files: ntpath.py Log Message: Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465. Index: ntpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** ntpath.py 2001/02/06 01:07:01 1.34 --- ntpath.py 2001/05/13 08:04:26 1.35 *************** *** 405,423 **** def abspath(path): """Return the absolute version of a path""" - try: - import win32api - except ImportError: - global abspath - def _abspath(path): - if not isabs(path): - path = join(os.getcwd(), path) - return normpath(path) - abspath = _abspath - return _abspath(path) if path: # Empty path must return current working directory. try: ! path = win32api.GetFullPathName(path) ! except win32api.error: ! pass # Bad path - return unchanged. else: path = os.getcwd() --- 405,414 ---- def abspath(path): """Return the absolute version of a path""" if path: # Empty path must return current working directory. + from nt import _getfullpathname try: ! path = _getfullpathname(path) ! except WindowsError: ! pass # Bad path - return unchanged. else: path = os.getcwd() From mhammond@users.sourceforge.net Sun May 13 09:04:28 2001 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Sun, 13 May 2001 01:04:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.187,2.188 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv23512/Modules Modified Files: posixmodule.c Log Message: Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.187 retrieving revision 2.188 diff -C2 -r2.187 -r2.188 *** posixmodule.c 2001/04/14 17:55:09 2.187 --- posixmodule.c 2001/05/13 08:04:26 2.188 *************** *** 234,237 **** --- 234,247 ---- #endif /* _MSC_VER */ + /* The default encoding used by the platform file system APIs + If non-NULL, this is almost certainly different than the default + encoding for strings (otherwise it can remain NULL!) + */ + #ifdef MS_WIN32 + const char *Py_FileSystemDefaultEncoding = "mbcs"; + #else + const char *Py_FileSystemDefaultEncoding = NULL; /* use default */ + #endif + #if defined(PYCC_VACPP) && defined(PYOS_OS2) #include *************** *** 355,358 **** --- 365,376 ---- } + static PyObject * + posix_error_with_allocated_filename(char* name) + { + PyObject *rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); + PyMem_Free(name); + return rc; + } + #ifdef MS_WIN32 static PyObject * *************** *** 469,475 **** posix_1str(PyObject *args, char *format, int (*func)(const char*)) { ! char *path1; int res; ! if (!PyArg_ParseTuple(args, format, &path1)) return NULL; Py_BEGIN_ALLOW_THREADS --- 487,494 ---- posix_1str(PyObject *args, char *format, int (*func)(const char*)) { ! char *path1 = NULL; int res; ! if (!PyArg_ParseTuple(args, format, ! Py_FileSystemDefaultEncoding, &path1)) return NULL; Py_BEGIN_ALLOW_THREADS *************** *** 477,481 **** Py_END_ALLOW_THREADS if (res < 0) ! return posix_error_with_filename(path1); Py_INCREF(Py_None); return Py_None; --- 496,501 ---- Py_END_ALLOW_THREADS if (res < 0) ! return posix_error_with_allocated_filename(path1); ! PyMem_Free(path1); Py_INCREF(Py_None); return Py_None; *************** *** 486,496 **** int (*func)(const char *, const char *)) { ! char *path1, *path2; int res; ! if (!PyArg_ParseTuple(args, format, &path1, &path2)) return NULL; Py_BEGIN_ALLOW_THREADS res = (*func)(path1, path2); Py_END_ALLOW_THREADS if (res != 0) /* XXX how to report both path1 and path2??? */ --- 506,520 ---- int (*func)(const char *, const char *)) { ! char *path1 = NULL, *path2 = NULL; int res; ! if (!PyArg_ParseTuple(args, format, ! Py_FileSystemDefaultEncoding, &path1, ! Py_FileSystemDefaultEncoding, &path2)) return NULL; Py_BEGIN_ALLOW_THREADS res = (*func)(path1, path2); Py_END_ALLOW_THREADS + PyMem_Free(path1); + PyMem_Free(path2); if (res != 0) /* XXX how to report both path1 and path2??? */ *************** *** 552,556 **** { STRUCT_STAT st; ! char *path; int res; --- 576,580 ---- { STRUCT_STAT st; ! char *path = NULL; int res; *************** *** 560,564 **** #endif /* MS_WIN32 */ ! if (!PyArg_ParseTuple(args, format, &path)) return NULL; --- 584,589 ---- #endif /* MS_WIN32 */ ! if (!PyArg_ParseTuple(args, format, ! Py_FileSystemDefaultEncoding, &path)) return NULL; *************** *** 567,570 **** --- 592,596 ---- /* the library call can blow up if the file name is too long! */ if (pathlen > MAX_PATH) { + PyMem_Free(path); errno = ENAMETOOLONG; return posix_error(); *************** *** 589,594 **** Py_END_ALLOW_THREADS if (res != 0) ! return posix_error_with_filename(path); return _pystat_fromstructstat(st); } --- 615,621 ---- Py_END_ALLOW_THREADS if (res != 0) ! return posix_error_with_allocated_filename(path); + PyMem_Free(path); return _pystat_fromstructstat(st); } *************** *** 682,686 **** posix_chdir(PyObject *self, PyObject *args) { ! return posix_1str(args, "s:chdir", chdir); } --- 709,713 ---- posix_chdir(PyObject *self, PyObject *args) { ! return posix_1str(args, "et:chdir", chdir); } *************** *** 693,700 **** posix_chmod(PyObject *self, PyObject *args) { ! char *path; int i; int res; ! if (!PyArg_ParseTuple(args, "si", &path, &i)) return NULL; Py_BEGIN_ALLOW_THREADS --- 720,728 ---- posix_chmod(PyObject *self, PyObject *args) { ! char *path = NULL; int i; int res; ! if (!PyArg_ParseTuple(args, "eti", Py_FileSystemDefaultEncoding, ! &path, &i)) return NULL; Py_BEGIN_ALLOW_THREADS *************** *** 702,706 **** Py_END_ALLOW_THREADS if (res < 0) ! return posix_error_with_filename(path); Py_INCREF(Py_None); return Py_None; --- 730,735 ---- Py_END_ALLOW_THREADS if (res < 0) ! return posix_error_with_allocated_filename(path); ! PyMem_Free(path); Py_INCREF(Py_None); return Py_None; *************** *** 747,754 **** posix_chown(PyObject *self, PyObject *args) { ! char *path; int uid, gid; int res; ! if (!PyArg_ParseTuple(args, "sii:chown", &path, &uid, &gid)) return NULL; Py_BEGIN_ALLOW_THREADS --- 776,785 ---- posix_chown(PyObject *self, PyObject *args) { ! char *path = NULL; int uid, gid; int res; ! if (!PyArg_ParseTuple(args, "etii:chown", ! Py_FileSystemDefaultEncoding, &path, ! &uid, &gid)) return NULL; Py_BEGIN_ALLOW_THREADS *************** *** 756,760 **** Py_END_ALLOW_THREADS if (res < 0) ! return posix_error_with_filename(path); Py_INCREF(Py_None); return Py_None; --- 787,792 ---- Py_END_ALLOW_THREADS if (res < 0) ! return posix_error_with_allocated_filename(path); ! PyMem_Free(path); Py_INCREF(Py_None); return Py_None; *************** *** 793,797 **** posix_link(PyObject *self, PyObject *args) { ! return posix_2str(args, "ss:link", link); } #endif /* HAVE_LINK */ --- 825,829 ---- posix_link(PyObject *self, PyObject *args) { ! return posix_2str(args, "etet:link", link); } #endif /* HAVE_LINK */ *************** *** 814,832 **** #if defined(MS_WIN32) && !defined(HAVE_OPENDIR) - char *name; - int len; PyObject *d, *v; HANDLE hFindFile; WIN32_FIND_DATA FileData; ! char namebuf[MAX_PATH+5]; char ch; ! if (!PyArg_ParseTuple(args, "t#:listdir", &name, &len)) ! return NULL; ! if (len >= MAX_PATH) { ! PyErr_SetString(PyExc_ValueError, "path too long"); return NULL; - } - strcpy(namebuf, name); ch = namebuf[len-1]; if (ch != '/' && ch != '\\' && ch != ':') --- 846,861 ---- #if defined(MS_WIN32) && !defined(HAVE_OPENDIR) PyObject *d, *v; HANDLE hFindFile; WIN32_FIND_DATA FileData; ! /* MAX_PATH characters could mean a bigger encoded string */ ! char namebuf[MAX_PATH*2+5]; ! char *bufptr = namebuf; ! int len = sizeof(namebuf)/sizeof(namebuf[0]); char ch; ! if (!PyArg_ParseTuple(args, "et#:listdir", ! Py_FileSystemDefaultEncoding, &bufptr, &len)) return NULL; ch = namebuf[len-1]; if (ch != '/' && ch != '\\' && ch != ':') *************** *** 842,846 **** if (errno == ERROR_FILE_NOT_FOUND) return PyList_New(0); ! return win32_error("FindFirstFile", name); } do { --- 871,875 ---- if (errno == ERROR_FILE_NOT_FOUND) return PyList_New(0); ! return win32_error("FindFirstFile", namebuf); } do { *************** *** 866,870 **** if (FindClose(hFindFile) == FALSE) ! return win32_error("FindClose", name); return d; --- 895,899 ---- if (FindClose(hFindFile) == FALSE) ! return win32_error("FindClose", namebuf); return d; *************** *** 1043,1046 **** --- 1072,1097 ---- } /* end of posix_listdir */ + #ifdef MS_WIN32 + /* A helper function for abspath on win32 */ + static PyObject * + posix__getfullpathname(PyObject *self, PyObject *args) + { + /* assume encoded strings wont more than double no of chars */ + char inbuf[MAX_PATH*2]; + char *inbufp = inbuf; + int insize = sizeof(inbuf)/sizeof(inbuf[0]); + char outbuf[MAX_PATH*2]; + char *temp; + if (!PyArg_ParseTuple (args, "et#:_getfullpathname", + Py_FileSystemDefaultEncoding, &inbufp, + &insize)) + return NULL; + if (!GetFullPathName(inbuf, sizeof(outbuf)/sizeof(outbuf[0]), + outbuf, &temp)) + return win32_error("GetFullPathName", inbuf); + return PyString_FromString(outbuf); + } /* end of posix__getfullpathname */ + #endif /* MS_WIN32 */ + static char posix_mkdir__doc__[] = "mkdir(path [, mode=0777]) -> None\n\ *************** *** 1051,1057 **** { int res; ! char *path; int mode = 0777; ! if (!PyArg_ParseTuple(args, "s|i:mkdir", &path, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS --- 1102,1109 ---- { int res; ! char *path = NULL; int mode = 0777; ! if (!PyArg_ParseTuple(args, "et|i:mkdir", ! Py_FileSystemDefaultEncoding, &path, &mode)) return NULL; Py_BEGIN_ALLOW_THREADS *************** *** 1063,1067 **** Py_END_ALLOW_THREADS if (res < 0) ! return posix_error_with_filename(path); Py_INCREF(Py_None); return Py_None; --- 1115,1120 ---- Py_END_ALLOW_THREADS if (res < 0) ! return posix_error_with_allocated_filename(path); ! PyMem_Free(path); Py_INCREF(Py_None); return Py_None; *************** *** 1096,1100 **** posix_rename(PyObject *self, PyObject *args) { ! return posix_2str(args, "ss:rename", rename); } --- 1149,1153 ---- posix_rename(PyObject *self, PyObject *args) { ! return posix_2str(args, "etet:rename", rename); } *************** *** 1107,1111 **** posix_rmdir(PyObject *self, PyObject *args) { ! return posix_1str(args, "s:rmdir", rmdir); } --- 1160,1164 ---- posix_rmdir(PyObject *self, PyObject *args) { ! return posix_1str(args, "et:rmdir", rmdir); } *************** *** 1118,1122 **** posix_stat(PyObject *self, PyObject *args) { ! return posix_do_stat(self, args, "s:stat", STAT); } --- 1171,1175 ---- posix_stat(PyObject *self, PyObject *args) { ! return posix_do_stat(self, args, "et:stat", STAT); } *************** *** 1170,1174 **** posix_unlink(PyObject *self, PyObject *args) { ! return posix_1str(args, "s:remove", unlink); } --- 1223,1227 ---- posix_unlink(PyObject *self, PyObject *args) { ! return posix_1str(args, "et:remove", unlink); } *************** *** 3114,3120 **** { #ifdef HAVE_LSTAT ! return posix_do_stat(self, args, "s:lstat", lstat); #else /* !HAVE_LSTAT */ ! return posix_do_stat(self, args, "s:lstat", STAT); #endif /* !HAVE_LSTAT */ } --- 3167,3173 ---- { #ifdef HAVE_LSTAT ! return posix_do_stat(self, args, "et:lstat", lstat); #else /* !HAVE_LSTAT */ ! return posix_do_stat(self, args, "et:lstat", STAT); #endif /* !HAVE_LSTAT */ } *************** *** 3152,3156 **** posix_symlink(PyObject *self, PyObject *args) { ! return posix_2str(args, "ss:symlink", symlink); } #endif /* HAVE_SYMLINK */ --- 3205,3209 ---- posix_symlink(PyObject *self, PyObject *args) { ! return posix_2str(args, "etet:symlink", symlink); } #endif /* HAVE_SYMLINK */ *************** *** 3329,3337 **** posix_open(PyObject *self, PyObject *args) { ! char *file; int flag; int mode = 0777; int fd; ! if (!PyArg_ParseTuple(args, "si|i", &file, &flag, &mode)) return NULL; --- 3382,3392 ---- posix_open(PyObject *self, PyObject *args) { ! char *file = NULL; int flag; int mode = 0777; int fd; ! if (!PyArg_ParseTuple(args, "eti|i", ! Py_FileSystemDefaultEncoding, &file, ! &flag, &mode)) return NULL; *************** *** 3340,3344 **** Py_END_ALLOW_THREADS if (fd < 0) ! return posix_error_with_filename(file); return PyInt_FromLong((long)fd); } --- 3395,3400 ---- Py_END_ALLOW_THREADS if (fd < 0) ! return posix_error_with_allocated_filename(file); ! PyMem_Free(file); return PyInt_FromLong((long)fd); } *************** *** 5459,5462 **** --- 5515,5521 ---- #endif {"abort", posix_abort, METH_VARARGS, posix_abort__doc__}, + #ifdef MS_WIN32 + {"_getfullpathname", posix__getfullpathname, METH_VARARGS, NULL}, + #endif {NULL, NULL} /* Sentinel */ }; From mhammond@users.sourceforge.net Sun May 13 09:04:28 2001 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Sun, 13 May 2001 01:04:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_unicode_file,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv23512/Lib/test/output Added Files: test_unicode_file Log Message: Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465. --- NEW FILE: test_unicode_file --- test_unicode_file All the Unicode tests appeared to work From mhammond@users.sourceforge.net Sun May 13 09:04:28 2001 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Sun, 13 May 2001 01:04:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.205,2.206 getargs.c,2.55,2.56 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv23512/Python Modified Files: bltinmodule.c getargs.c Log Message: Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.205 retrieving revision 2.206 diff -C2 -r2.205 -r2.206 *** bltinmodule.c 2001/05/06 01:05:02 2.205 --- bltinmodule.c 2001/05/13 08:04:26 2.206 *************** *** 14,17 **** --- 14,19 ---- #endif + extern const char *Py_FileSystemDefaultEncoding; + /* Forward */ static PyObject *filterstring(PyObject *, PyObject *); *************** *** 1531,1542 **** builtin_open(PyObject *self, PyObject *args) { ! char *name; char *mode = "r"; int bufsize = -1; PyObject *f; ! if (!PyArg_ParseTuple(args, "s|si:open", &name, &mode, &bufsize)) return NULL; f = PyFile_FromString(name, mode); if (f != NULL) PyFile_SetBufSize(f, bufsize); --- 1533,1546 ---- builtin_open(PyObject *self, PyObject *args) { ! char *name = NULL; char *mode = "r"; int bufsize = -1; PyObject *f; ! if (!PyArg_ParseTuple(args, "et|si:open", Py_FileSystemDefaultEncoding, ! &name, &mode, &bufsize)) return NULL; f = PyFile_FromString(name, mode); + PyMem_Free(name); /* free the encoded string */ if (f != NULL) PyFile_SetBufSize(f, bufsize); Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.55 retrieving revision 2.56 diff -C2 -r2.55 -r2.56 *** getargs.c 2001/05/02 17:16:16 2.55 --- getargs.c 2001/05/13 08:04:26 2.56 *************** *** 699,703 **** 't' (only recode non-string objects) */ ! if (*format != 's') recode_strings = 1; else if (*format == 't') --- 699,703 ---- 't' (only recode non-string objects) */ ! if (*format == 's') recode_strings = 1; else if (*format == 't') From mhammond@users.sourceforge.net Sun May 13 09:04:28 2001 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Sun, 13 May 2001 01:04:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_unicode_file.py,NONE,1.1 test_support.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv23512/Lib/test Modified Files: test_support.py Added Files: test_unicode_file.py Log Message: Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465. --- NEW FILE: test_unicode_file.py --- # Test some Unicode file name semantics # We dont test many operations on files other than # that their names can be used with Unicode characters. import os from test_support import verify, TestSkipped, TESTFN_UNICODE try: from test_support import TESTFN_ENCODING except ImportError: raise TestSkipped("No Unicode filesystem semantics on this platform.") TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) # Check with creation as Unicode string. f = open(TESTFN_UNICODE, 'wb') if not os.path.isfile(TESTFN_UNICODE): print "File doesn't exist after creating it" if not os.path.isfile(TESTFN_ENCODED): print "File doesn't exist (encoded string) after creating it" f.close() # Test stat and chmod if os.stat(TESTFN_ENCODED) != os.stat(TESTFN_UNICODE): print "os.stat() did not agree on the 2 filenames" os.chmod(TESTFN_ENCODED, 0777) os.chmod(TESTFN_UNICODE, 0777) # Test rename os.rename(TESTFN_ENCODED, TESTFN_ENCODED + ".new") os.rename(TESTFN_UNICODE+".new", TESTFN_ENCODED) os.unlink(TESTFN_ENCODED) if os.path.isfile(TESTFN_ENCODED) or \ os.path.isfile(TESTFN_UNICODE): print "File exists after deleting it" # Check with creation as encoded string. f = open(TESTFN_ENCODED, 'wb') if not os.path.isfile(TESTFN_UNICODE) or \ not os.path.isfile(TESTFN_ENCODED): print "File doesn't exist after creating it" path, base = os.path.split(os.path.abspath(TESTFN_ENCODED)) if base not in os.listdir(path): print "Filename did not appear in os.listdir()" f.close() os.unlink(TESTFN_UNICODE) if os.path.isfile(TESTFN_ENCODED) or \ os.path.isfile(TESTFN_UNICODE): print "File exists after deleting it" # test os.open f = os.open(TESTFN_ENCODED, os.O_CREAT) if not os.path.isfile(TESTFN_UNICODE) or \ not os.path.isfile(TESTFN_ENCODED): print "File doesn't exist after creating it" os.close(f) os.unlink(TESTFN_UNICODE) # Test directories etc cwd = os.getcwd() abs_encoded = os.path.abspath(TESTFN_ENCODED) + ".dir" abs_unicode = os.path.abspath(TESTFN_UNICODE) + ".dir" os.mkdir(abs_encoded) try: os.chdir(abs_encoded) os.chdir(abs_unicode) finally: os.chdir(cwd) os.rmdir(abs_unicode) os.mkdir(abs_unicode) try: os.chdir(abs_encoded) os.chdir(abs_unicode) finally: os.chdir(cwd) os.rmdir(abs_encoded) print "All the Unicode tests appeared to work" Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** test_support.py 2001/05/13 00:19:31 1.22 --- test_support.py 2001/05/13 08:04:26 1.23 *************** *** 64,67 **** --- 64,71 ---- elif os.name != 'riscos': TESTFN = '@test' + # Unicode name only used if TEST_FN_ENCODING exists for the platform. + TESTFN_UNICODE=u"@test-\xe0\xf2" # 2 latin characters. + if os.name=="nt": + TESTFN_ENCODING="mbcs" else: TESTFN = 'test' From tim_one@users.sourceforge.net Sun May 13 10:01:09 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 13 May 2001 02:01:09 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pty.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv29154/python/dist/src/Lib Modified Files: pty.py Log Message: A disgusting "fix" for the test___all__ failure under Windows. Index: pty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pty.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** pty.py 2001/05/11 19:15:28 1.9 --- pty.py 2001/05/13 09:01:06 1.10 *************** *** 9,12 **** --- 9,23 ---- from select import select import os + + # Absurd: import termios and then delete it. This is to force an attempt + # to import pty to raise an ImportError on platforms that lack termios. + # Without this explicit import of termios here, some other module may + # import tty first, which in turn imports termios and dies with an + # ImportError then. But since tty *does* exist across platforms, that + # leaves a damaged module object for tty in sys.modules, and the import + # of tty here then appears to work despite that the tty imported is junk. + import termios + del termios + import tty From mhammond@users.sourceforge.net Mon May 14 04:09:39 2001 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Sun, 13 May 2001 20:09:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.166,1.167 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv30621 Modified Files: NEWS Log Message: Add mention of the default file system encoding for Windows. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.166 retrieving revision 1.167 diff -C2 -r1.166 -r1.167 *** NEWS 2001/05/13 00:19:31 1.166 --- NEWS 2001/05/14 03:09:36 1.167 *************** *** 3,6 **** --- 3,23 ---- Core + - Some operating systems now support the concept of a default Unicode + encoding for file system operations. Notably, Windows supports 'mbcs' + as the default. The Macintosh will also adopt this concept in the medium + term, altough the default encoding for that platform will be other than + 'mbcs'. + On operating system that support non-ascii filenames, it is common for + functions that return filenames (such as os.listdir()) to return Python + string objects pre-encoded using the default file system encoding for + the platform. As this encoding is likely to be different from Python's + default encoding, converting this name to a Unicode object before passing + it back to the Operating System would result in a Unicode error, as Python + would attempt to use it's default encoding (generally ASCII) rather + than the default encoding for the file system. + In general, this change simply removes surprises when working with + Unicode and the file system, making these operations work as + you expect, increasing the transparency of Unicode objects in this context. + See [????] for more details, including examples. - Float (and complex) literals in source code were evaluated to full From barry@digicool.com Mon May 14 05:29:30 2001 From: barry@digicool.com (Barry A. Warsaw) Date: Mon, 14 May 2001 00:29:30 -0400 Subject: [Python-checkins] CVS: python/dist/src/Mac/Build PythonCore.exp,1.6,1.7 References: Message-ID: <15103.24362.87115.281870@anthem.wooz.org> >>>>> "TP" == Tim Peters writes: TP> Welcome to the exclusive working-checkin club -- far fewer TP> than 100 sentient beings in the entire history of the universe TP> have made a successful checkin to this repository . And a few quasi-sentient ones too! :) From tim_one@users.sourceforge.net Mon May 14 08:06:00 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 00:06:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_pprint,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv28221/python/dist/src/Lib/test/output Added Files: test_pprint Log Message: SF bug[ #423781: pprint.isrecursive() broken. --- NEW FILE: test_pprint --- test_pprint From tim_one@users.sourceforge.net Mon May 14 08:06:00 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 00:06:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pprint.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28221/python/dist/src/Lib Modified Files: pprint.py Log Message: SF bug[ #423781: pprint.isrecursive() broken. Index: pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pprint.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** pprint.py 2001/02/12 02:00:42 1.12 --- pprint.py 2001/05/14 07:05:58 1.13 *************** *** 50,74 **** printer.pprint(object) - def pformat(object): """Format a Python object into a pretty-printed representation.""" return PrettyPrinter().pformat(object) def isreadable(object): """Determine if saferepr(object) is readable by eval().""" ! return PrettyPrinter().isreadable(object) ! def isrecursive(object): """Determine if object requires a recursive representation.""" ! return PrettyPrinter().isrecursive(object) ! - def saferepr(object): - """Version of repr() which can handle recursive data structures.""" - return _safe_repr(object, {})[0] - - class PrettyPrinter: def __init__(self, indent=1, width=80, depth=None, stream=None): --- 50,69 ---- printer.pprint(object) def pformat(object): """Format a Python object into a pretty-printed representation.""" return PrettyPrinter().pformat(object) + def saferepr(object): + """Version of repr() which can handle recursive data structures.""" + return _safe_repr(object, {})[0] def isreadable(object): """Determine if saferepr(object) is readable by eval().""" ! return _safe_repr(object, {})[1] def isrecursive(object): """Determine if object requires a recursive representation.""" ! return _safe_repr(object, {})[2] class PrettyPrinter: def __init__(self, indent=1, width=80, depth=None, stream=None): *************** *** 93,97 **** width = int(width) assert indent >= 0 ! assert (not depth) or depth > 0, "depth may not be negative" assert width self.__depth = depth --- 88,92 ---- width = int(width) assert indent >= 0 ! assert depth is None or depth > 0, "depth must be > 0" assert width self.__depth = depth *************** *** 183,191 **** def __repr(self, object, context, level): ! repr, readable = _safe_repr(object, context, self.__depth, level) if not readable: self.__readable = 0 return repr def _safe_repr(object, context, maxlevels=None, level=0): --- 178,190 ---- def __repr(self, object, context, level): ! repr, readable, recursive = _safe_repr(object, context, ! self.__depth, level) if not readable: self.__readable = 0 + if recursive: + self.__recursive = 1 return repr + # Return triple (repr_string, isreadable, isrecursive). def _safe_repr(object, context, maxlevels=None, level=0): *************** *** 194,203 **** if not (typ in (DictType, ListType, TupleType) and object): rep = `object` ! return rep, (rep and (rep[0] != '<')) if context.has_key(id(object)): ! return `_Recursion(object)`, 0 objid = id(object) context[objid] = 1 readable = 1 if typ is DictType: if maxlevels and level >= maxlevels: --- 193,203 ---- if not (typ in (DictType, ListType, TupleType) and object): rep = `object` ! return rep, (rep and (rep[0] != '<')), 0 if context.has_key(id(object)): ! return `_Recursion(object)`, 0, 1 objid = id(object) context[objid] = 1 readable = 1 + recursive = 0 if typ is DictType: if maxlevels and level >= maxlevels: *************** *** 207,218 **** items = object.items() k, v = items[0] ! krepr, kreadable = _safe_repr(k, context, maxlevels, level) ! vrepr, vreadable = _safe_repr(v, context, maxlevels, level) readable = readable and kreadable and vreadable s = "{%s: %s" % (krepr, vrepr) for k, v in items[1:]: ! krepr, kreadable = _safe_repr(k, context, maxlevels, level) ! vrepr, vreadable = _safe_repr(v, context, maxlevels, level) readable = readable and kreadable and vreadable s = "%s, %s: %s" % (s, krepr, vrepr) s = s + "}" --- 207,224 ---- items = object.items() k, v = items[0] ! krepr, kreadable, krecur = _safe_repr(k, context, maxlevels, ! level) ! vrepr, vreadable, vrecur = _safe_repr(v, context, maxlevels, ! level) readable = readable and kreadable and vreadable + recursive = recursive or krecur or vrecur s = "{%s: %s" % (krepr, vrepr) for k, v in items[1:]: ! krepr, kreadable, krecur = _safe_repr(k, context, maxlevels, ! level) ! vrepr, vreadable, vrecur = _safe_repr(v, context, maxlevels, ! level) readable = readable and kreadable and vreadable + recursive = recursive or krecur or vrecur s = "%s, %s: %s" % (s, krepr, vrepr) s = s + "}" *************** *** 223,229 **** readable = 0 else: ! subrepr, subreadable = _safe_repr( object[0], context, maxlevels, level) readable = readable and subreadable s = s + subrepr tail = object[1:] --- 229,236 ---- readable = 0 else: ! subrepr, subreadable, subrecur = _safe_repr( object[0], context, maxlevels, level) readable = readable and subreadable + recursive = recursive or subrecur s = s + subrepr tail = object[1:] *************** *** 232,242 **** s = s + ',' for ent in tail: ! subrepr, subreadable = _safe_repr( ent, context, maxlevels, level) readable = readable and subreadable s = "%s, %s" % (s, subrepr) s = s + term del context[objid] ! return s, readable --- 239,250 ---- s = s + ',' for ent in tail: ! subrepr, subreadable, subrecur = _safe_repr( ent, context, maxlevels, level) readable = readable and subreadable + recursive = recursive or subrecur s = "%s, %s" % (s, subrepr) s = s + term del context[objid] ! return s, readable and not recursive, recursive From tim_one@users.sourceforge.net Mon May 14 08:06:00 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 00:06:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.167,1.168 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv28221/python/dist/src/Misc Modified Files: NEWS Log Message: SF bug[ #423781: pprint.isrecursive() broken. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.167 retrieving revision 1.168 diff -C2 -r1.167 -r1.168 *** NEWS 2001/05/14 03:09:36 1.167 --- NEWS 2001/05/14 07:05:58 1.168 *************** *** 3,12 **** Core - Some operating systems now support the concept of a default Unicode encoding for file system operations. Notably, Windows supports 'mbcs' as the default. The Macintosh will also adopt this concept in the medium ! term, altough the default encoding for that platform will be other than 'mbcs'. ! On operating system that support non-ascii filenames, it is common for functions that return filenames (such as os.listdir()) to return Python string objects pre-encoded using the default file system encoding for --- 3,13 ---- Core + - Some operating systems now support the concept of a default Unicode encoding for file system operations. Notably, Windows supports 'mbcs' as the default. The Macintosh will also adopt this concept in the medium ! term, altough the default encoding for that platform will be other than 'mbcs'. ! On operating system that support non-ascii filenames, it is common for functions that return filenames (such as os.listdir()) to return Python string objects pre-encoded using the default file system encoding for *************** *** 14,22 **** default encoding, converting this name to a Unicode object before passing it back to the Operating System would result in a Unicode error, as Python ! would attempt to use it's default encoding (generally ASCII) rather ! than the default encoding for the file system. ! In general, this change simply removes surprises when working with ! Unicode and the file system, making these operations work as ! you expect, increasing the transparency of Unicode objects in this context. See [????] for more details, including examples. --- 15,23 ---- default encoding, converting this name to a Unicode object before passing it back to the Operating System would result in a Unicode error, as Python ! would attempt to use its default encoding (generally ASCII) rather than ! the default encoding for the file system. ! In general, this change simply removes surprises when working with ! Unicode and the file system, making these operations work as you expect, ! increasing the transparency of Unicode objects in this context. See [????] for more details, including examples. *************** *** 82,85 **** --- 83,103 ---- to crash if the element comparison routines for the dict keys and/or values mutated the dicts. Making the code bulletproof slowed it down. + + Library + + - Cookie.py now sorts key+value pairs by key in output strings. + + - pprint.isrecursive(object) didn't correctly identify recursive objects. + Now it does. + + Tests + + - New test_mutants.py runs dict comparisons where the key and value + comparison operators mutute the dicts randomly during comparison. This + rapidly causes Python to crash under earlier releases (not for the faint + of heart: it can also cause Win9x to freeze or reboot!). + + - New test_pprint.py verfies that pprint.isrecursive() and + pprint.isreadable() return sensible results. From tim_one@users.sourceforge.net Mon May 14 08:06:00 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 00:06:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_pprint.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28221/python/dist/src/Lib/test Added Files: test_pprint.py Log Message: SF bug[ #423781: pprint.isrecursive() broken. --- NEW FILE: test_pprint.py --- from test_support import verify import pprint # Verify that .isrecursive() and .isreadable() work. a = range(100) b = range(200) a[-12] = b for safe in 2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, u"yaddayadda", a, b: verify(pprint.isrecursive(safe) == 0, "expected isrecursive == 0") verify(pprint.isreadable(safe) == 1, "expected isreadable == 1") # Tie a knot. b[67] = a # Messy dict. d = {} d[0] = d[1] = d[2] = d for icky in a, b, d, (d, d): verify(pprint.isrecursive(icky) == 1, "expected isrecursive == 1") verify(pprint.isreadable(icky) == 0, "expected isreadable == 0") # Break the cycles. d.clear() del a[:] del b[:] for safe in a, b, d, (d, d): verify(pprint.isrecursive(safe) == 0, "expected isrecursive == 0") verify(pprint.isreadable(safe) == 1, "expected isreadable == 1") # Not recursive but not readable anyway. for unreadable in type(3), pprint, pprint.isrecursive: verify(pprint.isrecursive(unreadable) == 0, "expected isrecursive == 0") verify(pprint.isreadable(unreadable) ==0, "expected isreadable == 0") From gstein@users.sourceforge.net Mon May 14 10:32:28 2001 From: gstein@users.sourceforge.net (Greg Stein) Date: Mon, 14 May 2001 02:32:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules mmapmodule.c,2.29,2.30 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv21364 Modified Files: mmapmodule.c Log Message: Fix the .find() method for memory maps. 1) it didn't obey the "start" parameter (and when it does, we must validate the value) 2) the return value needs to be an absolute index, rather than relative to some arbitrary point in the file (checking CVS, it appears this method never worked; these changes bring it into line with typical .find() behavior) Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -r2.29 -r2.30 *** mmapmodule.c 2001/05/09 18:48:26 2.29 --- mmapmodule.c 2001/05/14 09:32:26 2.30 *************** *** 233,238 **** return NULL; } else { ! char *p = self->data+self->pos; ! char *e = self->data+self->size; while (p < e) { char *s = p; --- 233,247 ---- return NULL; } else { ! char *p; ! char *e = self->data + self->size; ! ! if (start < 0) ! start += self->size; ! if (start < 0) ! start = 0; ! else if (start > self->size) ! start = self->size; ! p = self->data + start; ! while (p < e) { char *s = p; *************** *** 244,248 **** return Py_BuildValue ( "i", ! (int) (p - (self->data + start))); } p++; --- 253,257 ---- return Py_BuildValue ( "i", ! (int) (p - self->data)); } p++; From mhammond@users.sourceforge.net Mon May 14 13:17:36 2001 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Mon, 14 May 2001 05:17:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include fileobject.h,2.22,2.23 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv19427/Include Modified Files: fileobject.h Log Message: Fix the Py_FileSystemDefaultEncoding checkin - declare the variable in a fileobject.h, and initialize it in bltinmodule. Index: fileobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/fileobject.h,v retrieving revision 2.22 retrieving revision 2.23 diff -C2 -r2.22 -r2.23 *** fileobject.h 2000/09/01 23:29:26 2.22 --- fileobject.h 2001/05/14 12:17:34 2.23 *************** *** 24,27 **** --- 24,32 ---- extern DL_IMPORT(int) PyObject_AsFileDescriptor(PyObject *); + /* The default encoding used by the platform file system APIs + If non-NULL, this is different than the default encoding for strings + */ + extern DL_IMPORT(const char *) Py_FileSystemDefaultEncoding; + #ifdef __cplusplus } From mhammond@users.sourceforge.net Mon May 14 13:17:36 2001 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Mon, 14 May 2001 05:17:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.206,2.207 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv19427/Python Modified Files: bltinmodule.c Log Message: Fix the Py_FileSystemDefaultEncoding checkin - declare the variable in a fileobject.h, and initialize it in bltinmodule. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.206 retrieving revision 2.207 diff -C2 -r2.206 -r2.207 *** bltinmodule.c 2001/05/13 08:04:26 2.206 --- bltinmodule.c 2001/05/14 12:17:34 2.207 *************** *** 14,18 **** #endif ! extern const char *Py_FileSystemDefaultEncoding; /* Forward */ --- 14,25 ---- #endif ! /* The default encoding used by the platform file system APIs ! Can remain NULL for all platforms that don't have such a concept ! */ ! #ifdef MS_WIN32 ! const char *Py_FileSystemDefaultEncoding = "mbcs"; ! #else ! const char *Py_FileSystemDefaultEncoding = NULL; /* use default */ ! #endif /* Forward */ From mhammond@users.sourceforge.net Mon May 14 13:17:36 2001 From: mhammond@users.sourceforge.net (Mark Hammond) Date: Mon, 14 May 2001 05:17:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.188,2.189 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv19427/Modules Modified Files: posixmodule.c Log Message: Fix the Py_FileSystemDefaultEncoding checkin - declare the variable in a fileobject.h, and initialize it in bltinmodule. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.188 retrieving revision 2.189 diff -C2 -r2.188 -r2.189 *** posixmodule.c 2001/05/13 08:04:26 2.188 --- posixmodule.c 2001/05/14 12:17:34 2.189 *************** *** 234,247 **** #endif /* _MSC_VER */ - /* The default encoding used by the platform file system APIs - If non-NULL, this is almost certainly different than the default - encoding for strings (otherwise it can remain NULL!) - */ - #ifdef MS_WIN32 - const char *Py_FileSystemDefaultEncoding = "mbcs"; - #else - const char *Py_FileSystemDefaultEncoding = NULL; /* use default */ - #endif - #if defined(PYCC_VACPP) && defined(PYOS_OS2) #include --- 234,237 ---- From gvanrossum@users.sourceforge.net Mon May 14 14:43:26 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 14 May 2001 06:43:26 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0253.txt,NONE,1.1 pep-0000.txt,1.89,1.90 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv4930 Modified Files: pep-0000.txt Added Files: pep-0253.txt Log Message: Checking in a stub of PEP 253. --- NEW FILE: pep-0253.txt --- PEP: 253 Title: Subtyping Built-in Types Version: $Revision: 1.1 $ Author: guido@python.org (Guido van Rossum) Status: Draft Type: Standards Track Python-Version: 2.2 Created: 14-May-2001 Post-History: Abstract This PEP proposes ways for creating subtypes of existing built-in types, either in C or in Python. Introduction [XXX to be done.] Copyright This document has been placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil End: Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -r1.89 -r1.90 *** pep-0000.txt 2001/04/23 18:34:56 1.89 --- pep-0000.txt 2001/05/14 13:43:23 1.90 *************** *** 53,56 **** --- 53,57 ---- I 251 pep-0251.txt Python 2.2 Release Schedule Warsaw S 252 pep-0252.txt Making Types Look More Like Classes van Rossum + S 253 pep-0253.txt Subtyping Built-in Types van Rossum Py-in-the-sky PEPs (not ready; may become active yet) *************** *** 173,176 **** --- 174,178 ---- I 251 pep-0251.txt Python 2.2 Release Schedule Warsaw S 252 pep-0252.txt Making Types Look More Like Classes van Rossum + S 253 pep-0253.txt Subtyping Built-in Types van Rossum From gvanrossum@users.sourceforge.net Mon May 14 14:53:41 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 14 May 2001 06:53:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.168,1.169 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv7091 Modified Files: NEWS Log Message: Fix a typo, consistently spell ASCII in all caps, and insert blank lines between paragraphs in Mark Hammond's news item about the default encoding in posixmodule. Resist the temptation to reflow paragraphs. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.168 retrieving revision 1.169 diff -C2 -r1.168 -r1.169 *** NEWS 2001/05/14 07:05:58 1.168 --- NEWS 2001/05/14 13:53:38 1.169 *************** *** 7,13 **** encoding for file system operations. Notably, Windows supports 'mbcs' as the default. The Macintosh will also adopt this concept in the medium ! term, altough the default encoding for that platform will be other than 'mbcs'. ! On operating system that support non-ascii filenames, it is common for functions that return filenames (such as os.listdir()) to return Python string objects pre-encoded using the default file system encoding for --- 7,14 ---- encoding for file system operations. Notably, Windows supports 'mbcs' as the default. The Macintosh will also adopt this concept in the medium ! term, although the default encoding for that platform will be other than 'mbcs'. ! ! On operating system that support non-ASCII filenames, it is common for functions that return filenames (such as os.listdir()) to return Python string objects pre-encoded using the default file system encoding for *************** *** 17,20 **** --- 18,22 ---- would attempt to use its default encoding (generally ASCII) rather than the default encoding for the file system. + In general, this change simply removes surprises when working with Unicode and the file system, making these operations work as you expect, From jackjansen@users.sourceforge.net Mon May 14 15:59:21 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 07:59:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_applet_config.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21517/python/Mac/mwerks Modified Files: mwerks_applet_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_applet_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_applet_config.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** mwerks_applet_config.h 2000/08/25 22:02:44 1.5 --- mwerks_applet_config.h 2001/05/14 14:59:19 1.6 *************** *** 24,27 **** --- 24,28 ---- #define USE_ZLIB /* Include the zlib module */ #define USE_APPEARANCE /* Enable Appearance support */ + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ From jackjansen@users.sourceforge.net Mon May 14 15:59:27 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 07:59:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_carbon_config.h,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21562/python/Mac/mwerks Modified Files: mwerks_carbon_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_carbon_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_carbon_config.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** mwerks_carbon_config.h 2001/01/25 16:27:28 1.6 --- mwerks_carbon_config.h 2001/05/14 14:59:25 1.7 *************** *** 39,42 **** --- 39,43 ---- #endif #endif + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #ifdef USE_MSL From jackjansen@users.sourceforge.net Mon May 14 15:59:33 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 07:59:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_carbongusi_config.h,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21621/python/Mac/mwerks Modified Files: mwerks_carbongusi_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_carbongusi_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_carbongusi_config.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** mwerks_carbongusi_config.h 2001/01/11 23:03:19 1.1 --- mwerks_carbongusi_config.h 2001/05/14 14:59:31 1.2 *************** *** 30,33 **** --- 30,34 ---- /* #define USE_ZLIB /* Include the zlib module */ #define USE_APPEARANCE /* Enable Appearance support */ + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ From jackjansen@users.sourceforge.net Mon May 14 15:59:39 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 07:59:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_carbonNOGUSI_config.h,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21647/python/Mac/mwerks Modified Files: mwerks_carbonNOGUSI_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_carbonNOGUSI_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_carbonNOGUSI_config.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mwerks_carbonNOGUSI_config.h 2001/01/25 16:27:28 1.2 --- mwerks_carbonNOGUSI_config.h 2001/05/14 14:59:37 1.3 *************** *** 31,34 **** --- 31,35 ---- /* #define USE_ZLIB /* Include the zlib module */ #define USE_APPEARANCE /* Enable Appearance support */ + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ From jackjansen@users.sourceforge.net Mon May 14 15:59:45 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 07:59:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_carbonplugin_config.h,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21676/python/Mac/mwerks Modified Files: mwerks_carbonplugin_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_carbonplugin_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_carbonplugin_config.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** mwerks_carbonplugin_config.h 2001/01/23 22:46:21 1.1 --- mwerks_carbonplugin_config.h 2001/05/14 14:59:43 1.2 *************** *** 6,9 **** --- 6,10 ---- #define TARGET_API_MAC_CARBON 1 #define TARGET_API_MAC_CARBON_NOTYET 1 /* Things we should do eventually, but not now */ + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ /* #define USE_GUSI1 /* Stdio implemented with GUSI */ From jackjansen@users.sourceforge.net Mon May 14 15:59:51 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 07:59:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_nonshared_config.h,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21699/python/Mac/mwerks Modified Files: mwerks_nonshared_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_nonshared_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_nonshared_config.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** mwerks_nonshared_config.h 2001/01/25 16:27:28 1.23 --- mwerks_nonshared_config.h 2001/05/14 14:59:49 1.24 *************** *** 35,38 **** --- 35,39 ---- #endif #endif + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #ifdef USE_MSL From jackjansen@users.sourceforge.net Mon May 14 15:59:56 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 07:59:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_nscarbon_config.h,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21727/python/Mac/mwerks Modified Files: mwerks_nscarbon_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_nscarbon_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_nscarbon_config.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** mwerks_nscarbon_config.h 2001/01/29 13:26:59 1.4 --- mwerks_nscarbon_config.h 2001/05/14 14:59:54 1.5 *************** *** 40,43 **** --- 40,44 ---- #endif #endif + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #ifdef USE_MSL From jackjansen@users.sourceforge.net Mon May 14 16:00:08 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 08:00:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_shared_config.h,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21814/python/Mac/mwerks Modified Files: mwerks_shared_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_shared_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_shared_config.h,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** mwerks_shared_config.h 2000/08/25 22:02:44 1.16 --- mwerks_shared_config.h 2001/05/14 15:00:06 1.17 *************** *** 28,31 **** --- 28,32 ---- /* #define USE_ZLIB /* Include the zlib module */ #define USE_APPEARANCE /* Enable Appearance support */ + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ From jackjansen@users.sourceforge.net Mon May 14 16:00:14 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 08:00:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_shcarbon_config.h,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21838/python/Mac/mwerks Modified Files: mwerks_shcarbon_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_shcarbon_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_shcarbon_config.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** mwerks_shcarbon_config.h 2001/01/14 23:02:32 1.1 --- mwerks_shcarbon_config.h 2001/05/14 15:00:12 1.2 *************** *** 33,36 **** --- 33,37 ---- /* #define USE_ZLIB /* Include the zlib module */ #define USE_APPEARANCE /* Enable Appearance support */ + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ From jackjansen@users.sourceforge.net Mon May 14 16:00:20 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 08:00:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_small_config.h,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21869/python/Mac/mwerks Modified Files: mwerks_small_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_small_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_small_config.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** mwerks_small_config.h 2001/01/25 16:27:28 1.12 --- mwerks_small_config.h 2001/05/14 15:00:18 1.13 *************** *** 25,28 **** --- 25,29 ---- /* #define USE_ZLIB /* Include the zlib module */ #define USE_APPEARANCE /* Enable Appearance support */ + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ From jackjansen@users.sourceforge.net Mon May 14 16:00:26 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 08:00:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_thrcarbonsm_config.h,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21888/python/Mac/mwerks Modified Files: mwerks_thrcarbonsm_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_thrcarbonsm_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_thrcarbonsm_config.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mwerks_thrcarbonsm_config.h 2001/01/25 16:27:28 1.2 --- mwerks_thrcarbonsm_config.h 2001/05/14 15:00:24 1.3 *************** *** 32,35 **** --- 32,36 ---- /* #define USE_ZLIB /* Include the zlib module */ #define USE_APPEARANCE /* Enable Appearance support */ + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ From jackjansen@users.sourceforge.net Mon May 14 16:00:32 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 08:00:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_threadsmall_config.h,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21916/python/Mac/mwerks Modified Files: mwerks_threadsmall_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_threadsmall_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_threadsmall_config.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mwerks_threadsmall_config.h 2000/08/25 22:02:44 1.2 --- mwerks_threadsmall_config.h 2001/05/14 15:00:30 1.3 *************** *** 26,29 **** --- 26,30 ---- /* #define USE_ZLIB /* Include the zlib module */ #define USE_APPEARANCE /* Enable Appearance support */ + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ From jackjansen@users.sourceforge.net Mon May 14 16:00:40 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 08:00:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_tkplugin_config.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21941/python/Mac/mwerks Modified Files: mwerks_tkplugin_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_tkplugin_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_tkplugin_config.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** mwerks_tkplugin_config.h 2000/05/06 22:32:35 1.5 --- mwerks_tkplugin_config.h 2001/05/14 15:00:38 1.6 *************** *** 11,12 **** --- 11,13 ---- #define USE_TK /* Include _tkinter module in core Python */ #define MAC_TCL /* This *must* be on if USE_TK is on */ + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ From jackjansen@users.sourceforge.net Mon May 14 16:00:03 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Mon, 14 May 2001 08:00:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_plugin_config.h,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv21756/python/Mac/mwerks Modified Files: mwerks_plugin_config.h Log Message: Added a WITHOUT_FRAMEWORKS define to all the config files, so that on MacOS<=9 compiles use Universal Headers, not Carbon/Carbon.h. Index: mwerks_plugin_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_plugin_config.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** mwerks_plugin_config.h 2000/07/18 09:40:08 1.8 --- mwerks_plugin_config.h 2001/05/14 15:00:00 1.9 *************** *** 9,12 **** --- 9,13 ---- #endif #define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ + #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_MSL /* Use MSL libraries */ #ifdef USE_MSL From fdrake@users.sourceforge.net Mon May 14 17:04:24 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 14 May 2001 09:04:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv1952 Modified Files: ref3.tex Log Message: Make sure we include all of Python's numeric types in the data model description, so that the introduction of complex is not a surprise. This closes SF bug #423429. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -r1.65 -r1.66 *** ref3.tex 2001/04/20 16:50:40 1.65 --- ref3.tex 2001/05/14 16:04:22 1.66 *************** *** 160,164 **** \obindex{numeric} ! Python distinguishes between integers and floating point numbers: \begin{description} --- 160,165 ---- \obindex{numeric} ! Python distinguishes between integers, floating point numbers, and ! complex numbers: \begin{description} From fdrake@users.sourceforge.net Mon May 14 17:04:59 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 14 May 2001 09:04:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.64,1.64.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv2072 Modified Files: Tag: release21-maint ref3.tex Log Message: Make sure we include all of Python's numeric types in the data model description, so that the introduction of complex is not a surprise. This closes SF bug #423429. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.64 retrieving revision 1.64.2.1 diff -C2 -r1.64 -r1.64.2.1 *** ref3.tex 2001/04/13 15:54:41 1.64 --- ref3.tex 2001/05/14 16:04:57 1.64.2.1 *************** *** 160,164 **** \obindex{numeric} ! Python distinguishes between integers and floating point numbers: \begin{description} --- 160,165 ---- \obindex{numeric} ! Python distinguishes between integers, floating point numbers, and ! complex numbers: \begin{description} From fdrake@users.sourceforge.net Mon May 14 18:41:22 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 14 May 2001 10:41:22 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_pprint.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv21897 Modified Files: test_pprint.py Log Message: Convert the pprint test to use PyUnit. Index: test_pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pprint.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_pprint.py 2001/05/14 07:05:58 1.1 --- test_pprint.py 2001/05/14 17:41:20 1.2 *************** *** 1,36 **** - from test_support import verify import pprint ! # Verify that .isrecursive() and .isreadable() work. ! a = range(100) ! b = range(200) ! a[-12] = b ! ! for safe in 2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, u"yaddayadda", a, b: ! verify(pprint.isrecursive(safe) == 0, "expected isrecursive == 0") ! verify(pprint.isreadable(safe) == 1, "expected isreadable == 1") ! ! # Tie a knot. ! b[67] = a ! # Messy dict. ! d = {} ! d[0] = d[1] = d[2] = d ! ! for icky in a, b, d, (d, d): ! verify(pprint.isrecursive(icky) == 1, "expected isrecursive == 1") ! verify(pprint.isreadable(icky) == 0, "expected isreadable == 0") ! ! # Break the cycles. ! d.clear() ! del a[:] ! del b[:] ! ! for safe in a, b, d, (d, d): ! verify(pprint.isrecursive(safe) == 0, "expected isrecursive == 0") ! verify(pprint.isreadable(safe) == 1, "expected isreadable == 1") ! ! # Not recursive but not readable anyway. ! for unreadable in type(3), pprint, pprint.isrecursive: ! verify(pprint.isrecursive(unreadable) == 0, "expected isrecursive == 0") ! verify(pprint.isreadable(unreadable) ==0, "expected isreadable == 0") --- 1,58 ---- import pprint + import unittest ! import test_support ! ! class QueryTestCase(unittest.TestCase): ! ! def setUp(self): ! self.a = range(100) ! self.b = range(200) ! self.a[-12] = self.b ! ! def test_basic(self): ! # Verify that .isrecursive() and .isreadable() work. ! verify = self.assert_ ! for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, u"yaddayadda", ! self.a, self.b): ! verify(not pprint.isrecursive(safe), ! "expected not isrecursive for " + `safe`) ! verify(pprint.isreadable(safe), ! "expected isreadable for " + `safe`) ! ! def test_knotted(self): ! # Tie a knot. ! self.b[67] = self.a ! # Messy dict. ! self.d = {} ! self.d[0] = self.d[1] = self.d[2] = self.d ! ! verify = self.assert_ ! ! for icky in self.a, self.b, self.d, (self.d, self.d): ! verify(pprint.isrecursive(icky), "expected isrecursive") ! verify(not pprint.isreadable(icky), "expected not isreadable") ! ! # Break the cycles. ! self.d.clear() ! del self.a[:] ! del self.b[:] ! ! for safe in self.a, self.b, self.d, (self.d, self.d): ! verify(not pprint.isrecursive(safe), ! "expected not isrecursive for " + `safe`) ! verify(pprint.isreadable(safe), ! "expected isreadable for " + `safe`) ! ! def test_unreadable(self): ! """Not recursive but not readable anyway.""" ! verify = self.assert_ ! for unreadable in type(3), pprint, pprint.isrecursive: ! verify(not pprint.isrecursive(unreadable), ! "expected not isrecursive for " + `unreadable`) ! verify(not pprint.isreadable(unreadable), ! "expected not isreadable for " + `unreadable`) ! ! ! test_support.run_unittest(QueryTestCase) From tim_one@users.sourceforge.net Mon May 14 19:39:43 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 11:39:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.169,1.170 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv1384/python/dist/src/Misc Modified Files: NEWS Log Message: pprint's workhorse _safe_repr() function took time quadratic in the # of elements when crunching a list, dict or tuple. Now takes linear time instead -- huge speedup for even moderately large containers, and the code is notably simpler too. Added some basic "is the output correct?" tests to test_pprint. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.169 retrieving revision 1.170 diff -C2 -r1.169 -r1.170 *** NEWS 2001/05/14 13:53:38 1.169 --- NEWS 2001/05/14 18:39:41 1.170 *************** *** 93,96 **** --- 93,98 ---- Now it does. + - pprint functions now much faster for large containers (tuple, list, dict). + Tests *************** *** 101,105 **** - New test_pprint.py verfies that pprint.isrecursive() and ! pprint.isreadable() return sensible results. --- 103,108 ---- - New test_pprint.py verfies that pprint.isrecursive() and ! pprint.isreadable() return sensible results. Also verifies that simple ! cases produce correct output. From tim_one@users.sourceforge.net Mon May 14 19:39:43 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 11:39:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_pprint.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1384/python/dist/src/Lib/test Modified Files: test_pprint.py Log Message: pprint's workhorse _safe_repr() function took time quadratic in the # of elements when crunching a list, dict or tuple. Now takes linear time instead -- huge speedup for even moderately large containers, and the code is notably simpler too. Added some basic "is the output correct?" tests to test_pprint. Index: test_pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pprint.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_pprint.py 2001/05/14 17:41:20 1.2 --- test_pprint.py 2001/05/14 18:39:41 1.3 *************** *** 13,17 **** def test_basic(self): ! # Verify that .isrecursive() and .isreadable() work. verify = self.assert_ for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, u"yaddayadda", --- 13,17 ---- def test_basic(self): ! # Verify that .isrecursive() and .isreadable() work w/o recursion. verify = self.assert_ for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, u"yaddayadda", *************** *** 23,26 **** --- 23,27 ---- def test_knotted(self): + # Verify that .isrecursive() and .isreadable() work w/ recursion. # Tie a knot. self.b[67] = self.a *************** *** 55,58 **** --- 56,74 ---- "expected not isreadable for " + `unreadable`) + def test_same_as_repr(self): + "Simple objects and small containers that should be same as repr()." + verify = self.assert_ + for simple in (0, 0L, 0+0j, 0.0, "", u"", (), [], {}, verify, pprint, + -6, -6L, -6-6j, -1.5, "x", u"x", (3,), [3], {3: 6}, + (1,2), [3,4], {5: 6, 7: 8}, + {"xy\tab\n": (3,), 5: [[]], (): {}}, + range(10, -11, -1) + ): + native = repr(simple) + for function in "pformat", "saferepr": + f = getattr(pprint, function) + got = f(simple) + verify(native == got, "expected %s got %s from pprint.%s" % + (native, got, function)) test_support.run_unittest(QueryTestCase) From tim_one@users.sourceforge.net Mon May 14 19:39:43 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 11:39:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib pprint.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1384/python/dist/src/Lib Modified Files: pprint.py Log Message: pprint's workhorse _safe_repr() function took time quadratic in the # of elements when crunching a list, dict or tuple. Now takes linear time instead -- huge speedup for even moderately large containers, and the code is notably simpler too. Added some basic "is the output correct?" tests to test_pprint. Index: pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pprint.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** pprint.py 2001/05/14 07:05:58 1.13 --- pprint.py 2001/05/14 18:39:41 1.14 *************** *** 189,251 **** def _safe_repr(object, context, maxlevels=None, level=0): ! level = level + 1 typ = type(object) if not (typ in (DictType, ListType, TupleType) and object): rep = `object` return rep, (rep and (rep[0] != '<')), 0 if context.has_key(id(object)): return `_Recursion(object)`, 0, 1 objid = id(object) context[objid] = 1 readable = 1 recursive = 0 ! if typ is DictType: ! if maxlevels and level >= maxlevels: ! s = "{...}" ! readable = 0 ! else: ! items = object.items() ! k, v = items[0] krepr, kreadable, krecur = _safe_repr(k, context, maxlevels, level) vrepr, vreadable, vrecur = _safe_repr(v, context, maxlevels, level) readable = readable and kreadable and vreadable recursive = recursive or krecur or vrecur ! s = "{%s: %s" % (krepr, vrepr) ! for k, v in items[1:]: ! krepr, kreadable, krecur = _safe_repr(k, context, maxlevels, ! level) ! vrepr, vreadable, vrecur = _safe_repr(v, context, maxlevels, ! level) ! readable = readable and kreadable and vreadable ! recursive = recursive or krecur or vrecur ! s = "%s, %s: %s" % (s, krepr, vrepr) ! s = s + "}" ! else: ! s, term = (typ is ListType) and ('[', ']') or ('(', ')') ! if maxlevels and level >= maxlevels: ! s = s + "..." ! readable = 0 ! else: subrepr, subreadable, subrecur = _safe_repr( ! object[0], context, maxlevels, level) readable = readable and subreadable recursive = recursive or subrecur ! s = s + subrepr ! tail = object[1:] ! if not tail: ! if typ is TupleType: ! s = s + ',' ! for ent in tail: ! subrepr, subreadable, subrecur = _safe_repr( ! ent, context, maxlevels, level) ! readable = readable and subreadable ! recursive = recursive or subrecur ! s = "%s, %s" % (s, subrepr) ! s = s + term del context[objid] return s, readable and not recursive, recursive - class _Recursion: --- 189,240 ---- def _safe_repr(object, context, maxlevels=None, level=0): ! level += 1 typ = type(object) if not (typ in (DictType, ListType, TupleType) and object): rep = `object` return rep, (rep and (rep[0] != '<')), 0 + if context.has_key(id(object)): return `_Recursion(object)`, 0, 1 objid = id(object) context[objid] = 1 + readable = 1 recursive = 0 ! startchar, endchar = {ListType: "[]", ! TupleType: "()", ! DictType: "{}"}[typ] ! if maxlevels and level > maxlevels: ! with_commas = "..." ! readable = 0 ! ! elif typ is DictType: ! components = [] ! for k, v in object.iteritems(): krepr, kreadable, krecur = _safe_repr(k, context, maxlevels, level) vrepr, vreadable, vrecur = _safe_repr(v, context, maxlevels, level) + components.append("%s: %s" % (krepr, vrepr)) readable = readable and kreadable and vreadable recursive = recursive or krecur or vrecur ! with_commas = ", ".join(components) ! ! else: # list or tuple ! assert typ in (ListType, TupleType) ! components = [] ! for element in object: subrepr, subreadable, subrecur = _safe_repr( ! element, context, maxlevels, level) ! components.append(subrepr) readable = readable and subreadable recursive = recursive or subrecur ! if len(components) == 1 and typ is TupleType: ! components[0] += "," ! with_commas = ", ".join(components) ! ! s = "%s%s%s" % (startchar, with_commas, endchar) del context[objid] return s, readable and not recursive, recursive class _Recursion: From fdrake@users.sourceforge.net Mon May 14 20:15:25 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 14 May 2001 12:15:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_pprint.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10896/Lib/test Modified Files: test_pprint.py Log Message: Convert a couple of comments to docstrings -- PyUnit can use these when the regression test is run in verbose mode. Index: test_pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pprint.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_pprint.py 2001/05/14 18:39:41 1.3 --- test_pprint.py 2001/05/14 19:15:23 1.4 *************** *** 13,17 **** def test_basic(self): ! # Verify that .isrecursive() and .isreadable() work w/o recursion. verify = self.assert_ for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, u"yaddayadda", --- 13,17 ---- def test_basic(self): ! """Verify .isrecursive() and .isreadable() w/o recursion.""" verify = self.assert_ for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, u"yaddayadda", *************** *** 23,27 **** def test_knotted(self): ! # Verify that .isrecursive() and .isreadable() work w/ recursion. # Tie a knot. self.b[67] = self.a --- 23,27 ---- def test_knotted(self): ! """Verify .isrecursive() and .isreadable() w/ recursion.""" # Tie a knot. self.b[67] = self.a From fdrake@users.sourceforge.net Mon May 14 22:02:38 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 14 May 2001 14:02:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules fcntlmodule.c,2.30,2.31 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv2695/Modules Modified Files: fcntlmodule.c Log Message: fcntl.ioctl(): Update error message; necessity noted by Michael Hudson. Index: fcntlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fcntlmodule.c,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -r2.30 -r2.31 *** fcntlmodule.c 2001/05/10 15:54:32 2.30 --- fcntlmodule.c 2001/05/14 21:02:36 2.31 *************** *** 125,129 **** PyErr_Clear(); arg = 0; ! if (!PyArg_ParseTuple(args, "O&i|i;ioctl requires 2 integers and optionally a third integer or a string", conv_descriptor, &fd, &code, &arg)) { return NULL; --- 125,131 ---- PyErr_Clear(); arg = 0; ! if (!PyArg_ParseTuple(args, ! "O&i|i;ioctl requires a file or file descriptor," ! " an integer and optionally a third integer or a string", conv_descriptor, &fd, &code, &arg)) { return NULL; From gvanrossum@users.sourceforge.net Mon May 14 22:35:54 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 14 May 2001 14:35:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.80.2.4,2.80.2.5 listobject.c,2.92.6.3,2.92.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8944 Modified Files: Tag: descr-branch dictobject.c listobject.c Log Message: Nits: constructor functions take three arguments (self, args, kw). Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.80.2.4 retrieving revision 2.80.2.5 diff -C2 -r2.80.2.4 -r2.80.2.5 *** dictobject.c 2001/05/04 17:15:02 2.80.2.4 --- dictobject.c 2001/05/14 21:35:52 2.80.2.5 *************** *** 1272,1276 **** static PyObject * ! dict_construct(PyDictObject *self) { if (self == NULL) --- 1272,1276 ---- static PyObject * ! dict_construct(PyDictObject *self, PyObject *args, PyObject *kw) { if (self == NULL) *************** *** 1324,1328 **** 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (unaryfunc)dict_construct, /* tp_construct */ }; --- 1324,1328 ---- 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (ternaryfunc)dict_construct, /* tp_construct */ }; Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.92.6.3 retrieving revision 2.92.6.4 diff -C2 -r2.92.6.3 -r2.92.6.4 *** listobject.c 2001/05/04 17:12:53 2.92.6.3 --- listobject.c 2001/05/14 21:35:52 2.92.6.4 *************** *** 1496,1500 **** static PyObject * ! list_construct(PyListObject *self) { if (self == NULL) --- 1496,1500 ---- static PyObject * ! list_construct(PyListObject *self, PyObject *args, PyObject *kw) { if (self == NULL) *************** *** 1586,1590 **** 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (unaryfunc)list_construct, /* tp_construct */ }; --- 1586,1590 ---- 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (ternaryfunc)list_construct, /* tp_construct */ }; *************** *** 1669,1673 **** 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (unaryfunc)list_construct, /* tp_construct */ /* NOTE: This is *not* the standard list_type struct! */ }; --- 1669,1673 ---- 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (ternaryfunc)list_construct, /* tp_construct */ /* NOTE: This is *not* the standard list_type struct! */ }; From gvanrossum@users.sourceforge.net Mon May 14 22:41:43 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 14 May 2001 14:41:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules spam.c,1.1.2.3,1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv9857 Modified Files: Tag: descr-branch spam.c Log Message: Suppress warnings about type of tp_construct. Index: spam.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Attic/spam.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -r1.1.2.3 -r1.1.2.4 *** spam.c 2001/05/06 02:31:13 1.1.2.3 --- spam.c 2001/05/14 21:41:41 1.1.2.4 *************** *** 95,99 **** 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! spamlist_construct, /* tp_construct */ }; --- 95,99 ---- 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (ternaryfunc)spamlist_construct, /* tp_construct */ }; *************** *** 198,202 **** 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! spamdict_construct, /* tp_construct */ }; --- 198,202 ---- 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (ternaryfunc)spamdict_construct, /* tp_construct */ }; From tim_one@users.sourceforge.net Mon May 14 23:32:36 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 15:32:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.189,2.190 timemodule.c,2.110,2.111 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv18878/python/dist/src/Modules Modified Files: posixmodule.c timemodule.c Log Message: SF patch #418147 Fixes to allow compiling w/ Borland, from Stephen Hansen. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.189 retrieving revision 2.190 diff -C2 -r2.189 -r2.190 *** posixmodule.c 2001/05/14 12:17:34 2.189 --- posixmodule.c 2001/05/14 22:32:33 2.190 *************** *** 64,73 **** #define HAVE_EXECV 1 #define HAVE_GETCWD 1 - #define HAVE_GETEGID 1 - #define HAVE_GETEUID 1 - #define HAVE_GETGID 1 - #define HAVE_GETPPID 1 - #define HAVE_GETUID 1 - #define HAVE_KILL 1 #define HAVE_OPENDIR 1 #define HAVE_PIPE 1 --- 64,67 ---- *************** *** 153,157 **** --- 147,155 ---- extern int rmdir(const char *); #endif + #ifdef __BORLANDC__ + extern int chmod(const char *, int); + #else extern int chmod(const char *, mode_t); + #endif extern int chown(const char *, uid_t, gid_t); extern char *getcwd(char *, int); *************** *** 5667,5681 **** ! #if ( defined(_MSC_VER) || defined(__WATCOMC__) ) && !defined(__QNX__) #define INITFUNC initnt #define MODNAME "nt" ! #else ! #if defined(PYOS_OS2) #define INITFUNC initos2 #define MODNAME "os2" #else #define INITFUNC initposix #define MODNAME "posix" - #endif #endif --- 5665,5679 ---- ! #if (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__)) && !defined(__QNX__) #define INITFUNC initnt #define MODNAME "nt" ! ! #elif defined(PYOS_OS2) #define INITFUNC initos2 #define MODNAME "os2" + #else #define INITFUNC initposix #define MODNAME "posix" #endif Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.110 retrieving revision 2.111 diff -C2 -r2.110 -r2.111 *** timemodule.c 2001/04/10 22:07:07 2.110 --- timemodule.c 2001/05/14 22:32:33 2.111 *************** *** 42,50 **** #ifdef MS_WINDOWS #include ! #ifdef MS_WIN16 /* These overrides not needed for Win32 */ #define timezone _timezone #define tzname _tzname #define daylight _daylight #define altzone _altzone #endif /* MS_WIN16 */ --- 42,52 ---- #ifdef MS_WINDOWS #include ! #if defined(MS_WIN16) || defined(__BORLANDC__) /* These overrides not needed for Win32 */ #define timezone _timezone #define tzname _tzname #define daylight _daylight + #endif /* MS_WIN16 || __BORLANDC__ */ + #ifdef MS_WIN16 #define altzone _altzone #endif /* MS_WIN16 */ *************** *** 52,56 **** #endif /* !__WATCOMC__ || __QNX__ */ ! #if defined(MS_WIN32) && !defined(MS_WIN64) /* Win32 has better clock replacement XXX Win64 does not yet, but might when the platform matures. */ --- 54,58 ---- #endif /* !__WATCOMC__ || __QNX__ */ ! #if defined(MS_WIN32) && !defined(MS_WIN64) && !defined(__BORLANDC__) /* Win32 has better clock replacement XXX Win64 does not yet, but might when the platform matures. */ *************** *** 147,151 **** #endif /* HAVE_CLOCK */ ! #if defined(MS_WIN32) && !defined(MS_WIN64) /* Due to Mark Hammond */ static PyObject * --- 149,153 ---- #endif /* HAVE_CLOCK */ ! #if defined(MS_WIN32) && !defined(MS_WIN64) && !defined(__BORLANDC__) /* Due to Mark Hammond */ static PyObject * From tim_one@users.sourceforge.net Mon May 14 23:32:35 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 15:32:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include pyport.h,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv18878/python/dist/src/Include Modified Files: pyport.h Log Message: SF patch #418147 Fixes to allow compiling w/ Borland, from Stephen Hansen. Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -r2.26 -r2.27 *** pyport.h 2001/01/22 16:50:11 2.26 --- pyport.h 2001/05/14 22:32:33 2.27 *************** *** 435,438 **** --- 435,447 ---- #endif + /* + * Rename some functions for the Borland compiler + */ + #ifdef __BORLANDC__ + # include + # define _chsize chsize + # define _setmode setmode + #endif + #ifdef __cplusplus } From tim_one@users.sourceforge.net Mon May 14 23:32:36 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 15:32:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/PC config.h,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory usw-pr-cvs1:/tmp/cvs-serv18878/python/dist/src/PC Modified Files: config.h Log Message: SF patch #418147 Fixes to allow compiling w/ Borland, from Stephen Hansen. Index: config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/config.h,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -r1.51 -r1.52 *** config.h 2001/04/21 03:20:47 1.51 --- config.h 2001/05/14 22:32:33 1.52 *************** *** 37,40 **** --- 37,41 ---- #include #define HAVE_LIMITS_H + #define HAVE_SYS_UTIME_H #define HAVE_HYPOT #define DONT_HAVE_SIG_ALARM *************** *** 178,181 **** --- 179,186 ---- #undef HAVE_HYPOT + #undef HAVE_SYS_UTIME_H + #define HAVE_UTIME_H + #define HAVE_DIRENT_H + #define HAVE_CLOCK #else /* !_WIN32 */ *************** *** 594,598 **** /* Define if you have the header file. */ ! #define HAVE_SYS_UTIME_H 1 /* Define if you have the header file. */ --- 599,603 ---- /* Define if you have the header file. */ ! /* #define HAVE_SYS_UTIME_H 1 */ /* Define if you have the header file. */ From tim_one@users.sourceforge.net Mon May 14 23:32:35 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 15:32:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.170,1.171 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv18878/python/dist/src/Misc Modified Files: NEWS Log Message: SF patch #418147 Fixes to allow compiling w/ Borland, from Stephen Hansen. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -r1.170 -r1.171 *** NEWS 2001/05/14 18:39:41 1.170 --- NEWS 2001/05/14 22:32:33 1.171 *************** *** 106,109 **** --- 106,113 ---- cases produce correct output. + New platforms + + - Python should compile and run out of the box using the Borland C + compiler (under Windows), thanks to Stephen Hansen. What's New in Python 2.1 (final)? From tim_one@users.sourceforge.net Tue May 15 00:19:14 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 14 May 2001 16:19:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules mmapmodule.c,2.30,2.31 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv27951/python/dist/src/Modules Modified Files: mmapmodule.c Log Message: Fix new compiler warnings. Also boost "start" from (C) int to long and return a (C) long: PyArg_ParseTuple and Py_BuildValue may not let us get at the size_t we really want, but C int is clearly too small for a 64-bit box, and both the start parameter and the return value should work for large mapped files even on 32-bit boxes. The code really needs to be rethought from scratch (not by me, though ...). Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -r2.30 -r2.31 *** mmapmodule.c 2001/05/14 09:32:26 2.30 --- mmapmodule.c 2001/05/14 23:19:12 2.31 *************** *** 225,234 **** PyObject *args) { ! int start = self->pos; char *needle; int len; CHECK_VALID(NULL); ! if (!PyArg_ParseTuple (args, "s#|i:find", &needle, &len, &start)) { return NULL; } else { --- 225,234 ---- PyObject *args) { ! long start = self->pos; char *needle; int len; CHECK_VALID(NULL); ! if (!PyArg_ParseTuple (args, "s#|l:find", &needle, &len, &start)) { return NULL; } else { *************** *** 240,244 **** if (start < 0) start = 0; ! else if (start > self->size) start = self->size; p = self->data + start; --- 240,244 ---- if (start < 0) start = 0; ! else if ((size_t)start > self->size) start = self->size; p = self->data + start; *************** *** 252,257 **** if (!*n) { return Py_BuildValue ( ! "i", ! (int) (p - self->data)); } p++; --- 252,257 ---- if (!*n) { return Py_BuildValue ( ! "l", ! (long) (p - self->data)); } p++; From gvanrossum@users.sourceforge.net Tue May 15 02:36:48 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 14 May 2001 18:36:48 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0253.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv20830 Modified Files: pep-0253.txt Log Message: Add a lot of text. A looooooot of text. Way too much rambling. And it isn't even finished. I'll do that later. But at least there's some text here now... Index: pep-0253.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0253.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** pep-0253.txt 2001/05/14 13:43:23 1.1 --- pep-0253.txt 2001/05/15 01:36:46 1.2 *************** *** 12,20 **** This PEP proposes ways for creating subtypes of existing built-in ! types, either in C or in Python. ! Introduction ! [XXX to be done.] --- 12,375 ---- This PEP proposes ways for creating subtypes of existing built-in ! types, either in C or in Python. The text is currently long and ! rambling; I'll go over it again later to make it shorter. ! Traditionally, types in Python have been created statically, by ! declaring a global variable of type PyTypeObject and initializing ! it with a static initializer. The fields in the type object ! describe all aspects of a Python object that are relevant to the ! Python interpreter. A few fields contain dimensional information ! (e.g. the basic allocation size of instances), others contain ! various flags, but most fields are pointers to functions to ! implement various kinds of behaviors. A NULL pointer means that ! the type does not implement the specific behavior; in that case ! the system may provide a default behavior in that case or raise an ! exception when the behavior is invoked. Some collections of ! functions pointers that are usually defined together are obtained ! indirectly via a pointer to an additional structure containing. ! While the details of initializing a PyTypeObject structure haven't ! been documented as such, they are easily glanced from the examples ! in the source code, and I am assuming that the reader is ! sufficiently familiar with the traditional way of creating new ! Python types in C. ! ! This PEP will introduce the following optional features to types: ! ! - create an instance of a type by calling it ! ! - create a subtype in C by specifying a base type pointer ! ! - create a subtype in Python using a class statement ! ! - multiple inheritance ! ! This PEP builds on PEP 252, which adds standard introspection to ! types; in particular, types are assumed to have e.g. a __hash__ ! method when the type object defines the tp_hash slot. PEP 252 also ! adds a dictionary to type objects which contains all methods. At ! the Python level, this dictionary is read-only; at the C level, it ! is accessible directly (but modifying it is not recommended except ! as part of initialization). ! ! ! Metatypes ! ! Inevitably the following discussion will come to mention metatypes ! (or metaclasses). Metatypes are nothing new in Python: Python has ! always been able to talk about the type of a type: ! ! >>> a = 0 ! >>> type(a) ! ! >>> type(type(a)) ! ! >>> type(type(type(a))) ! ! >>> ! ! In this example, type(a) is a "regular" type, and type(type(a)) is ! a metatype. While as distributed all types have the same metatype ! (which is also its own metatype), this is not a requirement, and ! in fact a useful 3rd party extension (ExtensionClasses by Jim ! Fulton) creates an additional metatype. A related feature is the ! "Don Beaudry hook", which says that if a metatype is callable, its ! instances (which are regular types) can be subclassed (really ! subtyped) using a Python class statement. We will use this rule ! to support subtyping of built-in types, and in the process we will ! introduce some additional metatypes, and a "metametatype". (The ! metametatype is nothing unusual; Python's type system allows any ! number of metalevels.) ! ! Note that Python uses the concept of metatypes or metaclasses in a ! different way than Smalltalk. In Smalltalk-80, there is a ! hierarchy of metaclasses that mirrors the hierarchy of regular ! classes, metaclasses map 1-1 to classes (except for some funny ! business at the root of the hierarchy), and each class statement ! creates both a regular class and its metaclass, putting class ! methods in the metaclass and instance methods in the regular ! class. ! ! Nice though this may be in the context of Smalltalk, it's not ! compatible with the traditional use of metatypes in Python, and I ! prefer to continue in the Python way. This means that Python ! metatypes are typically written in C, and may be shared between ! many regular types. (It will be possible to subtype metatypes in ! Python, so it won't be absolutely necessary to write C in order to ! use metatypes; but the power of Python metatypes will be limited, ! e.g. Python code will never be allowed to allocate raw memory and ! initialize it at will.) ! ! ! Instantiation by calling the type object ! ! Traditionally, for each type there is at least one C function that ! creates instances of the type. This function has to take care of ! both allocating memory for the object and initializing that ! memory. As of Python 2.0, it also has to interface with the ! garbage collection subsystem, if the type chooses to participate ! in garbage collection (which is optional, but strongly recommended ! for so-called "container" types: types that may contain arbitrary ! references to other objects, and hence may participate in ! reference cycles). ! ! If we're going to implement subtyping, we must separate allocation ! and initialization: typically, the most derived subtype is in ! charge of allocation (and hence deallocation!), but in most cases ! each base type's initializer (constructor) must still be called, ! from the "most base" type to the most derived type. ! ! But let's first get the interface for instantiation right. If we ! call an object, the tp_call slot if its type gets invoked. Thus, ! if we call a type, this invokes the tp_call slot of the type's ! type: in other words, the tp_call slot of the metatype. ! Traditionally this has been a NULL pointer, meaning that types ! can't be called. Now we're adding a tp_call slot to the metatype, ! which makes all types "callable" in a trivial sense. But ! obviously the metatype's tp_call implementation doesn't know how ! to initialize individual types. So the type defines a new slot, ! tp_construct, which is invoked by the metatype's tp_call slot. If ! the tp_construct slot is NULL, the metatype's tp_call issues a ! nice error message: the type isn't callable. ! ! We already know that tp_construct is responsible for initializing ! the object (this will be important for subtyping too). Who should ! be responsible for allocation of the new object? Either the ! metatype's tp_call can allocate the object, or the type's ! tp_construct can allocate it. The solution is copied from typical ! C++ implementations: if the metatype's tp_call allocates storage ! for the object it passes the storage as a pointer to the type's ! tp_construct; if the metatype's tp_call does not allocate storage, ! it passes a NULL pointer to the type's tp_call in which case the ! type allocates the storage itself. This moves the policy decision ! to the metatype, and different metatypes may have different ! policies. The mechanisms are fixed though: either the metatype's ! tp_call allocates storage, or the type's tp_construct allocates. ! ! The deallocation mechanism chosen should match the allocation ! mechanism: an allocation policy should prescribe both the ! allocation and deallocation mechanism. And again, planning ahead ! for subtyping would be nice. But the available mechanisms are ! different. The deallocation function has always been part of the ! type structure, as tp_dealloc, which combines the ! "uninitialization" with deallocation. This was good enough for ! the traditional situation, where it matched the combined ! allocation and initialization of the creation function. But now ! imagine a type whose creation function uses a special free list ! for allocation. It's deallocation function puts the object's ! memory back on the same free list. But when allocation and ! creation are separate, the object may have been allocated from the ! regular heap, and it would be wrong (in some cases disastrous) if ! it were placed on the free list by the deallocation function. ! ! A solution would be for the tp_construct function to somehow mark ! whether the object was allocated from the special free list, so ! that the tp_dealloc function can choose the right deallocation ! method (assuming that the only two alternatives are a special free ! list or the regular heap). A variant that doesn't require space ! for an allocation flag bit would be to have two type objects, ! identical in the contents of all their slots except for their ! deallocation slot. But this requires that all type-checking code ! (e.g. the PyDict_Check()) recognizes both types. We'll come back ! to this solution in the context of subtyping. Another alternative ! is to require the metatype's tp_call to leave the allocation to ! the tp_construct method, by passing in a NULL pointer. But this ! doesn't work once we allow subtyping. ! ! Eventually, when we add any form of subtyping, we'll have to ! separate deallocation from uninitialization. The way to do this ! is to add a separate slot to the type object that does the ! uninitialization without the deallocation. Fortunately, there is ! already such a slot: tp_clear, currently used by the garbage ! collection subsystem. A simple rule makes this slot reusable as ! an uninitialization: for types that support separate allocation ! and initialization, tp_clear must be defined (even if the object ! doesn't support garbage collection) and it must DECREF all ! contained objects and FREE all other memory areas the object owns. ! It must also be reentrant: it must be possible to clear an already ! cleared object. The easiest way to do this is to replace all ! pointers DECREFed or FREEd with NULL pointers. ! ! ! Subtyping in C ! ! The simplest form of subtyping is subtyping in C. It is the ! simplest form because we can require the C code to be aware of the ! various problems, and it's acceptable for C code that doesn't ! follow the rules to dump core; while for Python subtyping we would ! need to catch all errors before they become core dumps. ! ! The idea behind subtyping is very similar to that of single ! inheritance in C++. A base type is described by a structure ! declaration plus a type object. A derived type can extend the ! structure (but must leave the names, order and type of the fields ! of the base structure unchanged) and can override certain slots in ! the type object, leaving others the same. ! ! Not every type can serve as a base type. The base type must ! support separation of allocation and initialization by having a ! tp_construct slot that can be called with a preallocated object, ! and it must support uninitialization without deallocation by ! having a tp_clear slot as described above. The derived type must ! also export the structure declaration for its instances through a ! header file, as it is needed in order to derive a subtype. The ! type object for the base type must also be exported. ! ! If the base type has a type-checking macro (e.g. PyDict_Check()), ! this macro may be changed to recognize subtypes. This can be done ! by using the new PyObject_TypeCheck(object, type) macro, which ! calls a function that follows the base class links. There are ! arguments for and against changing the type-checking macro in this ! way. The argument for the change should be clear: it allows ! subtypes to be used in places where the base type is required, ! which is often the prime attraction of subtyping (as opposed to ! sharing implementation). An argument against changing the ! type-checking macro could be that the type check is used ! frequently and a function call would slow things down too much ! (hard to believe); or one could fear that a subtype might break an ! invariant assumed by the support functions of the base type. ! Sometimes it would be wise to change the base type to remove this ! reliance; other times, it would be better to require that derived ! types (implemented in C) maintain the invariants. ! ! The derived type begins by declaring a type structure which ! contains the base type's structure. For example, here's the type ! structure for a subtype of the built-in list type: ! ! typedef struct { ! PyListObject list; ! int state; ! } spamlistobject; ! ! Note that the base type structure field (here PyListObject) must ! be the first field in the structure; any following fields are ! extension fields. Also note that the base type is not referenced ! via a pointer; the actual contents of its structure must be ! included! (The goal is for the memory lay out of the beginning of ! the subtype instance to be the same as that of the base type ! instance.) ! ! Next, the derived type must declare a type object and initialize ! it. Most of the slots in the type object may be initialized to ! zero, which is a signal that the base type slot must be copied ! into it. Some fields that must be initialized properly: ! ! - the object header must be filled in as usual; the type should be ! PyType_Type ! ! - the tp_basicsize field must be set to the size of the subtype ! instances ! ! - the tp_base field must be set to the address of the base type's ! type object ! ! - the tp_dealloc slot function must be a deallocation function for ! the subtype ! ! - the tp_flags field must be set to the usual Py_TPFLAGS_DEFAULT ! value ! ! - the tp_name field must be set (otherwise it will be inherited, ! which is wrong) ! ! Exception: if the subtype defines no additional fields in its ! structure (i.e., it only defines new behavior, no new data), the ! tp_basicsize and the tp_dealloc fields may be set to zero. In ! order to complete the initialization of the type, ! PyType_InitDict() must be called. This replaces zero slots in the ! subtype with the value of the corresponding base type slots. It ! also fills in tp_dict, the type's dictionary; this is more a ! matter of PEP 252. ! ! The subtype's tp_dealloc slot deserves special attention. It must ! uninitialize and deallocate the object in an orderly manner: first ! it must uninitialize the fields added by the extension type; then ! it must call the base type's tp_clear function; finally it must ! deallocate the memory of the object. Usually, the base type's ! tp_clear function has no global name; it is permissible to call it ! via the base type's tp_clear slot, e.g. PyListType.tp_clear(obj). ! Only if it is known that the base type uses the same allocation ! method as the subtype and the subtype requires no uninitialization ! (e.g. it adds no data fields or all its data fields are numbers) ! is it permissible to leave tp_dealloc set to zero in the subtype's ! type object; it will be copied from the base type. ! ! A subtype is not usable until PyType_InitDict() is called for it; ! this is best done during module initialization, assuming the ! subtype belongs to a module. An alternative for subtypes added to ! the Python core (which don't live in a particular module) would be ! to initialize the subtype in their constructor function. It is ! allowed to call PyType_InitDict() more than once, the second and ! further calls have no effect. In order to avoid unnecessary ! calls, a test for tp_dict==NULL can be made. ! ! If the subtype itself should be subtypable (usually desirable), it ! should follow the same rules are given above for base types: have ! a tp_construct that accepts a preallocated object and calls the ! base type's tp_construct, and have a tp_clear that calls the base ! type's tp_clear. ! ! ! Subtyping in Python ! ! The next step is to allow subtyping of selected built-in types ! through a class statement in Python. Limiting ourselves to single ! inheritance for now, here is what happens for a simple class ! statement: ! ! class C(B): ! var1 = 1 ! def method1(self): pass ! # etc. ! ! The body of the class statement is executes in a fresh environment ! (basically, a new dictionary used as local namespace), and then C ! is created. The following explains how C is created. ! ! Assume B is a type object. Since type objects are objects, and ! every object has a type, B has a type. B's type is accessible via ! type(B) or B.__class__ (the latter notation is new for types; it ! is introduced in PEP 252). Let's say B's type is M (for ! Metatype). The class statement will create a new type, C. Since ! C will be a type object just like B, we view the creation of C as ! an instantiation of the metatype, M. The information that needs ! to be provided for the creation of C is: its name (in this example ! the string "C"); the list of base classes (a singleton tuple ! containing B); and the results of executing the class body, in the ! form of a dictionary (e.g. {"var1": 1, "method1": , ! ...}). ! ! According to the Don Beaudry hook, the following call is made: ! ! C = M("C", (B,), dict) ! ! (where dict is the dictionary resulting from execution of the ! class body). In other words, the metatype (M) is called. Note ! that even though we currently require there to be exactly one base ! class, we still pass in a (singleton) sequence of base classes; ! this makes it possible to support multiple inheritance later (or ! for types with a different metaclass!) without changing this ! interface. ! ! Note that calling M requires that M itself has a type: the ! meta-metatype. In the current implementation, I have introduced a ! new type object for this purpose, named turtle because of my ! fondness of the phrase "turtles all the way down". However I now ! believe that it would be better if M were its own metatype, just ! like before. This can be accomplished by making M's tp_call slot ! slightly more flexible. ! ! In any case, the work for creating C is done by M's tp_construct ! slot. It allocates space for an "extended" type structure, which ! contains space for: the type object; the auxiliary structures ! (as_sequence etc.); the string object containing the type name (to ! ensure that this object isn't deallocated while the type object is ! still referencing it); and some more auxiliary storage (to be ! described later). It initializes this storage to zeros except for ! a few crucial slots (e.g. tp_name is set to point to the type ! name) and then sets the tp_base slot to point to B. Then ! PyType_InitDict() is called to inherit B's slots. Finally, C's ! tp_dict slot is updated with the contents of the namespace ! dictionary (the third argument to the call to M). From gvanrossum@users.sourceforge.net Tue May 15 02:53:42 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 14 May 2001 18:53:42 -0700 Subject: [Python-checkins] CVS: python/dist/src .cvsignore,2.1,2.2 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv23042 Modified Files: .cvsignore Log Message: Ignore 'build' and 'Makefile.pre'. Index: .cvsignore =================================================================== RCS file: /cvsroot/python/python/dist/src/.cvsignore,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** .cvsignore 2000/05/02 18:31:04 2.1 --- .cvsignore 2001/05/15 01:53:40 2.2 *************** *** 7,8 **** --- 7,10 ---- buildno python + build + Makefile.pre From gvanrossum@users.sourceforge.net Tue May 15 03:14:46 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 14 May 2001 19:14:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules stropmodule.c,2.81,2.82 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv26415/Modules Modified Files: stropmodule.c Log Message: Add warnings to the strop module, for to those functions that really *are* obsolete; three variables and the maketrans() function are not (yet) obsolete. Add a compensating warnings.filterwarnings() call to test_strop.py. Add this to the NEWS. Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.81 retrieving revision 2.82 diff -C2 -r2.81 -r2.82 *** stropmodule.c 2001/05/10 01:23:39 2.81 --- stropmodule.c 2001/05/15 02:14:44 2.82 *************** *** 13,16 **** --- 13,20 ---- XXX are defined for all 8-bit characters! */ + #define WARN if (PyErr_Warn(PyExc_DeprecationWarning, \ + "strop functions are obsolete; use string methods")) \ + return NULL + /* The lstrip(), rstrip() and strip() functions are implemented in do_strip(), which uses an additional parameter to indicate what *************** *** 96,99 **** --- 100,104 ---- PyObject *list, *item; + WARN; sub = NULL; n = 0; *************** *** 168,171 **** --- 173,177 ---- intargfunc getitemfunc; + WARN; if (!PyArg_ParseTuple(args, "O|t#:join", &seq, &sep, &seplen)) return NULL; *************** *** 293,296 **** --- 299,303 ---- int len, n, i = 0, last = INT_MAX; + WARN; if (!PyArg_ParseTuple(args, "t#t#|ii:find", &s, &len, &sub, &n, &i, &last)) return NULL; *************** *** 336,339 **** --- 343,347 ---- int i = 0, last = INT_MAX; + WARN; if (!PyArg_ParseTuple(args, "t#t#|ii:rfind", &s, &len, &sub, &n, &i, &last)) return NULL; *************** *** 405,408 **** --- 413,417 ---- strop_strip(PyObject *self, PyObject *args) { + WARN; return do_strip(args, BOTHSTRIP); } *************** *** 417,420 **** --- 426,430 ---- strop_lstrip(PyObject *self, PyObject *args) { + WARN; return do_strip(args, LEFTSTRIP); } *************** *** 429,432 **** --- 439,443 ---- strop_rstrip(PyObject *self, PyObject *args) { + WARN; return do_strip(args, RIGHTSTRIP); } *************** *** 446,449 **** --- 457,461 ---- int changed; + WARN; if (!PyArg_Parse(args, "t#", &s, &n)) return NULL; *************** *** 484,487 **** --- 496,500 ---- int changed; + WARN; if (!PyArg_Parse(args, "t#", &s, &n)) return NULL; *************** *** 523,526 **** --- 536,540 ---- int changed; + WARN; if (!PyArg_Parse(args, "t#", &s, &n)) return NULL; *************** *** 578,581 **** --- 592,596 ---- int tabsize = 8; + WARN; /* Get arguments */ if (!PyArg_ParseTuple(args, "s#|i:expandtabs", &string, &stringlen, &tabsize)) *************** *** 643,646 **** --- 658,662 ---- int m, r; + WARN; if (!PyArg_ParseTuple(args, "t#t#|ii:count", &s, &len, &sub, &n, &i, &last)) return NULL; *************** *** 686,689 **** --- 702,706 ---- int changed; + WARN; if (!PyArg_Parse(args, "t#", &s, &n)) return NULL; *************** *** 734,737 **** --- 751,755 ---- char buffer[256]; /* For errors */ + WARN; if (!PyArg_ParseTuple(args, "s|i:atoi", &s, &base)) return NULL; *************** *** 787,790 **** --- 805,809 ---- char buffer[256]; /* For errors */ + WARN; if (!PyArg_ParseTuple(args, "s|i:atol", &s, &base)) return NULL; *************** *** 831,834 **** --- 850,854 ---- char buffer[256]; /* For errors */ + WARN; if (!PyArg_ParseTuple(args, "s:atof", &s)) return NULL; *************** *** 914,917 **** --- 934,938 ---- int trans_table[256]; + WARN; if (!PyArg_ParseTuple(args, "St#|t#:translate", &input_obj, &table1, &tablen, &del_table, &dellen)) *************** *** 1125,1128 **** --- 1146,1150 ---- PyObject *new; + WARN; if (!PyArg_ParseTuple(args, "t#t#t#|i:replace", &str, &len, &pat, &pat_len, &sub, &sub_len, From gvanrossum@users.sourceforge.net Tue May 15 03:14:47 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 14 May 2001 19:14:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_strop.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv26415/Lib/test Modified Files: test_strop.py Log Message: Add warnings to the strop module, for to those functions that really *are* obsolete; three variables and the maketrans() function are not (yet) obsolete. Add a compensating warnings.filterwarnings() call to test_strop.py. Add this to the NEWS. Index: test_strop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strop.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** test_strop.py 2001/05/10 01:23:39 1.12 --- test_strop.py 2001/05/15 02:14:44 1.13 *************** *** 1,3 **** --- 1,5 ---- from test_support import verbose + import warnings + warnings.filterwarnings("ignore", "", DeprecationWarning, __name__) import strop, sys From gvanrossum@users.sourceforge.net Tue May 15 03:14:47 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 14 May 2001 19:14:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.171,1.172 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv26415/Misc Modified Files: NEWS Log Message: Add warnings to the strop module, for to those functions that really *are* obsolete; three variables and the maketrans() function are not (yet) obsolete. Add a compensating warnings.filterwarnings() call to test_strop.py. Add this to the NEWS. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.171 retrieving revision 1.172 diff -C2 -r1.171 -r1.172 *** NEWS 2001/05/14 22:32:33 1.171 --- NEWS 2001/05/15 02:14:44 1.172 *************** *** 88,91 **** --- 88,95 ---- Library + - strop is now *really* obsolete (this was announced before with 1.6), + and issues DeprecationWarning when used (except for the four items + that are still imported into string.py). + - Cookie.py now sorts key+value pairs by key in output strings. From lemburg@users.sourceforge.net Tue May 15 12:58:08 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Tue, 15 May 2001 04:58:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib UserString.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv24065/Lib Modified Files: UserString.py Log Message: This patch changes the way the string .encode() method works slightly and introduces a new method .decode(). The major change is that strg.encode() will no longer try to convert Unicode returns from the codec into a string, but instead pass along the Unicode object as-is. The same is now true for all other codec return types. The underlying C APIs were changed accordingly. Note that even though this does have the potential of breaking existing code, the chances are low since conversion from Unicode previously took place using the default encoding which is normally set to ASCII rendering this auto-conversion mechanism useless for most Unicode encodings. The good news is that you can now use .encode() and .decode() with much greater ease and that the door was opened for better accessibility of the builtin codecs. As demonstration of the new feature, the patch includes a few new codecs which allow string to string encoding and decoding (rot13, hex, zip, uu, base64). Written by Marc-Andre Lemburg. Copyright assigned to the PSF. Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** UserString.py 2001/01/20 19:54:20 1.9 --- UserString.py 2001/05/15 11:58:05 1.10 *************** *** 73,76 **** --- 73,84 ---- def count(self, sub, start=0, end=sys.maxint): return self.data.count(sub, start, end) + def decode(self, encoding=None, errors=None): # XXX improve this? + if encoding: + if errors: + return self.__class__(self.data.decode(encoding, errors)) + else: + return self.__class__(self.data.decode(encoding)) + else: + return self.__class__(self.data.decode()) def encode(self, encoding=None, errors=None): # XXX improve this? if encoding: From lemburg@users.sourceforge.net Tue May 15 12:58:08 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Tue, 15 May 2001 04:58:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/encodings aliases.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv24065/Lib/encodings Modified Files: aliases.py Log Message: This patch changes the way the string .encode() method works slightly and introduces a new method .decode(). The major change is that strg.encode() will no longer try to convert Unicode returns from the codec into a string, but instead pass along the Unicode object as-is. The same is now true for all other codec return types. The underlying C APIs were changed accordingly. Note that even though this does have the potential of breaking existing code, the chances are low since conversion from Unicode previously took place using the default encoding which is normally set to ASCII rendering this auto-conversion mechanism useless for most Unicode encodings. The good news is that you can now use .encode() and .decode() with much greater ease and that the door was opened for better accessibility of the builtin codecs. As demonstration of the new feature, the patch includes a few new codecs which allow string to string encoding and decoding (rot13, hex, zip, uu, base64). Written by Marc-Andre Lemburg. Copyright assigned to the PSF. Index: aliases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/aliases.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** aliases.py 2000/06/07 09:12:30 1.4 --- aliases.py 2001/05/15 11:58:05 1.5 *************** *** 80,82 **** --- 80,91 ---- 'sjis': 'shift_jis', + # Content transfer/compression encodings + 'rot13': 'rot_13', + 'base64': 'base64_codec', + 'base_64': 'base64_codec', + 'zlib': 'zlib_codec', + 'zip': 'zlib_codec', + 'hex': 'hex_codec', + 'uu': 'uu_codec', + } From lemburg@users.sourceforge.net Tue May 15 12:58:07 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Tue, 15 May 2001 04:58:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include stringobject.h,2.25,2.26 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv24065/Include Modified Files: stringobject.h Log Message: This patch changes the way the string .encode() method works slightly and introduces a new method .decode(). The major change is that strg.encode() will no longer try to convert Unicode returns from the codec into a string, but instead pass along the Unicode object as-is. The same is now true for all other codec return types. The underlying C APIs were changed accordingly. Note that even though this does have the potential of breaking existing code, the chances are low since conversion from Unicode previously took place using the default encoding which is normally set to ASCII rendering this auto-conversion mechanism useless for most Unicode encodings. The good news is that you can now use .encode() and .decode() with much greater ease and that the door was opened for better accessibility of the builtin codecs. As demonstration of the new feature, the patch includes a few new codecs which allow string to string encoding and decoding (rot13, hex, zip, uu, base64). Written by Marc-Andre Lemburg. Copyright assigned to the PSF. Index: stringobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/stringobject.h,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -r2.25 -r2.26 *** stringobject.h 2001/02/23 16:40:48 2.25 --- stringobject.h 2001/05/15 11:58:05 2.26 *************** *** 79,83 **** /* --- Generic Codecs ----------------------------------------------------- */ ! /* Create a string object by decoding the encoded string s of the given size. */ --- 79,83 ---- /* --- Generic Codecs ----------------------------------------------------- */ ! /* Create an object by decoding the encoded string s of the given size. */ *************** *** 90,94 **** /* Encodes a char buffer of the given size and returns a ! Python string object. */ extern DL_IMPORT(PyObject*) PyString_Encode( --- 90,94 ---- /* Encodes a char buffer of the given size and returns a ! Python object. */ extern DL_IMPORT(PyObject*) PyString_Encode( *************** *** 99,106 **** ); ! /* Encodes a string object and returns the result as Python string object. */ extern DL_IMPORT(PyObject*) PyString_AsEncodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ --- 99,143 ---- ); ! /* Encodes a string object and returns the result as Python object. */ + extern DL_IMPORT(PyObject*) PyString_AsEncodedObject( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + + /* Encodes a string object and returns the result as Python string + object. + + If the codec returns an Unicode object, the object is converted + back to a string using the default encoding. + + DEPRECATED - use PyString_AsEncodedObject() instead. */ + extern DL_IMPORT(PyObject*) PyString_AsEncodedString( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + + /* Decodes a string object and returns the result as Python + object. */ + + extern DL_IMPORT(PyObject*) PyString_AsDecodedObject( + PyObject *str, /* string object */ + const char *encoding, /* encoding */ + const char *errors /* error handling */ + ); + + /* Decodes a string object and returns the result as Python string + object. + + If the codec returns an Unicode object, the object is converted + back to a string using the default encoding. + + DEPRECATED - use PyString_AsDecodedObject() instead. */ + + extern DL_IMPORT(PyObject*) PyString_AsDecodedString( PyObject *str, /* string object */ const char *encoding, /* encoding */ From lemburg@users.sourceforge.net Tue May 15 12:58:07 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Tue, 15 May 2001 04:58:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.120,1.121 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv24065/Doc/api Modified Files: api.tex Log Message: This patch changes the way the string .encode() method works slightly and introduces a new method .decode(). The major change is that strg.encode() will no longer try to convert Unicode returns from the codec into a string, but instead pass along the Unicode object as-is. The same is now true for all other codec return types. The underlying C APIs were changed accordingly. Note that even though this does have the potential of breaking existing code, the chances are low since conversion from Unicode previously took place using the default encoding which is normally set to ASCII rendering this auto-conversion mechanism useless for most Unicode encodings. The good news is that you can now use .encode() and .decode() with much greater ease and that the door was opened for better accessibility of the builtin codecs. As demonstration of the new feature, the patch includes a few new codecs which allow string to string encoding and decoding (rot13, hex, zip, uu, base64). Written by Marc-Andre Lemburg. Copyright assigned to the PSF. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -r1.120 -r1.121 *** api.tex 2001/05/07 17:47:07 1.120 --- api.tex 2001/05/15 11:58:05 1.121 *************** *** 2327,2332 **** const char *encoding, const char *errors} ! Create a string object by decoding \var{size} bytes of the encoded ! buffer \var{s}. \var{encoding} and \var{errors} have the same meaning as the parameters of the same name in the unicode() builtin function. The codec to be used is looked up using the Python codec --- 2327,2333 ---- const char *encoding, const char *errors} ! Creates an object by decoding \var{size} bytes of the encoded ! buffer \var{s} using the codec registered ! for \var{encoding}. \var{encoding} and \var{errors} have the same meaning as the parameters of the same name in the unicode() builtin function. The codec to be used is looked up using the Python codec *************** *** 2335,2344 **** \end{cfuncdesc} ! \begin{cfuncdesc}{PyObject*}{PyString_Encode}{const Py_UNICODE *s, int size, const char *encoding, const char *errors} ! Encodes the \ctype{Py_UNICODE} buffer of the given size and returns a ! Python string object. \var{encoding} and \var{errors} have the same meaning as the parameters of the same name in the string .encode() method. The codec to be used is looked up using the Python codec --- 2336,2357 ---- \end{cfuncdesc} ! \begin{cfuncdesc}{PyObject*}{PyString_AsDecodedObject}{PyObject *str, ! const char *encoding, ! const char *errors} ! Decodes a string object by passing it to the codec registered ! for \var{encoding} and returns the result as Python ! object. \var{encoding} and \var{errors} have the same meaning as the ! parameters of the same name in the string .encode() method. The codec ! to be used is looked up using the Python codec registry. Returns ! \NULL{} in case an exception was raised by the codec. ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{PyObject*}{PyString_Encode}{const char *s, int size, const char *encoding, const char *errors} ! Encodes the \ctype{char} buffer of the given size by passing it to ! the codec registered for \var{encoding} and returns a Python object. ! \var{encoding} and \var{errors} have the same meaning as the parameters of the same name in the string .encode() method. The codec to be used is looked up using the Python codec *************** *** 2347,2354 **** \end{cfuncdesc} ! \begin{cfuncdesc}{PyObject*}{PyString_AsEncodedString}{PyObject *unicode, const char *encoding, const char *errors} ! Encodes a string object and returns the result as Python string object. \var{encoding} and \var{errors} have the same meaning as the parameters of the same name in the string .encode() method. The codec --- 2360,2368 ---- \end{cfuncdesc} ! \begin{cfuncdesc}{PyObject*}{PyString_AsEncodedObject}{PyObject *str, const char *encoding, const char *errors} ! Encodes a string object using the codec registered ! for \var{encoding} and returns the result as Python object. \var{encoding} and \var{errors} have the same meaning as the parameters of the same name in the string .encode() method. The codec From lemburg@users.sourceforge.net Tue May 15 12:58:08 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Tue, 15 May 2001 04:58:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test string_tests.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv24065/Lib/test Modified Files: string_tests.py Log Message: This patch changes the way the string .encode() method works slightly and introduces a new method .decode(). The major change is that strg.encode() will no longer try to convert Unicode returns from the codec into a string, but instead pass along the Unicode object as-is. The same is now true for all other codec return types. The underlying C APIs were changed accordingly. Note that even though this does have the potential of breaking existing code, the chances are low since conversion from Unicode previously took place using the default encoding which is normally set to ASCII rendering this auto-conversion mechanism useless for most Unicode encodings. The good news is that you can now use .encode() and .decode() with much greater ease and that the door was opened for better accessibility of the builtin codecs. As demonstration of the new feature, the patch includes a few new codecs which allow string to string encoding and decoding (rot13, hex, zip, uu, base64). Written by Marc-Andre Lemburg. Copyright assigned to the PSF. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** string_tests.py 2001/05/09 23:00:26 1.8 --- string_tests.py 2001/05/15 11:58:06 1.9 *************** *** 2,5 **** --- 2,6 ---- import string + from test_support import verify, verbose, TestFailed 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' *************** *** 213,214 **** --- 214,233 ---- test('endswith', 'ab', 0, 'ab', 0, 1) test('endswith', 'ab', 0, 'ab', 0, 0) + + # Encoding/decoding + codecs = [('rot13', 'uryyb jbeyq'), + ('base64', 'aGVsbG8gd29ybGQ=\n'), + ('hex', '68656c6c6f20776f726c64'), + ('uu', 'begin 666 \n+:&5L;&\\@=V]R;&0 \n \nend\n')] + for encoding, data in codecs: + test('encode', 'hello world', data, encoding) + test('decode', data, 'hello world', encoding) + # zlib is optional, so we make the test optional too... + try: + import zlib + except ImportError: + pass + else: + data = 'x\x9c\xcbH\xcd\xc9\xc9W(\xcf/\xcaI\x01\x00\x1a\x0b\x04]' + verify('hello world'.encode('zlib') == data) + verify(data.decode('zlib') == 'hello world') From lemburg@users.sourceforge.net Tue May 15 12:58:08 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Tue, 15 May 2001 04:58:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.115,2.116 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv24065/Objects Modified Files: stringobject.c Log Message: This patch changes the way the string .encode() method works slightly and introduces a new method .decode(). The major change is that strg.encode() will no longer try to convert Unicode returns from the codec into a string, but instead pass along the Unicode object as-is. The same is now true for all other codec return types. The underlying C APIs were changed accordingly. Note that even though this does have the potential of breaking existing code, the chances are low since conversion from Unicode previously took place using the default encoding which is normally set to ASCII rendering this auto-conversion mechanism useless for most Unicode encodings. The good news is that you can now use .encode() and .decode() with much greater ease and that the door was opened for better accessibility of the builtin codecs. As demonstration of the new feature, the patch includes a few new codecs which allow string to string encoding and decoding (rot13, hex, zip, uu, base64). Written by Marc-Andre Lemburg. Copyright assigned to the PSF. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.115 retrieving revision 2.116 diff -C2 -r2.115 -r2.116 *** stringobject.c 2001/05/10 00:32:57 2.115 --- stringobject.c 2001/05/15 11:58:06 2.116 *************** *** 153,188 **** const char *errors) { ! PyObject *buffer = NULL, *str; if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); /* Decode via the codec registry */ ! buffer = PyBuffer_FromMemory((void *)s, size); ! if (buffer == NULL) goto onError; ! str = PyCodec_Decode(buffer, encoding, errors); ! if (str == NULL) goto onError; /* Convert Unicode to a string using the default encoding */ ! if (PyUnicode_Check(str)) { ! PyObject *temp = str; ! str = PyUnicode_AsEncodedString(str, NULL, NULL); Py_DECREF(temp); ! if (str == NULL) goto onError; } ! if (!PyString_Check(str)) { PyErr_Format(PyExc_TypeError, "decoder did not return a string object (type=%.400s)", ! str->ob_type->tp_name); ! Py_DECREF(str); goto onError; } ! Py_DECREF(buffer); ! return str; onError: - Py_XDECREF(buffer); return NULL; } --- 153,220 ---- const char *errors) { ! PyObject *v, *str; ! ! str = PyString_FromStringAndSize(s, size); ! if (str == NULL) ! return NULL; ! v = PyString_AsDecodedString(str, encoding, errors); ! Py_DECREF(str); ! return v; ! } + PyObject *PyString_AsDecodedObject(PyObject *str, + const char *encoding, + const char *errors) + { + PyObject *v; + + if (!PyString_Check(str)) { + PyErr_BadArgument(); + goto onError; + } + if (encoding == NULL) encoding = PyUnicode_GetDefaultEncoding(); /* Decode via the codec registry */ ! v = PyCodec_Decode(str, encoding, errors); ! if (v == NULL) goto onError; ! ! return v; ! ! onError: ! return NULL; ! } ! ! PyObject *PyString_AsDecodedString(PyObject *str, ! const char *encoding, ! const char *errors) ! { ! PyObject *v; ! ! v = PyString_AsDecodedObject(str, encoding, errors); ! if (v == NULL) goto onError; + /* Convert Unicode to a string using the default encoding */ ! if (PyUnicode_Check(v)) { ! PyObject *temp = v; ! v = PyUnicode_AsEncodedString(v, NULL, NULL); Py_DECREF(temp); ! if (v == NULL) goto onError; } ! if (!PyString_Check(v)) { PyErr_Format(PyExc_TypeError, "decoder did not return a string object (type=%.400s)", ! v->ob_type->tp_name); ! Py_DECREF(v); goto onError; } ! ! return v; onError: return NULL; } *************** *** 203,207 **** } ! PyObject *PyString_AsEncodedString(PyObject *str, const char *encoding, const char *errors) --- 235,239 ---- } ! PyObject *PyString_AsEncodedObject(PyObject *str, const char *encoding, const char *errors) *************** *** 221,224 **** --- 253,273 ---- if (v == NULL) goto onError; + + return v; + + onError: + return NULL; + } + + PyObject *PyString_AsEncodedString(PyObject *str, + const char *encoding, + const char *errors) + { + PyObject *v; + + v = PyString_AsEncodedString(str, encoding, errors); + if (v == NULL) + goto onError; + /* Convert Unicode to a string using the default encoding */ if (PyUnicode_Check(v)) { *************** *** 236,239 **** --- 285,289 ---- goto onError; } + return v; *************** *** 1780,1787 **** static char encode__doc__[] = ! "S.encode([encoding[,errors]]) -> string\n\ \n\ ! Return an encoded string version of S. Default encoding is the current\n\ ! default string encoding. errors may be given to set a different error\n\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\ a ValueError. Other possible values are 'ignore' and 'replace'."; --- 1830,1837 ---- static char encode__doc__[] = ! "S.encode([encoding[,errors]]) -> object\n\ \n\ ! Encodes S using the codec registered for encoding. encoding defaults\n\ ! to the default encoding. errors may be given to set a different error\n\ handling scheme. Default is 'strict' meaning that encoding errors raise\n\ a ValueError. Other possible values are 'ignore' and 'replace'."; *************** *** 1793,1798 **** char *errors = NULL; if (!PyArg_ParseTuple(args, "|ss:encode", &encoding, &errors)) return NULL; ! return PyString_AsEncodedString((PyObject *)self, encoding, errors); } --- 1843,1867 ---- char *errors = NULL; if (!PyArg_ParseTuple(args, "|ss:encode", &encoding, &errors)) + return NULL; + return PyString_AsEncodedObject((PyObject *)self, encoding, errors); + } + + + static char decode__doc__[] = + "S.decode([encoding[,errors]]) -> object\n\ + \n\ + Decodes S using the codec registered for encoding. encoding defaults\n\ + to the default encoding. errors may be given to set a different error\n\ + handling scheme. Default is 'strict' meaning that encoding errors raise\n\ + a ValueError. Other possible values are 'ignore' and 'replace'."; + + static PyObject * + string_decode(PyStringObject *self, PyObject *args) + { + char *encoding = NULL; + char *errors = NULL; + if (!PyArg_ParseTuple(args, "|ss:decode", &encoding, &errors)) return NULL; ! return PyString_AsDecodedObject((PyObject *)self, encoding, errors); } *************** *** 2372,2375 **** --- 2441,2445 ---- {"center", (PyCFunction)string_center, 1, center__doc__}, {"encode", (PyCFunction)string_encode, 1, encode__doc__}, + {"decode", (PyCFunction)string_decode, 1, decode__doc__}, {"expandtabs", (PyCFunction)string_expandtabs, 1, expandtabs__doc__}, {"splitlines", (PyCFunction)string_splitlines, 1, splitlines__doc__}, From lemburg@users.sourceforge.net Tue May 15 13:00:04 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Tue, 15 May 2001 05:00:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/encodings base64_codec.py,NONE,1.1 hex_codec.py,NONE,1.1 rot_13.py,NONE,1.1 uu_codec.py,NONE,1.1 zlib_codec.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv26128/Lib/encodings Added Files: base64_codec.py hex_codec.py rot_13.py uu_codec.py zlib_codec.py Log Message: This patch changes the way the string .encode() method works slightly and introduces a new method .decode(). The major change is that strg.encode() will no longer try to convert Unicode returns from the codec into a string, but instead pass along the Unicode object as-is. The same is now true for all other codec return types. The underlying C APIs were changed accordingly. Note that even though this does have the potential of breaking existing code, the chances are low since conversion from Unicode previously took place using the default encoding which is normally set to ASCII rendering this auto-conversion mechanism useless for most Unicode encodings. The good news is that you can now use .encode() and .decode() with much greater ease and that the door was opened for better accessibility of the builtin codecs. As demonstration of the new feature, the patch includes a few new codecs which allow string to string encoding and decoding (rot13, hex, zip, uu, base64). Written by Marc-Andre Lemburg. Copyright assigned to the PSF. --- NEW FILE: base64_codec.py --- """ Python 'base64_codec' Codec - base64 content transfer encoding Unlike most of the other codecs which target Unicode, this codec will return Python string objects for both encode and decode. Written by Marc-Andre Lemburg (mal@lemburg.com). """ import codecs, base64 ### Codec APIs def base64_encode(input,errors='strict'): """ Encodes the object input and returns a tuple (output object, length consumed). errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec. """ assert errors == 'strict' output = base64.encodestring(input) return (output, len(input)) def base64_decode(input,errors='strict'): """ Decodes the object input and returns a tuple (output object, length consumed). input must be an object which provides the bf_getreadbuf buffer slot. Python strings, buffer objects and memory mapped files are examples of objects providing this slot. errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec. """ assert errors == 'strict' output = base64.decodestring(input) return (output, len(input)) class Codec(codecs.Codec): encode = base64_encode decode = base64_decode class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return (base64_encode,base64_decode,StreamReader,StreamWriter) --- NEW FILE: hex_codec.py --- """ Python 'hex_codec' Codec - 2-digit hex content transfer encoding Unlike most of the other codecs which target Unicode, this codec will return Python string objects for both encode and decode. Written by Marc-Andre Lemburg (mal@lemburg.com). """ import codecs, binascii ### Codec APIs def hex_encode(input,errors='strict'): """ Encodes the object input and returns a tuple (output object, length consumed). errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec. """ assert errors == 'strict' output = binascii.b2a_hex(input) return (output, len(input)) def hex_decode(input,errors='strict'): """ Decodes the object input and returns a tuple (output object, length consumed). input must be an object which provides the bf_getreadbuf buffer slot. Python strings, buffer objects and memory mapped files are examples of objects providing this slot. errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec. """ assert errors == 'strict' output = binascii.a2b_hex(input) return (output, len(input)) class Codec(codecs.Codec): encode = hex_encode decode = hex_decode class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return (hex_encode,hex_decode,StreamReader,StreamWriter) --- NEW FILE: rot_13.py --- #!/usr/local/bin/python2.1 """ Python Character Mapping Codec for ROT13. See http://ucsub.colorado.edu/~kominek/rot13/ for details. Written by Marc-Andre Lemburg (mal@lemburg.com). """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) def decode(self,input,errors='strict'): return codecs.charmap_decode(input,errors,decoding_map) class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return (Codec().encode,Codec().decode,StreamReader,StreamWriter) ### Decoding Map decoding_map = codecs.make_identity_dict(range(256)) decoding_map.update({ 0x0041: 0x004e, 0x0042: 0x004f, 0x0043: 0x0050, 0x0044: 0x0051, 0x0045: 0x0052, 0x0046: 0x0053, 0x0047: 0x0054, 0x0048: 0x0055, 0x0049: 0x0056, 0x004a: 0x0057, 0x004b: 0x0058, 0x004c: 0x0059, 0x004d: 0x005a, 0x004e: 0x0041, 0x004f: 0x0042, 0x0050: 0x0043, 0x0051: 0x0044, 0x0052: 0x0045, 0x0053: 0x0046, 0x0054: 0x0047, 0x0055: 0x0048, 0x0056: 0x0049, 0x0057: 0x004a, 0x0058: 0x004b, 0x0059: 0x004c, 0x005a: 0x004d, 0x0061: 0x006e, 0x0062: 0x006f, 0x0063: 0x0070, 0x0064: 0x0071, 0x0065: 0x0072, 0x0066: 0x0073, 0x0067: 0x0074, 0x0068: 0x0075, 0x0069: 0x0076, 0x006a: 0x0077, 0x006b: 0x0078, 0x006c: 0x0079, 0x006d: 0x007a, 0x006e: 0x0061, 0x006f: 0x0062, 0x0070: 0x0063, 0x0071: 0x0064, 0x0072: 0x0065, 0x0073: 0x0066, 0x0074: 0x0067, 0x0075: 0x0068, 0x0076: 0x0069, 0x0077: 0x006a, 0x0078: 0x006b, 0x0079: 0x006c, 0x007a: 0x006d, }) ### Encoding Map encoding_map = {} for k,v in decoding_map.items(): encoding_map[v] = k ### Filter API def rot13(infile, outfile): outfile.write(infile.read().encode('rot-13')) if __name__ == '__main__': import sys rot13(sys.stdin, sys.stdout) --- NEW FILE: uu_codec.py --- """ Python 'uu_codec' Codec - UU content transfer encoding Unlike most of the other codecs which target Unicode, this codec will return Python string objects for both encode and decode. Written by Marc-Andre Lemburg (mal@lemburg.com). Some details were adapted from uu.py which was written by Lance Ellinghouse and modified by Jack Jansen and Fredrik Lundh. """ import codecs, binascii ### Codec APIs def uu_encode(input,errors='strict',filename='',mode=0666): """ Encodes the object input and returns a tuple (output object, length consumed). errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec. """ assert errors == 'strict' from cStringIO import StringIO from binascii import b2a_uu infile = StringIO(input) outfile = StringIO() read = infile.read write = outfile.write # Encode write('begin %o %s\n' % (mode & 0777, filename)) chunk = read(45) while chunk: write(b2a_uu(chunk)) chunk = read(45) write(' \nend\n') return (outfile.getvalue(), len(input)) def uu_decode(input,errors='strict'): """ Decodes the object input and returns a tuple (output object, length consumed). input must be an object which provides the bf_getreadbuf buffer slot. Python strings, buffer objects and memory mapped files are examples of objects providing this slot. errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec. Note: filename and file mode information in the input data is ignored. """ assert errors == 'strict' from cStringIO import StringIO from binascii import a2b_uu infile = StringIO(input) outfile = StringIO() readline = infile.readline write = outfile.write # Find start of encoded data while 1: s = readline() if not s: raise ValueError, 'Missing "begin" line in input data' if s[:5] == 'begin': break # Decode while 1: s = readline() if not s or \ s == 'end\n': break try: data = a2b_uu(s) except binascii.Error, v: # Workaround for broken uuencoders by /Fredrik Lundh nbytes = (((ord(s[0])-32) & 63) * 4 + 5) / 3 data = a2b_uu(s[:nbytes]) #sys.stderr.write("Warning: %s\n" % str(v)) write(data) if not s: raise ValueError, 'Truncated input data' return (outfile.getvalue(), len(input)) class Codec(codecs.Codec): encode = uu_encode decode = uu_decode class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return (uu_encode,uu_decode,StreamReader,StreamWriter) --- NEW FILE: zlib_codec.py --- """ Python 'zlib_codec' Codec - zlib compression encoding Unlike most of the other codecs which target Unicode, this codec will return Python string objects for both encode and decode. Written by Marc-Andre Lemburg (mal@lemburg.com). """ import codecs import zlib # this codec needs the optional zlib module ! ### Codec APIs def zlib_encode(input,errors='strict'): """ Encodes the object input and returns a tuple (output object, length consumed). errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec. """ assert errors == 'strict' output = zlib.compress(input) return (output, len(input)) def zlib_decode(input,errors='strict'): """ Decodes the object input and returns a tuple (output object, length consumed). input must be an object which provides the bf_getreadbuf buffer slot. Python strings, buffer objects and memory mapped files are examples of objects providing this slot. errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec. """ assert errors == 'strict' output = zlib.decompress(input) return (output, len(input)) class Codec(codecs.Codec): encode = zlib_encode decode = zlib_decode class StreamWriter(Codec,codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass ### encodings module API def getregentry(): return (zlib_encode,zlib_decode,StreamReader,StreamWriter) From fdrake@users.sourceforge.net Tue May 15 16:23:04 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 15 May 2001 08:23:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib ntpath.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv21256/Lib Modified Files: ntpath.py Log Message: abspath(): Fix inconsistent indentation. Index: ntpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** ntpath.py 2001/05/13 08:04:26 1.35 --- ntpath.py 2001/05/15 15:23:01 1.36 *************** *** 410,414 **** path = _getfullpathname(path) except WindowsError: ! pass # Bad path - return unchanged. else: path = os.getcwd() --- 410,414 ---- path = _getfullpathname(path) except WindowsError: ! pass # Bad path - return unchanged. else: path = os.getcwd() From fdrake@users.sourceforge.net Tue May 15 16:27:55 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 15 May 2001 08:27:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libfuncs.tex,1.77,1.78 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv22512/lib Modified Files: libfuncs.tex Log Message: Beef up the unicode() description a bit, based on material from AMK's "What's New in Python ..." documents. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -r1.77 -r1.78 *** libfuncs.tex 2001/05/02 20:19:19 1.77 --- libfuncs.tex 2001/05/15 15:27:53 1.78 *************** *** 689,696 **** \begin{funcdesc}{unicode}{string\optional{, encoding\optional{, errors}}} ! Decodes \var{string} using the codec for \var{encoding}. Error ! handling is done according to \var{errors}. The default behavior is ! to decode UTF-8 in strict mode, meaning that encoding errors raise ! \exception{ValueError}. See also the \refmodule{codecs} module. \versionadded{2.0} \end{funcdesc} --- 689,704 ---- \begin{funcdesc}{unicode}{string\optional{, encoding\optional{, errors}}} ! Create a Unicode string from an 8-bit string \var{string} 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 \var{errors} is \code{'strict'} ! (the default), a \exception{ValueError} is raised on errors, while a ! value of \code{'ignore'} causes errors to be silently ignored, and a ! value of \code{'replace'} causes the official Unicode replacement ! character, \code{U+FFFD}, to be used to replace input characters which ! cannot be decoded. The default behavior is to decode UTF-8 in strict ! mode, meaning that encoding errors raise \exception{ValueError}. See ! also the \refmodule{codecs} module. \versionadded{2.0} \end{funcdesc} From gvanrossum@users.sourceforge.net Tue May 15 16:34:10 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 15 May 2001 08:34:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/encodings quopri_codec.py,NONE,1.1 aliases.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv24062 Modified Files: aliases.py Added Files: quopri_codec.py Log Message: Add quoted-printable codec --- NEW FILE: quopri_codec.py --- """Codec for quoted-printable encoding. Like base64 and rot13, this returns Python strings, not Unicode. """ import codecs, quopri try: from cStringIO import StringIO except ImportError: from StringIO import StringIO def quopri_encode(input, errors='strict'): """Encode the input, returning a tuple (output object, length consumed). errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec. """ assert errors == 'strict' f = StringIO(input) g = StringIO() quopri.encode(f, g, 1) output = g.getvalue() return (output, len(input)) def quopri_decode(input, errors='strict'): """Decode the input, returning a tuple (output object, length consumed). errors defines the error handling to apply. It defaults to 'strict' handling which is the only currently supported error handling for this codec. """ assert errors == 'strict' f = StringIO(input) g = StringIO() quopri.decode(f, g) output = g.getvalue() return (output, len(input)) class Codec(codecs.Codec): encode = quopri_encode decode = quopri_decode class StreamWriter(Codec, codecs.StreamWriter): pass class StreamReader(Codec,codecs.StreamReader): pass # encodings module API def getregentry(): return (quopri_encode, quopri_decode, StreamReader, StreamWriter) Index: aliases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/aliases.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** aliases.py 2001/05/15 11:58:05 1.5 --- aliases.py 2001/05/15 15:34:07 1.6 *************** *** 88,91 **** --- 88,94 ---- 'hex': 'hex_codec', 'uu': 'uu_codec', + 'quopri': 'quopri_codec', + 'quotedprintable': 'quopri_codec', + 'quoted_printable': 'quopri_codec', } From gvanrossum@users.sourceforge.net Tue May 15 17:31:37 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 15 May 2001 09:31:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.21,2.16.8.22 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4414/Objects Modified Files: Tag: descr-branch typeobject.c Log Message: Get rid of the extra metatypes DynamicType_Type and Turtle_Type. These are now folded into the original Type_Type. A separate flag (Py_TPFLAGS_HEAPTYPE) is set in type objects allocated on the heap; if type_dealloc() is called for a type that doesn't have this flag set, something's wrong! Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.21 retrieving revision 2.16.8.22 diff -C2 -r2.16.8.21 -r2.16.8.22 *** typeobject.c 2001/05/12 20:58:24 2.16.8.21 --- typeobject.c 2001/05/15 16:31:35 2.16.8.22 *************** *** 80,90 **** res = (type->tp_construct)(obj, args, kwds); ! if (res != obj) { Py_DECREF(obj); ! if (res == NULL) ! return NULL; } if (PyType_IS_GC(type)) PyObject_GC_Init(res); return res; } --- 80,105 ---- res = (type->tp_construct)(obj, args, kwds); ! if (res == NULL) { Py_DECREF(obj); ! return NULL; } if (PyType_IS_GC(type)) PyObject_GC_Init(res); + if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { + PyObject *init, *dummy; + + init = PyObject_GetAttrString(res, "__init__"); + if (init == NULL) { + PyErr_Clear(); + return res; + } + dummy = PyObject_Call(init, args, kwds); + Py_DECREF(init); + if (dummy == NULL) { + Py_DECREF(obj); + return NULL; + } + Py_DECREF(dummy); + } return res; } *************** *** 120,123 **** --- 135,141 ---- destructor f; + /* XXX Alternatively, we could call tp_clear to clear the object; + but this is not guaranteed to delete all pointers, just likely. */ + base = self->ob_type->tp_base; while ((f = base->tp_dealloc) == subtype_dealloc) *************** *** 159,167 **** /* Check arguments */ - if (type != NULL) { - PyErr_SetString(PyExc_TypeError, - "can't construct a preallocated type"); - return NULL; - } if (!PyArg_ParseTupleAndKeywords(args, kwds, "SOO", &dummy, &name, &bases, &dict)) --- 177,180 ---- *************** *** 222,231 **** /* Allocate memory and construct a type object in it */ allocsize = sizeof(etype) + nslots*sizeof(struct memberlist); ! et = PyObject_MALLOC(allocsize); ! if (et == NULL) ! return NULL; ! memset(et, '\0', allocsize); ! type = &et->type; ! PyObject_INIT(type, &PyDynamicType_Type); Py_INCREF(name); et->name = name; --- 235,258 ---- /* Allocate memory and construct a type object in it */ allocsize = sizeof(etype) + nslots*sizeof(struct memberlist); ! if (type == NULL) { ! et = PyObject_MALLOC(allocsize); ! if (et == NULL) ! return NULL; ! memset(et, '\0', allocsize); ! type = &et->type; ! PyObject_INIT(type, &PyType_Type); ! } ! else { ! if (type->ob_type->tp_basicsize < allocsize) { ! PyErr_Format( ! PyExc_SystemError, ! "insufficient allocated memory for subtype: " ! "allocated %d, needed %d", ! type->ob_type->tp_basicsize, ! allocsize); ! return NULL; ! } ! et = (etype *)type; ! } Py_INCREF(name); et->name = name; *************** *** 236,240 **** type->tp_as_buffer = &et->as_buffer; type->tp_name = PyString_AS_STRING(name); ! type->tp_flags = Py_TPFLAGS_DEFAULT; /* Copy slots and dict from the base type */ --- 263,267 ---- type->tp_as_buffer = &et->as_buffer; type->tp_name = PyString_AS_STRING(name); ! type->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE; /* Copy slots and dict from the base type */ *************** *** 294,367 **** } - PyTypeObject PyType_Type = { - PyObject_HEAD_INIT(&PyTurtle_Type) - 0, /* Number of items for varobject */ - "type", /* Name of this type */ - sizeof(PyTypeObject), /* Basic object size */ - 0, /* Item size for varobject */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)type_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)type_call, /* tp_call */ - 0, /* tp_str */ - PyGeneric_GetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - "Define the behavior of a particular type of object.", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - type_members, /* tp_members */ - type_getsets, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - (ternaryfunc)type_construct, /* tp_construct */ - offsetof(PyTypeObject, tp_dict), /* tp_dictoffset */ - }; - - /* Support for dynamic types, created by type_construct() above */ - - static PyObject * - dtype_call(PyTypeObject *type, PyObject *args, PyObject *kwds) - { - PyObject *newobj, *init, *res; - - newobj = type_call(type, args, kwds); - if (newobj == NULL) - return NULL; - init = PyObject_GetAttrString(newobj, "__init__"); - if (init == NULL) { - PyErr_Clear(); - return newobj; - } - res = PyObject_Call(init, args, kwds); - Py_DECREF(init); - if (res == NULL) { - Py_DECREF(newobj); - return NULL; - } - Py_DECREF(res); - return newobj; - } - static void ! dtype_dealloc(PyTypeObject *type) { ! etype *et = (etype *)type; Py_XDECREF(type->tp_base); Py_XDECREF(type->tp_dict); --- 321,333 ---- } static void ! type_dealloc(PyTypeObject *type) { ! etype *et; + /* Assert this is a heap-allocated type object, or uninitialized */ + if (type->tp_flags != 0) + assert(type->tp_flags & Py_TPFLAGS_HEAPTYPE); + et = (etype *)type; Py_XDECREF(type->tp_base); Py_XDECREF(type->tp_dict); *************** *** 371,451 **** } ! PyTypeObject PyDynamicType_Type = { ! PyObject_HEAD_INIT(&PyTurtle_Type) ! 0, /* Number of items for varobject */ ! "dynamic-type", /* Name of this type */ ! sizeof(PyTypeObject), /* Basic object size */ ! 0, /* Item size for varobject */ ! (destructor)dtype_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! (reprfunc)type_repr, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! (ternaryfunc)dtype_call, /* tp_call */ ! 0, /* tp_str */ ! PyGeneric_GetAttr, /* tp_getattro */ ! PyGeneric_SetAttr, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! "Define the behavior of a particular type of object.", /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* tp_methods */ ! type_members, /* tp_members */ ! type_getsets, /* tp_getset */ ! &PyType_Type, /* tp_base */ ! 0, /* tp_dict */ ! 0, /* tp_descr_get */ ! 0, /* tp_descr_set */ ! (ternaryfunc)type_construct, /* tp_construct */ ! offsetof(PyTypeObject, tp_dict), /* tp_dictoffset */ ! }; ! ! ! /* The "turtle" type is named after the expression "turtles all the way down", ! a reference to the fact that it is its own type. We get the progression: ! x => {} # for example ! type(x) => DictType ! type(DictType) => TypeType ! type(TypeType) => TurtleType ! type(TurtleType) => TurtleType ! type(TurtleType) => TurtleType ! type(TurtleType) => TurtleType ! . ! . ! . ! It's from an old story often told about Bertrand Russel, popularized most ! recently by Stephen Hawking; do a Google search for the phrase to find out ! more. The oldest turtle reference in the Python archives seems to be: ! http://mail.python.org/pipermail/types-sig/1998-November/000084.html */ ! ! static PyObject * ! turtle_call(PyTypeObject *metatype, PyObject *args, PyObject *kwds) ! { ! if (metatype->tp_construct == NULL) { ! PyErr_Format(PyExc_TypeError, ! "can't subclass '.%100s' objects yet", ! metatype->tp_name); ! return NULL; ! } ! return (*metatype->tp_construct)(NULL, args, kwds); ! } ! ! PyTypeObject PyTurtle_Type = { ! PyObject_HEAD_INIT(&PyTurtle_Type) 0, /* Number of items for varobject */ ! "turtle", /* Name of this type */ ! sizeof(PyTypeObject), /* Basic object size */ 0, /* Item size for varobject */ ! 0, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ --- 337,347 ---- } ! PyTypeObject PyType_Type = { ! PyObject_HEAD_INIT(&PyType_Type) 0, /* Number of items for varobject */ ! "type", /* Name of this type */ ! sizeof(etype) + sizeof(struct memberlist), /* Basic object size */ 0, /* Item size for varobject */ ! (destructor)type_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ *************** *** 457,461 **** 0, /* tp_as_mapping */ 0, /* tp_hash */ ! (ternaryfunc)turtle_call, /* tp_call */ 0, /* tp_str */ PyGeneric_GetAttr, /* tp_getattro */ --- 353,357 ---- 0, /* tp_as_mapping */ 0, /* tp_hash */ ! (ternaryfunc)type_call, /* tp_call */ 0, /* tp_str */ PyGeneric_GetAttr, /* tp_getattro */ *************** *** 473,481 **** type_members, /* tp_members */ type_getsets, /* tp_getset */ ! &PyType_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! 0, /* tp_construct */ offsetof(PyTypeObject, tp_dict), /* tp_dictoffset */ }; --- 369,377 ---- type_members, /* tp_members */ type_getsets, /* tp_getset */ ! 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ ! (ternaryfunc)type_construct, /* tp_construct */ offsetof(PyTypeObject, tp_dict), /* tp_dictoffset */ }; From tim_one@users.sourceforge.net Tue May 15 18:19:18 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 15 May 2001 10:19:18 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib codecs.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv14574/python/dist/src/Lib Modified Files: codecs.py Log Message: Just changed "x,y" to "x, y" everywhere (i.e., inserted horizontal space after commas that didn't have any). Index: codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** codecs.py 2001/01/20 19:54:20 1.16 --- codecs.py 2001/05/15 17:19:16 1.17 *************** *** 8,12 **** """#" ! import struct,types,__builtin__ ### Registry and builtin stateless codec functions --- 8,12 ---- """#" ! import struct, types, __builtin__ ### Registry and builtin stateless codec functions *************** *** 14,23 **** try: from _codecs import * ! except ImportError,why: raise SystemError,\ 'Failed to load the builtin codecs: %s' % why ! __all__ = ["register","lookup","open","EncodedFile","BOM","BOM_BE", ! "BOM_LE","BOM32_BE","BOM32_LE","BOM64_BE","BOM64_LE"] ### Constants --- 14,23 ---- try: from _codecs import * ! except ImportError, why: raise SystemError,\ 'Failed to load the builtin codecs: %s' % why ! __all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE", ! "BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE"] ### Constants *************** *** 26,30 **** # Byte Order Mark (BOM) and its possible values (BOM_BE, BOM_LE) # ! BOM = struct.pack('=H',0xFEFF) # BOM_BE = BOM32_BE = '\376\377' --- 26,30 ---- # Byte Order Mark (BOM) and its possible values (BOM_BE, BOM_LE) # ! BOM = struct.pack('=H', 0xFEFF) # BOM_BE = BOM32_BE = '\376\377' *************** *** 61,65 **** """ ! def encode(self,input,errors='strict'): """ Encodes the object input and returns a tuple (output --- 61,65 ---- """ ! def encode(self, input, errors='strict'): """ Encodes the object input and returns a tuple (output *************** *** 80,84 **** raise NotImplementedError ! def decode(self,input,errors='strict'): """ Decodes the object input and returns a tuple (output --- 80,84 ---- raise NotImplementedError ! def decode(self, input, errors='strict'): """ Decodes the object input and returns a tuple (output *************** *** 112,116 **** class StreamWriter(Codec): ! def __init__(self,stream,errors='strict'): """ Creates a StreamWriter instance. --- 112,116 ---- class StreamWriter(Codec): ! def __init__(self, stream, errors='strict'): """ Creates a StreamWriter instance. *************** *** 135,139 **** """ Writes the object's contents encoded to self.stream. """ ! data, consumed = self.encode(object,self.errors) self.stream.write(data) --- 135,139 ---- """ Writes the object's contents encoded to self.stream. """ ! data, consumed = self.encode(object, self.errors) self.stream.write(data) *************** *** 157,167 **** pass ! def __getattr__(self,name, ! getattr=getattr): """ Inherit all other methods from the underlying stream. """ ! return getattr(self.stream,name) ### --- 157,166 ---- pass ! def __getattr__(self, name, getattr=getattr): """ Inherit all other methods from the underlying stream. """ ! return getattr(self.stream, name) ### *************** *** 169,173 **** class StreamReader(Codec): ! def __init__(self,stream,errors='strict'): """ Creates a StreamReader instance. --- 168,172 ---- class StreamReader(Codec): ! def __init__(self, stream, errors='strict'): """ Creates a StreamReader instance. *************** *** 219,223 **** try: object, decodedbytes = decode(data, self.errors) ! except ValueError,why: # This method is slow but should work under pretty much # all conditions; at most 10 tries are made --- 218,222 ---- try: object, decodedbytes = decode(data, self.errors) ! except ValueError, why: # This method is slow but should work under pretty much # all conditions; at most 10 tries are made *************** *** 251,255 **** else: line = self.stream.readline(size) ! return self.decode(line,self.errors)[0] --- 250,254 ---- else: line = self.stream.readline(size) ! return self.decode(line, self.errors)[0] *************** *** 270,274 **** else: data = self.stream.read(sizehint) ! return self.decode(data,self.errors)[0].splitlines(1) def reset(self): --- 269,273 ---- else: data = self.stream.read(sizehint) ! return self.decode(data, self.errors)[0].splitlines(1) def reset(self): *************** *** 282,293 **** """ pass - - def __getattr__(self,name, getattr=getattr): """ Inherit all other methods from the underlying stream. """ ! return getattr(self.stream,name) ### --- 281,291 ---- """ pass + def __getattr__(self, name, getattr=getattr): """ Inherit all other methods from the underlying stream. """ ! return getattr(self.stream, name) ### *************** *** 306,310 **** encoding = 'unknown' ! def __init__(self,stream,Reader,Writer,errors='strict'): """ Creates a StreamReaderWriter instance. --- 304,308 ---- encoding = 'unknown' ! def __init__(self, stream, Reader, Writer, errors='strict'): """ Creates a StreamReaderWriter instance. *************** *** 324,328 **** self.errors = errors ! def read(self,size=-1): return self.reader.read(size) --- 322,326 ---- self.errors = errors ! def read(self, size=-1): return self.reader.read(size) *************** *** 336,344 **** return self.reader.readlines(sizehint) ! def write(self,data): return self.writer.write(data) ! def writelines(self,list): return self.writer.writelines(list) --- 334,342 ---- return self.reader.readlines(sizehint) ! def write(self, data): return self.writer.write(data) ! def writelines(self, list): return self.writer.writelines(list) *************** *** 348,359 **** self.reader.reset() self.writer.reset() - - def __getattr__(self,name, getattr=getattr): """ Inherit all other methods from the underlying stream. """ ! return getattr(self.stream,name) ### --- 346,356 ---- self.reader.reset() self.writer.reset() + def __getattr__(self, name, getattr=getattr): """ Inherit all other methods from the underlying stream. """ ! return getattr(self.stream, name) ### *************** *** 380,384 **** file_encoding = 'unknown' ! def __init__(self,stream,encode,decode,Reader,Writer,errors='strict'): """ Creates a StreamRecoder instance which implements a two-way --- 377,382 ---- file_encoding = 'unknown' ! def __init__(self, stream, encode, decode, Reader, Writer, ! errors='strict'): """ Creates a StreamRecoder instance which implements a two-way *************** *** 412,416 **** self.errors = errors ! def read(self,size=-1): data = self.reader.read(size) --- 410,414 ---- self.errors = errors ! def read(self, size=-1): data = self.reader.read(size) *************** *** 418,422 **** return data ! def readline(self,size=None): if size is None: --- 416,420 ---- return data ! def readline(self, size=None): if size is None: *************** *** 427,431 **** return data ! def readlines(self,sizehint=None): if sizehint is None: --- 425,429 ---- return data ! def readlines(self, sizehint=None): if sizehint is None: *************** *** 436,445 **** return data.splitlines(1) ! def write(self,data): data, bytesdecoded = self.decode(data, self.errors) return self.writer.write(data) ! def writelines(self,list): data = ''.join(list) --- 434,443 ---- return data.splitlines(1) ! def write(self, data): data, bytesdecoded = self.decode(data, self.errors) return self.writer.write(data) ! def writelines(self, list): data = ''.join(list) *************** *** 451,462 **** self.reader.reset() self.writer.reset() - - def __getattr__(self,name, getattr=getattr): """ Inherit all other methods from the underlying stream. """ ! return getattr(self.stream,name) ### Shortcuts --- 449,459 ---- self.reader.reset() self.writer.reset() + def __getattr__(self, name, getattr=getattr): """ Inherit all other methods from the underlying stream. """ ! return getattr(self.stream, name) ### Shortcuts *************** *** 500,504 **** if encoding is None: return file ! (e,d,sr,sw) = lookup(encoding) srw = StreamReaderWriter(file, sr, sw, errors) # Add attributes to simplify introspection --- 497,501 ---- if encoding is None: return file ! (e, d, sr, sw) = lookup(encoding) srw = StreamReaderWriter(file, sr, sw, errors) # Add attributes to simplify introspection *************** *** 536,540 **** Reader, Writer = lookup(file_encoding)[2:] sr = StreamRecoder(file, ! encode,decode,Reader,Writer, errors) # Add attributes to simplify introspection --- 533,537 ---- Reader, Writer = lookup(file_encoding)[2:] sr = StreamRecoder(file, ! encode, decode, Reader, Writer, errors) # Add attributes to simplify introspection From mal@lemburg.com Tue May 15 18:57:50 2001 From: mal@lemburg.com (M.-A. Lemburg) Date: Tue, 15 May 2001 19:57:50 +0200 Subject: [Python-checkins] CVS: python/dist/src/Lib codecs.py,1.16,1.17 References: Message-ID: <3B016E1E.DADE9B72@lemburg.com> > Update of /cvsroot/python/python/dist/src/Lib > In directory usw-pr-cvs1:/tmp/cvs-serv14574/python/dist/src/Lib > > Modified Files: > codecs.py > Log Message: > Just changed "x,y" to "x, y" everywhere (i.e., inserted horizontal space > after commas that didn't have any). You must be really in love with whitespace ;-) -- Marc-Andre Lemburg ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.lemburg.com/python/ From lemburg@users.sourceforge.net Tue May 15 19:38:47 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Tue, 15 May 2001 11:38:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.172,1.173 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv31003 Modified Files: NEWS Log Message: Add NEWS item for new string methods. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.172 retrieving revision 1.173 diff -C2 -r1.172 -r1.173 *** NEWS 2001/05/15 02:14:44 1.172 --- NEWS 2001/05/15 18:38:45 1.173 *************** *** 4,7 **** --- 4,32 ---- Core + - Strings now have a new method .decode() to complement the already + existing .encode() method. These two methods provide direct access + to the corresponding decoders and encoders of the registered codecs. + + To enhance the usability of the .encode() method, the special + casing of Unicode object return values was dropped (Unicode objects + were auto-magically converted to string using the default encoding). + + Both methods will now return whatever the codec in charge of the + requested encoding returns as object, e.g. Unicode codecs will + return Unicode objects when decoding is requested ("äöü".decode("latin-1") + will return u"äöü"). This enables codec writer to create codecs + for various simple to use conversions. + + New codecs were added to demonstrate these new features (the .encode() + and .decode() columns indicate the type of the returned objects): + + Name | .encode() | .decode() | Description + ---------------------------------------------------------------------- + uu | string | string | UU codec (e.g. for email) + base64 | string | string | base64 codec + zlib | string | string | zlib compression + hex | string | string | 2-byte hex codec + rot-13 | string | Unicode | ROT-13 Unicode charmap codec + - Some operating systems now support the concept of a default Unicode encoding for file system operations. Notably, Windows supports 'mbcs' From tim@digicool.com Tue May 15 19:56:35 2001 From: tim@digicool.com (Tim Peters) Date: Tue, 15 May 2001 14:56:35 -0400 Subject: [Python-checkins] CVS: python/dist/src/Lib codecs.py,1.16,1.17 In-Reply-To: <3B016E1E.DADE9B72@lemburg.com> Message-ID: > You must be really in love with whitespace ;-) With horizontal whitespace where the style guide says to use it, yes. Perhaps European terminals are twice as tall as they are wide, though . From tim_one@users.sourceforge.net Tue May 15 21:13:01 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 15 May 2001 13:13:01 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects tupleobject.c,2.48,2.49 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv17132/python/dist/src/Objects Modified Files: tupleobject.c Log Message: Speed tuple comparisons in two ways: 1. Omit the early-out EQ/NE "lengths different?" test. Was unable to find any real code where it triggered, but it always costs. The same is not true of list richcmps, where different-size lists appeared to get compared about half the time. 2. Because tuples are immutable, there's no need to refetch the lengths of both tuples from memory again on each loop trip. BUG ALERT: The tuple (and list) richcmp algorithm is arguably wrong, because it won't believe there's any difference unless Py_EQ returns false for some corresponding elements: >>> class C: ... def __lt__(x, y): return 1 ... __eq__ = __lt__ ... >>> C() < C() 1 >>> (C(),) < (C(),) 0 >>> That doesn't make sense -- provided you believe the defn. of C makes sense. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.48 retrieving revision 2.49 diff -C2 -r2.48 -r2.49 *** tupleobject.c 2001/01/18 00:00:53 2.48 --- tupleobject.c 2001/05/15 20:12:59 2.49 *************** *** 377,380 **** --- 377,381 ---- PyTupleObject *vt, *wt; int i; + int vlen, wlen; if (!PyTuple_Check(v) || !PyTuple_Check(w)) { *************** *** 386,402 **** wt = (PyTupleObject *)w; ! if (vt->ob_size != wt->ob_size && (op == Py_EQ || op == Py_NE)) { ! /* Shortcut: if the lengths differ, the tuples differ */ ! PyObject *res; ! if (op == Py_EQ) ! res = Py_False; ! else ! res = Py_True; ! Py_INCREF(res); ! return res; ! } ! /* Search for the first index where items are different */ ! for (i = 0; i < vt->ob_size && i < wt->ob_size; i++) { int k = PyObject_RichCompareBool(vt->ob_item[i], wt->ob_item[i], Py_EQ); --- 387,405 ---- wt = (PyTupleObject *)w; ! vlen = vt->ob_size; ! wlen = wt->ob_size; ! ! /* Note: the corresponding code for lists has an "early out" test ! * here when op is EQ or NE and the lengths differ. That pays there, ! * but Tim was unable to find any real code where EQ/NE tuple ! * compares don't have the same length, so testing for it here would ! * have cost without benefit. ! */ ! /* Search for the first index where items are different. ! * Note that because tuples are immutable, it's safe to reuse ! * vlen and wlen across the comparison calls. ! */ ! for (i = 0; i < vlen && i < wlen; i++) { int k = PyObject_RichCompareBool(vt->ob_item[i], wt->ob_item[i], Py_EQ); *************** *** 407,423 **** } ! if (i >= vt->ob_size || i >= wt->ob_size) { /* No more items to compare -- compare sizes */ - int vs = vt->ob_size; - int ws = wt->ob_size; int cmp; PyObject *res; switch (op) { ! case Py_LT: cmp = vs < ws; break; ! case Py_LE: cmp = ws <= ws; break; ! case Py_EQ: cmp = vs == ws; break; ! case Py_NE: cmp = vs != ws; break; ! case Py_GT: cmp = vs > ws; break; ! case Py_GE: cmp = vs >= ws; break; default: return NULL; /* cannot happen */ } --- 410,424 ---- } ! if (i >= vlen || i >= wlen) { /* No more items to compare -- compare sizes */ int cmp; PyObject *res; switch (op) { ! case Py_LT: cmp = vlen < wlen; break; ! case Py_LE: cmp = vlen <= wlen; break; ! case Py_EQ: cmp = vlen == wlen; break; ! case Py_NE: cmp = vlen != wlen; break; ! case Py_GT: cmp = vlen > wlen; break; ! case Py_GE: cmp = vlen >= wlen; break; default: return NULL; /* cannot happen */ } From jackjansen@users.sourceforge.net Tue May 15 21:22:11 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 15 May 2001 13:22:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/scripts errors.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv20355/Python/Mac/scripts Modified Files: errors.txt Log Message: Bah, somehow the macroman<->iso-latin-1 translation got lost during the merge. Checking in one fixed file to make sure MacCVS Pro isn't the problem. If it isn't a flurry of checkins will follow tomorrow. If it is... well... Index: errors.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/errors.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** errors.txt 2001/03/27 21:28:10 1.6 --- errors.txt 2001/05/15 20:22:08 1.7 *************** *** 317,321 **** -10108 telBadCodeResource code resource not found -10107 telInitFailed initialization failed ! -10106 telNoCommFolder Communications/Extensions Ÿ not found -10103 telUnknownErr unable to set config -10102 telNoSuchTool unable to find tool with name specified --- 317,321 ---- -10108 telBadCodeResource code resource not found -10107 telInitFailed initialization failed ! -10106 telNoCommFolder Communications/Extensions € not found -10103 telUnknownErr unable to set config -10102 telNoSuchTool unable to find tool with name specified *************** *** 627,631 **** -6226 kSysSWTooOld Missing critical pieces of System Software. -6225 kDMMirroringNotOn Returned by all calls that need mirroring to be on to do their thing. ! -6224 kDMCantBlock Mirroring is already on, can¹t Block now (call DMUnMirror() first). -6223 kDMMirroringBlocked DMBlockMirroring() has been called. -6222 kDMWrongNumberOfDisplays Can only handle 2 displays for now. --- 627,631 ---- -6226 kSysSWTooOld Missing critical pieces of System Software. -6225 kDMMirroringNotOn Returned by all calls that need mirroring to be on to do their thing. ! -6224 kDMCantBlock Mirroring is already on, canÕt Block now (call DMUnMirror() first). -6223 kDMMirroringBlocked DMBlockMirroring() has been called. -6222 kDMWrongNumberOfDisplays Can only handle 2 displays for now. *************** *** 654,658 **** -5604 errWindowPropertyNotFound tried to get a nonexistent property -5603 errInvalidWindowProperty tried to access a property tag with private creator ! -5602 errWindowDoesNotHaveProxy tried to do something requiring a proxy to a window which doesn¹t have a proxy -5601 errUnsupportedWindowAttributesForClass tried to create a window with WindowAttributes not supported by the WindowClass -5600 errInvalidWindowPtr tried to pass a bad WindowRef argument --- 654,658 ---- -5604 errWindowPropertyNotFound tried to get a nonexistent property -5603 errInvalidWindowProperty tried to access a property tag with private creator ! -5602 errWindowDoesNotHaveProxy tried to do something requiring a proxy to a window which doesnÕt have a proxy -5601 errUnsupportedWindowAttributesForClass tried to create a window with WindowAttributes not supported by the WindowClass -5600 errInvalidWindowPtr tried to pass a bad WindowRef argument *************** *** 848,852 **** -3271 kENOSRErr -3270 kETIMEErr ! -3269 kEPROTOErr €€€ fill out missing codes €€€ -3264 kEHOSTUNREACHErr No route to host -3263 kEHOSTDOWNErr Host is down --- 848,852 ---- -3271 kENOSRErr -3270 kETIMEErr ! -3269 kEPROTOErr ‚‚‚ fill out missing codes ‚‚‚ -3264 kEHOSTUNREACHErr No route to host -3263 kEHOSTDOWNErr Host is down *************** *** 1044,1048 **** -2511 tsmDocumentOpenErr there are open documents -2510 tsmTextServiceNotFoundErr no text service found ! -2509 tsmCantOpenComponentErr can¹t open the component -2508 tsmNoOpenTSErr no open text service -2507 tsmDocNotActiveErr document is NOT active --- 1044,1048 ---- -2511 tsmDocumentOpenErr there are open documents -2510 tsmTextServiceNotFoundErr no text service found ! -2509 tsmCantOpenComponentErr canÕt open the component -2508 tsmNoOpenTSErr no open text service -2507 tsmDocNotActiveErr document is NOT active *************** *** 1077,1083 **** -2401 kernelIncompleteErr kernelIncompleteErr -2209 badCallOrderErr Usually due to a status call being called prior to being setup first ! -2208 noDMAErr Can¹t do DMA digitizing (i.e. can't go to requested dest ! -2207 badDepthErr Can¹t digitize into this depth ! -2206 notExactSizeErr Can¹t do exact size requested -2205 noMoreKeyColorsErr all key indexes in use -2204 notExactMatrixErr warning of bad matrix, digitizer did its best --- 1077,1083 ---- -2401 kernelIncompleteErr kernelIncompleteErr -2209 badCallOrderErr Usually due to a status call being called prior to being setup first ! -2208 noDMAErr CanÕt do DMA digitizing (i.e. can't go to requested dest ! -2207 badDepthErr CanÕt digitize into this depth ! -2206 notExactSizeErr CanÕt do exact size requested -2205 noMoreKeyColorsErr all key indexes in use -2204 notExactMatrixErr warning of bad matrix, digitizer did its best *************** *** 1429,1433 **** -626 noMMUErr no MMU present -625 cannotDeferErr unable to defer additional functions ! -624 interruptsMaskedErr don¹t call with interrupts masked -623 notLockedErr specified range of memory is not locked -622 cannotMakeContiguousErr cannot make specified range contiguous --- 1429,1433 ---- -626 noMMUErr no MMU present -625 cannotDeferErr unable to defer additional functions ! -624 interruptsMaskedErr donÕt call with interrupts masked -623 notLockedErr specified range of memory is not locked -622 cannotMakeContiguousErr cannot make specified range contiguous *************** *** 1709,1716 **** -18 statusErr I/O System Errors -17 controlErr I/O System Errors ! -13 dsExtensionsDisabled say ³Extensions Disabled² ! -12 dsHD20Installed say ³HD20 Startup² ! -11 dsDisassemblerInstalled say ³Disassembler Installed² ! -10 dsMacsBugInstalled say ³MacsBug Installed² -8 seNoDB no debugger installed to handle debugger command -5 SlpTypeErr invalid queue element --- 1709,1716 ---- -18 statusErr I/O System Errors -17 controlErr I/O System Errors ! -13 dsExtensionsDisabled say –Extensions Disabled” ! -12 dsHD20Installed say –HD20 Startup” ! -11 dsDisassemblerInstalled say –Disassembler Installed” ! -10 dsMacsBugInstalled say –MacsBug Installed” -8 seNoDB no debugger installed to handle debugger command -5 SlpTypeErr invalid queue element From lemburg@users.sourceforge.net Wed May 16 10:41:47 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Wed, 16 May 2001 02:41:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib codecs.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv23495/Lib Modified Files: codecs.py Log Message: Moved the encoding map building logic from the individual mapping codec files to codecs.py and added logic so that multi mappings in the decoding maps now result in mappings to None (undefined mapping) in the encoding maps. Index: codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** codecs.py 2001/05/15 17:19:16 1.17 --- codecs.py 2001/05/16 09:41:45 1.18 *************** *** 555,558 **** --- 555,579 ---- return res + def make_encoding_map(decoding_map): + + """ Creates an encoding map from a decoding map. + + If a target mapping in the decoding map occurrs multiple + times, then that target is mapped to None (undefined mapping), + causing an exception when encountered by the charmap codec + during translation. + + One example where this happens is cp875.py which decodes + multiple character to \u001a. + + """ + m = {} + for k,v in decoding_map.items(): + if not m.has_key(v): + m[v] = k + else: + m[v] = None + return m + ### Tests From lemburg@users.sourceforge.net Wed May 16 10:41:47 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Wed, 16 May 2001 02:41:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/scripts gencodec.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory usw-pr-cvs1:/tmp/cvs-serv23495/Tools/scripts Modified Files: gencodec.py Log Message: Moved the encoding map building logic from the individual mapping codec files to codecs.py and added logic so that multi mappings in the decoding maps now result in mappings to None (undefined mapping) in the encoding maps. Index: gencodec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/gencodec.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** gencodec.py 2001/01/17 08:48:39 1.5 --- gencodec.py 2001/05/16 09:41:45 1.6 *************** *** 245,251 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k ''') return string.join(l,'\n') --- 245,249 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) ''') return string.join(l,'\n') From lemburg@users.sourceforge.net Wed May 16 10:41:48 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Wed, 16 May 2001 02:41:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/encodings cp037.py,1.2,1.3 cp1006.py,1.2,1.3 cp1026.py,1.2,1.3 cp1250.py,1.2,1.3 cp1251.py,1.2,1.3 cp1252.py,1.2,1.3 cp1253.py,1.2,1.3 cp1254.py,1.2,1.3 cp1255.py,1.2,1.3 cp1256.py,1.2,1.3 cp1257.py,1.2,1.3 cp1258.py,1.2,1.3 cp424.py,1.2,1.3 cp437.py,1.2,1.3 cp500.py,1.2,1.3 cp737.py,1.2,1.3 cp775.py,1.2,1.3 cp850.py,1.2,1.3 cp852.py,1.2,1.3 cp855.py,1.2,1.3 cp856.py,1.3,1.4 cp857.py,1.2,1.3 cp860.py,1.2,1.3 cp861.py,1.2,1.3 cp862.py,1.2,1.3 cp863.py,1.2,1.3 cp864.py,1.2,1.3 cp865.py,1.2,1.3 cp866.py,1.2,1.3 cp869.py,1.2,1.3 cp874.py,1.2,1.3 cp875.py,1.2,1.3 iso8859_1.py,1.2,1.3 iso8859_10.py,1.2,1.3 iso8859_13.py,1.2,1.3 iso8859_14.py,1.2,1.3 iso8859_15.py,1.2,1.3 iso8859_2.py,1.2,1.3 iso8859_3.py,1.2,1.3 iso8859_4.py,1.2,1.3 iso8859_5.py,1.2,1.3 iso8859_6.py,1.2,1.3 iso8859_7.py,1.2,1.3 iso8859_8.py,1.2,1.3 iso8859_9.py,1.2,1.3 koi8_r.py,1.2,1.3 mac_cyrillic.py,1.2,1.3 mac_greek.py,1.2,1.3 mac_iceland.py,1.2,1.3 mac_latin2.py,1.2,1.3 mac_roman.py,1.2,1.3 mac_turkish.py,1.2,1.3 rot_13.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory usw-pr-cvs1:/tmp/cvs-serv23495/Lib/encodings Modified Files: cp037.py cp1006.py cp1026.py cp1250.py cp1251.py cp1252.py cp1253.py cp1254.py cp1255.py cp1256.py cp1257.py cp1258.py cp424.py cp437.py cp500.py cp737.py cp775.py cp850.py cp852.py cp855.py cp856.py cp857.py cp860.py cp861.py cp862.py cp863.py cp864.py cp865.py cp866.py cp869.py cp874.py cp875.py iso8859_1.py iso8859_10.py iso8859_13.py iso8859_14.py iso8859_15.py iso8859_2.py iso8859_3.py iso8859_4.py iso8859_5.py iso8859_6.py iso8859_7.py iso8859_8.py iso8859_9.py koi8_r.py mac_cyrillic.py mac_greek.py mac_iceland.py mac_latin2.py mac_roman.py mac_turkish.py rot_13.py Log Message: Moved the encoding map building logic from the individual mapping codec files to codecs.py and added logic so that multi mappings in the decoding maps now result in mappings to None (undefined mapping) in the encoding maps. Index: cp037.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp037.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp037.py 2001/01/03 21:29:13 1.2 --- cp037.py 2001/05/16 09:41:45 1.3 *************** *** 278,282 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 278,280 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp1006.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1006.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp1006.py 2001/01/03 21:29:13 1.2 --- cp1006.py 2001/05/16 09:41:45 1.3 *************** *** 136,140 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 136,138 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp1026.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1026.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp1026.py 2001/01/03 21:29:13 1.2 --- cp1026.py 2001/05/16 09:41:45 1.3 *************** *** 278,282 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 278,280 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp1250.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1250.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp1250.py 2001/01/03 21:29:13 1.2 --- cp1250.py 2001/05/16 09:41:45 1.3 *************** *** 121,125 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 121,123 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp1251.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1251.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp1251.py 2001/01/03 21:29:13 1.2 --- cp1251.py 2001/05/16 09:41:45 1.3 *************** *** 155,159 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 155,157 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp1252.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1252.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp1252.py 2001/01/03 21:29:13 1.2 --- cp1252.py 2001/05/16 09:41:45 1.3 *************** *** 74,78 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 74,76 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp1253.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1253.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp1253.py 2001/01/03 21:29:13 1.2 --- cp1253.py 2001/05/16 09:41:45 1.3 *************** *** 149,153 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 149,151 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp1254.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1254.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp1254.py 2001/01/03 21:29:13 1.2 --- cp1254.py 2001/05/16 09:41:45 1.3 *************** *** 80,84 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 80,82 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp1255.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1255.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp1255.py 2001/01/03 21:29:13 1.2 --- cp1255.py 2001/05/16 09:41:45 1.3 *************** *** 141,145 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 141,143 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp1256.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1256.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp1256.py 2001/01/03 21:29:13 1.2 --- cp1256.py 2001/05/16 09:41:45 1.3 *************** *** 127,131 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 127,129 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp1257.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1257.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp1257.py 2001/01/03 21:29:13 1.2 --- cp1257.py 2001/05/16 09:41:45 1.3 *************** *** 129,133 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 129,131 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp1258.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp1258.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp1258.py 2001/01/03 21:29:13 1.2 --- cp1258.py 2001/05/16 09:41:45 1.3 *************** *** 88,92 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 88,90 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp424.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp424.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp424.py 2001/01/03 21:29:13 1.2 --- cp424.py 2001/05/16 09:41:45 1.3 *************** *** 278,282 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 278,280 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp437.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp437.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp437.py 2001/01/03 21:29:13 1.2 --- cp437.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp500.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp500.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp500.py 2001/01/03 21:29:13 1.2 --- cp500.py 2001/05/16 09:41:45 1.3 *************** *** 278,282 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 278,280 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp737.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp737.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp737.py 2001/01/03 21:29:13 1.2 --- cp737.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp775.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp775.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp775.py 2001/01/03 21:29:13 1.2 --- cp775.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp850.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp850.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp850.py 2001/01/03 21:29:13 1.2 --- cp850.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp852.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp852.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp852.py 2001/01/03 21:29:13 1.2 --- cp852.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp855.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp855.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp855.py 2001/01/03 21:29:13 1.2 --- cp855.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp856.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp856.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** cp856.py 2001/01/03 21:29:13 1.3 --- cp856.py 2001/05/16 09:41:45 1.4 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp857.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp857.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp857.py 2001/01/03 21:29:13 1.2 --- cp857.py 2001/05/16 09:41:45 1.3 *************** *** 169,173 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 169,171 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp860.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp860.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp860.py 2001/01/03 21:29:13 1.2 --- cp860.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp861.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp861.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp861.py 2001/01/03 21:29:13 1.2 --- cp861.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp862.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp862.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp862.py 2001/01/03 21:29:13 1.2 --- cp862.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp863.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp863.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp863.py 2001/01/03 21:29:13 1.2 --- cp863.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp864.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp864.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp864.py 2001/01/03 21:29:13 1.2 --- cp864.py 2001/05/16 09:41:45 1.3 *************** *** 168,172 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 168,170 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp865.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp865.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp865.py 2001/01/03 21:29:13 1.2 --- cp865.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp866.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp866.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp866.py 2001/01/03 21:29:13 1.2 --- cp866.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp869.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp869.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp869.py 2001/01/03 21:29:13 1.2 --- cp869.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp874.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp874.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp874.py 2001/01/03 21:29:13 1.2 --- cp874.py 2001/05/16 09:41:45 1.3 *************** *** 169,173 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 169,171 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: cp875.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/cp875.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cp875.py 2001/01/03 21:29:13 1.2 --- cp875.py 2001/05/16 09:41:45 1.3 *************** *** 279,283 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 279,281 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_1.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_1.py 2001/01/03 21:29:13 1.2 --- iso8859_1.py 2001/05/16 09:41:45 1.3 *************** *** 42,46 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 42,44 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_10.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_10.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_10.py 2001/01/03 21:29:13 1.2 --- iso8859_10.py 2001/05/16 09:41:45 1.3 *************** *** 88,92 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 88,90 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_13.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_13.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_13.py 2001/01/03 21:29:13 1.2 --- iso8859_13.py 2001/05/16 09:41:45 1.3 *************** *** 98,102 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 98,100 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_14.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_14.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_14.py 2001/01/03 21:29:13 1.2 --- iso8859_14.py 2001/05/16 09:41:45 1.3 *************** *** 73,77 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 73,75 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_15.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_15.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_15.py 2001/01/03 21:29:13 1.2 --- iso8859_15.py 2001/05/16 09:41:45 1.3 *************** *** 50,54 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 50,52 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_2.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_2.py 2001/01/03 21:29:13 1.2 --- iso8859_2.py 2001/05/16 09:41:45 1.3 *************** *** 99,103 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 99,101 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_3.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_3.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_3.py 2001/01/03 21:29:13 1.2 --- iso8859_3.py 2001/05/16 09:41:45 1.3 *************** *** 77,81 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 77,79 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_4.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_4.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_4.py 2001/01/03 21:29:13 1.2 --- iso8859_4.py 2001/05/16 09:41:45 1.3 *************** *** 92,96 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 92,94 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_5.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_5.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_5.py 2001/01/03 21:29:13 1.2 --- iso8859_5.py 2001/05/16 09:41:45 1.3 *************** *** 136,140 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 136,138 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_6.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_6.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_6.py 2001/01/03 21:29:13 1.2 --- iso8859_6.py 2001/05/16 09:41:45 1.3 *************** *** 135,139 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 135,137 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_7.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_7.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_7.py 2001/01/03 21:29:13 1.2 --- iso8859_7.py 2001/05/16 09:41:45 1.3 *************** *** 122,126 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 122,124 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_8.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_8.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_8.py 2001/01/03 21:29:13 1.2 --- iso8859_8.py 2001/05/16 09:41:45 1.3 *************** *** 110,114 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 110,112 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: iso8859_9.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/iso8859_9.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** iso8859_9.py 2001/01/03 21:29:13 1.2 --- iso8859_9.py 2001/05/16 09:41:45 1.3 *************** *** 48,52 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 48,50 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: koi8_r.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/koi8_r.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** koi8_r.py 2001/01/03 21:29:13 1.2 --- koi8_r.py 2001/05/16 09:41:45 1.3 *************** *** 170,174 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 170,172 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: mac_cyrillic.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_cyrillic.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mac_cyrillic.py 2001/01/03 21:29:13 1.2 --- mac_cyrillic.py 2001/05/16 09:41:45 1.3 *************** *** 165,169 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 165,167 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: mac_greek.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_greek.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mac_greek.py 2001/01/03 21:29:13 1.2 --- mac_greek.py 2001/05/16 09:41:45 1.3 *************** *** 168,172 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 168,170 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: mac_iceland.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_iceland.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mac_iceland.py 2001/01/03 21:29:13 1.2 --- mac_iceland.py 2001/05/16 09:41:45 1.3 *************** *** 164,168 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 164,166 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: mac_latin2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_latin2.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mac_latin2.py 2001/01/03 21:29:13 1.2 --- mac_latin2.py 2001/05/16 09:41:45 1.3 *************** *** 168,172 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 168,170 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: mac_roman.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_roman.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mac_roman.py 2001/01/03 21:29:13 1.2 --- mac_roman.py 2001/05/16 09:41:45 1.3 *************** *** 165,169 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 165,167 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: mac_turkish.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/mac_turkish.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mac_turkish.py 2001/01/03 21:29:13 1.2 --- mac_turkish.py 2001/05/16 09:41:45 1.3 *************** *** 165,169 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k --- 165,167 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) Index: rot_13.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/rot_13.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** rot_13.py 2001/05/15 12:00:02 1.1 --- rot_13.py 2001/05/16 09:41:45 1.2 *************** *** 94,100 **** ### Encoding Map ! encoding_map = {} ! for k,v in decoding_map.items(): ! encoding_map[v] = k ### Filter API --- 94,98 ---- ### Encoding Map ! encoding_map = codecs.make_encoding_map(decoding_map) ### Filter API From jackjansen@users.sourceforge.net Thu May 17 13:34:50 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:34:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE Wwindows.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv25747/Python/Mac/Tools/IDE Modified Files: Wwindows.py Log Message: Fixed macroman<->latin1 conversion. Some characters don't exist in latin1, but at least the roundtrip gives the correct macroman characters again. Index: Wwindows.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wwindows.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** Wwindows.py 2001/01/23 14:58:20 1.8 --- Wwindows.py 2001/05/17 12:34:48 1.9 *************** *** 569,573 **** import EasyDialogs if EasyDialogs.AskYesNoCancel( ! "Can¹t find window or widget to insert text into; copy to clipboard instead?", 1) == 1: import Scrap --- 569,573 ---- import EasyDialogs if EasyDialogs.AskYesNoCancel( ! "CanÕt find window or widget to insert text into; copy to clipboard instead?", 1) == 1: import Scrap From jackjansen@users.sourceforge.net Thu May 17 13:34:54 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:34:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE Wtraceback.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv25764/Python/Mac/Tools/IDE Modified Files: Wtraceback.py Log Message: Fixed macroman<->latin1 conversion. Some characters don't exist in latin1, but at least the roundtrip gives the correct macroman characters again. Index: Wtraceback.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wtraceback.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Wtraceback.py 2000/04/09 19:45:38 1.3 --- Wtraceback.py 2001/05/17 12:34:52 1.4 *************** *** 58,62 **** if lineno: charno = charno - 1 ! text = str(value) + '\rFile: "' + str(filename) + '", line ' + str(lineno) + '\r\r' + line[:charno] + "€" + line[charno:-1] else: text = str(value) + '\rFile: "' + str(filename) + '"' --- 58,62 ---- if lineno: charno = charno - 1 ! text = str(value) + '\rFile: "' + str(filename) + '", line ' + str(lineno) + '\r\r' + line[:charno] + "‚" + line[charno:-1] else: text = str(value) + '\rFile: "' + str(filename) + '"' *************** *** 124,131 **** self.w.editbutton.enable(0) ! self.w.browselocalsbutton = W.Button((80, -30, 100, 16), "Browse localsŠ", self.browselocals) self.w.browselocalsbutton.enable(0) ! self.w.postmortembutton = W.Button((190, -30, 100, 16), "Post mortemŠ", self.postmortem) self.w.setdefaultbutton(self.w.editbutton) --- 124,131 ---- self.w.editbutton.enable(0) ! self.w.browselocalsbutton = W.Button((80, -30, 100, 16), "Browse localsƒ", self.browselocals) self.w.browselocalsbutton.enable(0) ! self.w.postmortembutton = W.Button((190, -30, 100, 16), "Post mortemƒ", self.postmortem) self.w.setdefaultbutton(self.w.editbutton) From jackjansen@users.sourceforge.net Thu May 17 13:34:58 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:34:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE Wtext.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv25785/Python/Mac/Tools/IDE Modified Files: Wtext.py Log Message: Fixed macroman<->latin1 conversion. Some characters don't exist in latin1, but at least the roundtrip gives the correct macroman characters again. Index: Wtext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wtext.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** Wtext.py 2001/02/21 15:45:55 1.8 --- Wtext.py 2001/05/17 12:34:56 1.9 *************** *** 872,876 **** if not __debug__: import W ! raise W.AlertError, "Can¹t debug in ³Optimize bytecode² mode.\r(see ³Default startup options² in EditPythonPreferences)" import PyDebugger self._debugger = PyDebugger.getdebugger() --- 872,876 ---- if not __debug__: import W ! raise W.AlertError, "CanÕt debug in –Optimize bytecode” mode.\r(see –Default startup options” in EditPythonPreferences)" import PyDebugger self._debugger = PyDebugger.getdebugger() From jackjansen@users.sourceforge.net Thu May 17 13:35:07 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:35:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE Splash.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv25862/Python/Mac/Tools/IDE Modified Files: Splash.py Log Message: Fixed macroman<->latin1 conversion. Some characters don't exist in latin1, but at least the roundtrip gives the correct macroman characters again. Index: Splash.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Splash.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** Splash.py 2001/03/15 14:35:33 1.10 --- Splash.py 2001/05/17 12:35:05 1.11 *************** *** 72,76 **** _keepsplashscreenopen = 0 ! abouttext1 = """The Python Integrated Development Environment for the Macintosh Version: %s Copyright 1997-2000 Just van Rossum, Letterror. --- 72,76 ---- _keepsplashscreenopen = 0 ! abouttext1 = """The Python Integrated Development Environment for the MacintoshŽ Version: %s Copyright 1997-2000 Just van Rossum, Letterror. *************** *** 80,88 **** flauwekul = [ 'Goodday, Bruce.', ! 'What¹s new?', 'Nudge, nudge, say no more!', ! 'No, no sir, it¹s not dead. It¹s resting.', 'Albatros!', ! 'It¹s . . .', 'Is your name not Bruce, then?', """But Mr F.G. Superman has a secret identity . . . --- 80,88 ---- flauwekul = [ 'Goodday, Bruce.', ! 'WhatÕs new?', 'Nudge, nudge, say no more!', ! 'No, no sir, itÕs not dead. ItÕs resting.', 'Albatros!', ! 'ItÕs . . .', 'Is your name not Bruce, then?', """But Mr F.G. Superman has a secret identity . . . From jackjansen@users.sourceforge.net Thu May 17 13:35:15 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:35:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE PyDocSearch.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv25905/Python/Mac/Tools/IDE Modified Files: PyDocSearch.py Log Message: Fixed macroman<->latin1 conversion. Some characters don't exist in latin1, but at least the roundtrip gives the correct macroman characters again. Index: PyDocSearch.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyDocSearch.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** PyDocSearch.py 2001/02/21 13:54:31 1.3 --- PyDocSearch.py 2001/05/17 12:35:13 1.4 *************** *** 102,106 **** def __init__(self): ! self.w = W.Dialog((440, 64), "SearchingŠ") self.w.searching = W.TextBox((4, 4, -4, 16), "DevDev:PyPyDoc 1.5.1:ext:parseTupleAndKeywords.html") self.w.hits = W.TextBox((4, 24, -4, 16), "Hits: 0") --- 102,106 ---- def __init__(self): ! self.w = W.Dialog((440, 64), "Searchingƒ") self.w.searching = W.TextBox((4, 4, -4, 16), "DevDev:PyPyDoc 1.5.1:ext:parseTupleAndKeywords.html") self.w.hits = W.TextBox((4, 24, -4, 16), "Hits: 0") From jackjansen@users.sourceforge.net Thu May 17 13:35:03 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:35:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE Wapplication.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv25803/Python/Mac/Tools/IDE Modified Files: Wapplication.py Log Message: Fixed macroman<->latin1 conversion. Some characters don't exist in latin1, but at least the roundtrip gives the correct macroman characters again. Index: Wapplication.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wapplication.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** Wapplication.py 2001/03/08 23:10:20 1.9 --- Wapplication.py 2001/05/17 12:35:01 1.10 *************** *** 345,352 **** f, filename, (suff, mode, dummy) = imp.find_module(modname) except ImportError: ! raise W.AlertError, "Can¹t find file for ³%s²" % modname else: if not f: ! raise W.AlertError, "Can¹t find file for ³%s²" % modname f.close() if suff == '.py': --- 345,352 ---- f, filename, (suff, mode, dummy) = imp.find_module(modname) except ImportError: ! raise W.AlertError, "CanÕt find file for –%s”" % modname else: if not f: ! raise W.AlertError, "CanÕt find file for –%s”" % modname f.close() if suff == '.py': *************** *** 354,360 **** return else: ! raise W.AlertError, "Can¹t find file for ³%s²" % modname else: ! raise W.AlertError, "Can¹t find file Œ%s¹" % filename if lineno is not None: editor.selectline(lineno, charoffset) --- 354,360 ---- return else: ! raise W.AlertError, "CanÕt find file for –%s”" % modname else: ! raise W.AlertError, "CanÕt find file •%sÕ" % filename if lineno is not None: editor.selectline(lineno, charoffset) From jackjansen@users.sourceforge.net Thu May 17 13:35:11 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:35:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE PythonIDEMain.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv25883/Python/Mac/Tools/IDE Modified Files: PythonIDEMain.py Log Message: Fixed macroman<->latin1 conversion. Some characters don't exist in latin1, but at least the roundtrip gives the correct macroman characters again. Index: PythonIDEMain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** PythonIDEMain.py 2001/03/08 23:09:32 1.10 --- PythonIDEMain.py 2001/05/17 12:35:09 1.11 *************** *** 51,61 **** m = Wapplication.Menu(self.menubar, "File") newitem = FrameWork.MenuItem(m, "New", "N", 'new') ! openitem = FrameWork.MenuItem(m, "OpenŠ", "O", 'open') FrameWork.Separator(m) closeitem = FrameWork.MenuItem(m, "Close", "W", 'close') saveitem = FrameWork.MenuItem(m, "Save", "S", 'save') ! saveasitem = FrameWork.MenuItem(m, "Save asŠ", None, 'save_as') FrameWork.Separator(m) ! saveasappletitem = FrameWork.MenuItem(m, "Save as AppletŠ", None, 'save_as_applet') FrameWork.Separator(m) quititem = FrameWork.MenuItem(m, "Quit", "Q", 'quit') --- 51,61 ---- m = Wapplication.Menu(self.menubar, "File") newitem = FrameWork.MenuItem(m, "New", "N", 'new') ! openitem = FrameWork.MenuItem(m, "Openƒ", "O", 'open') FrameWork.Separator(m) closeitem = FrameWork.MenuItem(m, "Close", "W", 'close') saveitem = FrameWork.MenuItem(m, "Save", "S", 'save') ! saveasitem = FrameWork.MenuItem(m, "Save asƒ", None, 'save_as') FrameWork.Separator(m) ! saveasappletitem = FrameWork.MenuItem(m, "Save as Appletƒ", None, 'save_as_applet') FrameWork.Separator(m) quititem = FrameWork.MenuItem(m, "Quit", "Q", 'quit') *************** *** 72,76 **** sellineitem = FrameWork.MenuItem(m, "Select line", "L", "selectline") FrameWork.Separator(m) ! finditem = FrameWork.MenuItem(m, "FindŠ", "F", "find") findagainitem = FrameWork.MenuItem(m, "Find again", 'G', "findnext") enterselitem = FrameWork.MenuItem(m, "Enter search string", "E", "entersearchstring") --- 72,76 ---- sellineitem = FrameWork.MenuItem(m, "Select line", "L", "selectline") FrameWork.Separator(m) ! finditem = FrameWork.MenuItem(m, "Findƒ", "F", "find") findagainitem = FrameWork.MenuItem(m, "Find again", 'G', "findnext") enterselitem = FrameWork.MenuItem(m, "Enter search string", "E", "entersearchstring") *************** *** 85,94 **** runselitem = FrameWork.MenuItem(m, "Run selection", None, 'runselection') FrameWork.Separator(m) ! moditem = FrameWork.MenuItem(m, "Module browserŠ", "M", self.domenu_modulebrowser) FrameWork.Separator(m) mm = FrameWork.SubMenu(m, "Preferences") ! FrameWork.MenuItem(mm, "Set Scripts folderŠ", None, self.do_setscriptsfolder) ! FrameWork.MenuItem(mm, "Editor default settingsŠ", None, self.do_editorprefs) ! FrameWork.MenuItem(mm, "Set default window fontŠ", None, self.do_setwindowfont) self.openwindowsmenu = Wapplication.Menu(self.menubar, 'Windows') --- 85,94 ---- runselitem = FrameWork.MenuItem(m, "Run selection", None, 'runselection') FrameWork.Separator(m) ! moditem = FrameWork.MenuItem(m, "Module browserƒ", "M", self.domenu_modulebrowser) FrameWork.Separator(m) mm = FrameWork.SubMenu(m, "Preferences") ! FrameWork.MenuItem(mm, "Set Scripts folderƒ", None, self.do_setscriptsfolder) ! FrameWork.MenuItem(mm, "Editor default settingsƒ", None, self.do_editorprefs) ! FrameWork.MenuItem(mm, "Set default window fontƒ", None, self.do_setwindowfont) self.openwindowsmenu = Wapplication.Menu(self.menubar, 'Windows') *************** *** 111,115 **** if not os.path.exists(path): os.mkdir(path) ! f = open(os.path.join(path, "Place your scripts hereŠ"), "w") f.close() fss = macfs.FSSpec(path) --- 111,115 ---- if not os.path.exists(path): os.mkdir(path) ! f = open(os.path.join(path, "Place your scripts hereƒ"), "w") f.close() fss = macfs.FSSpec(path) *************** *** 157,164 **** self.openscript(path) else: ! W.Message("Can¹t open file of type '%s'." % ftype) def getabouttext(self): ! return "About Python IDEŠ" def do_about(self, id, item, window, event): --- 157,164 ---- self.openscript(path) else: ! W.Message("CanÕt open file of type '%s'." % ftype) def getabouttext(self): ! return "About Python IDEƒ" def do_about(self, id, item, window, event): From jackjansen@users.sourceforge.net Thu May 17 13:36:33 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:36:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE PyDebugger.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv26224/Python/Mac/Tools/IDE Modified Files: PyDebugger.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: PyDebugger.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyDebugger.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** PyDebugger.py 1999/09/26 12:11:50 1.3 --- PyDebugger.py 2001/05/17 12:36:30 1.4 *************** *** 73,77 **** if running: self.set_continue() ! self.reason = 'RunningŠ' self.setstate('running') else: --- 73,77 ---- if running: self.set_continue() ! self.reason = 'Runningƒ' self.setstate('running') else: *************** *** 188,192 **** options = [('Clear breakpoints', self.w.panes.bottom.src.source.clearbreakpoints), ('Clear all breakpoints', self.clear_all_breaks), ! ('Edit breakpointsŠ', self.edit_breaks), '-', (self.tracemagic and 'Disable __magic__ tracing' or 'Enable __magic__ tracing', self.togglemagic)] --- 188,192 ---- options = [('Clear breakpoints', self.w.panes.bottom.src.source.clearbreakpoints), ('Clear all breakpoints', self.clear_all_breaks), ! ('Edit breakpointsƒ', self.edit_breaks), '-', (self.tracemagic and 'Disable __magic__ tracing' or 'Enable __magic__ tracing', self.togglemagic)] *************** *** 319,323 **** def running(self): W.SetCursor('watch') ! self.reason = 'RunningŠ' self.setstate('running') #self.w.panes.bottom.src.source.set('') --- 319,323 ---- def running(self): W.SetCursor('watch') ! self.reason = 'Runningƒ' self.setstate('running') #self.w.panes.bottom.src.source.set('') *************** *** 351,355 **** f, filename, (suff, mode, dummy) = imp.find_module(modname) except ImportError: ! self.w.panes.bottom.src.source.set('can¹t find file') else: if f: --- 351,355 ---- f, filename, (suff, mode, dummy) = imp.find_module(modname) except ImportError: ! self.w.panes.bottom.src.source.set('canÕt find file') else: if f: *************** *** 361,367 **** self.w.panes.bottom.src.source.set(data, filename) else: ! self.w.panes.bottom.src.source.set('can¹t find file') else: ! self.w.panes.bottom.src.source.set('can¹t find file') else: self.w.panes.bottom.src.source.set(data, filename) --- 361,367 ---- self.w.panes.bottom.src.source.set(data, filename) else: ! self.w.panes.bottom.src.source.set('canÕt find file') else: ! self.w.panes.bottom.src.source.set('canÕt find file') else: self.w.panes.bottom.src.source.set(data, filename) *************** *** 683,687 **** self.w.panes.gr = W.Group(None) self.w.panes.gr.breaks = W.List((0, 0, -130, 0), callback = self.linehit) #, flags = Lists.lOnlyOne) ! self.w.panes.gr.openbutton = W.Button((-80, 4, 0, 16), 'ViewŠ', self.openbuttonhit) self.w.panes.gr.deletebutton = W.Button((-80, 28, 0, 16), 'Delete', self.deletebuttonhit) --- 683,687 ---- self.w.panes.gr = W.Group(None) self.w.panes.gr.breaks = W.List((0, 0, -130, 0), callback = self.linehit) #, flags = Lists.lOnlyOne) ! self.w.panes.gr.openbutton = W.Button((-80, 4, 0, 16), 'Viewƒ', self.openbuttonhit) self.w.panes.gr.deletebutton = W.Button((-80, 28, 0, 16), 'Delete', self.deletebuttonhit) *************** *** 881,885 **** def getdebugger(): if not __debug__: ! raise W.AlertError, "Can¹t debug in ³Optimize bytecode² mode.\r(see ³Default startup options² in EditPythonPreferences)" global _debugger if _debugger is None: --- 881,885 ---- def getdebugger(): if not __debug__: ! raise W.AlertError, "CanÕt debug in –Optimize bytecode” mode.\r(see –Default startup options” in EditPythonPreferences)" global _debugger if _debugger is None: From jackjansen@users.sourceforge.net Thu May 17 13:36:37 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:36:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE PyConsole.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv26246/Python/Mac/Tools/IDE Modified Files: PyConsole.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: PyConsole.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyConsole.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** PyConsole.py 2001/01/29 13:29:47 1.3 --- PyConsole.py 2001/05/17 12:36:35 1.4 *************** *** 157,162 **** W.SetCursor('watch') namespacelist = self.getnamespacelist() ! self.namespacemenu.set([("Clear window", self.clearbuffer), ("Font settingsŠ", self.dofontsettings), ! ["Namespace"] + namespacelist, ("Browse namespaceŠ", self.browsenamespace)]) currentname = self.consoletext._namespace["__name__"] for i in range(len(namespacelist)): --- 157,162 ---- W.SetCursor('watch') namespacelist = self.getnamespacelist() ! self.namespacemenu.set([("Clear window", self.clearbuffer), ("Font settingsƒ", self.dofontsettings), ! ["Namespace"] + namespacelist, ("Browse namespaceƒ", self.browsenamespace)]) currentname = self.consoletext._namespace["__name__"] for i in range(len(namespacelist)): *************** *** 265,269 **** self.w.outputtext = OutputTextWidget((-1, -1, -14, 1), inset = (6, 5), fontsettings = self.fontsettings, tabsettings = self.tabsettings, readonly = 1) ! menuitems = [("Clear window", self.clearbuffer), ("Font settingsŠ", self.dofontsettings)] self.w.popupmenu = W.PopupMenu((-15, -1, 16, 16), menuitems) --- 265,269 ---- self.w.outputtext = OutputTextWidget((-1, -1, -14, 1), inset = (6, 5), fontsettings = self.fontsettings, tabsettings = self.tabsettings, readonly = 1) ! menuitems = [("Clear window", self.clearbuffer), ("Font settingsƒ", self.dofontsettings)] self.w.popupmenu = W.PopupMenu((-15, -1, 16, 16), menuitems) From jackjansen@users.sourceforge.net Thu May 17 13:36:41 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:36:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE PyBrowser.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv26263/Python/Mac/Tools/IDE Modified Files: PyBrowser.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: PyBrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyBrowser.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** PyBrowser.py 2001/03/01 23:15:54 1.6 --- PyBrowser.py 2001/05/17 12:36:39 1.7 *************** *** 39,43 **** '' + value # test to see if it is a string, in case a __repr__ method is buggy except: ! value = '€€€ exception in repr()' if truncvalue: return key + '\t' + value[:255] --- 39,43 ---- '' + value # test to see if it is a string, in case a __repr__ method is buggy except: ! value = '‚‚‚ exception in repr()' if truncvalue: return key + '\t' + value[:255] *************** *** 361,365 **** tp = type(object) if tp in SIMPLE_TYPES and tp is not types.NoneType: ! raise TypeError, 'can¹t browse simple type: %s' % tp.__name__ elif tp == types.DictionaryType: return unpack_dict(object, indent) --- 361,365 ---- tp = type(object) if tp in SIMPLE_TYPES and tp is not types.NoneType: ! raise TypeError, 'canÕt browse simple type: %s' % tp.__name__ elif tp == types.DictionaryType: return unpack_dict(object, indent) From jackjansen@users.sourceforge.net Thu May 17 13:36:46 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:36:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE ModuleBrowser.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv26283/Python/Mac/Tools/IDE Modified Files: ModuleBrowser.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: ModuleBrowser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/ModuleBrowser.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ModuleBrowser.py 1999/02/02 22:30:48 1.2 --- ModuleBrowser.py 2001/05/17 12:36:43 1.3 *************** *** 15,21 **** #self.window.bevelbox = W.BevelBox((0, 0, 0, 56)) self.window.openbutton = W.Button((10, 8, 80, 16), "Open", self.openbuttonhit) ! self.window.browsebutton = W.Button((100, 8, 80, 16), "BrowseŠ", self.browsebuttonhit) self.window.reloadbutton = W.Button((10, 32, 80, 16), "Reload", self.reloadbuttonhit) ! self.window.openotherbutton = W.Button((100, 32, 80, 16), "Open otherŠ", self.openother) self.window.openbutton.enable(0) --- 15,21 ---- #self.window.bevelbox = W.BevelBox((0, 0, 0, 56)) self.window.openbutton = W.Button((10, 8, 80, 16), "Open", self.openbuttonhit) ! self.window.browsebutton = W.Button((100, 8, 80, 16), "Browseƒ", self.browsebuttonhit) self.window.reloadbutton = W.Button((10, 32, 80, 16), "Reload", self.reloadbuttonhit) ! self.window.openotherbutton = W.Button((100, 32, 80, 16), "Open otherƒ", self.openother) self.window.openbutton.enable(0) *************** *** 82,86 **** except ImportError: W.SetCursor("arrow") ! W.Message("Can¹t find file for module ³%s²." % modname) else: --- 82,86 ---- except ImportError: W.SetCursor("arrow") ! W.Message("CanÕt find file for module –%s”." % modname) else: *************** *** 94,98 **** W.getapplication().openscript(path[:-1], modname=modname) else: ! W.Message("Can¹t edit ³%s²; it might be a shared library or a .pyc file." % modname) --- 94,98 ---- W.getapplication().openscript(path[:-1], modname=modname) else: ! W.Message("CanÕt edit –%s”; it might be a shared library or a .pyc file." % modname) *************** *** 107,113 **** except ImportError: if modname in sys.builtin_module_names: ! alerttext = "³%s² is a builtin module, which you can¹t edit." % modname else: ! alerttext = "No module named ³%s²." % modname raise W.AlertError, alerttext self.openscript(path, modname) --- 107,113 ---- except ImportError: if modname in sys.builtin_module_names: ! alerttext = "–%s” is a builtin module, which you canÕt edit." % modname else: ! alerttext = "No module named –%s”." % modname raise W.AlertError, alerttext self.openscript(path, modname) From jackjansen@users.sourceforge.net Thu May 17 13:38:03 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:38:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib MACFS.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26543/Python/Mac/Lib Modified Files: MACFS.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: MACFS.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/MACFS.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** MACFS.py 2001/03/15 14:39:37 1.4 --- MACFS.py 2001/05/17 12:38:01 1.5 *************** *** 71,96 **** kChewableItemsFolderType = 'flnt' kApplicationSupportFolderType = 'asup' ! kTextEncodingsFolderType = 'Ÿtex' kStationeryFolderType = 'odst' kOpenDocFolderType = 'odod' kOpenDocShellPlugInsFolderType = 'odsp' kEditorsFolderType = 'oded' ! kOpenDocEditorsFolderType = 'Ÿodf' kOpenDocLibrariesFolderType = 'odlb' ! kGenEditorsFolderType = 'Ÿedi' ! kHelpFolderType = 'Ÿhlp' ! kInternetPlugInFolderType = 'Ÿnet' ! kModemScriptsFolderType = 'Ÿmod' kPrinterDescriptionFolderType = 'ppdf' ! kPrinterDriverFolderType = 'Ÿprd' ! kScriptingAdditionsFolderType = 'Ÿscr' ! kSharedLibrariesFolderType = 'Ÿlib' kVoicesFolderType = 'fvoc' kControlStripModulesFolderType = 'sdev' ! kAssistantsFolderType = 'astŸ' ! kUtilitiesFolderType = 'utiŸ' ! kAppleExtrasFolderType = 'aexŸ' kContextualMenuItemsFolderType = 'cmnu' ! kMacOSReadMesFolderType = 'morŸ' kALMModulesFolderType = 'walk' kALMPreferencesFolderType = 'trip' --- 71,96 ---- kChewableItemsFolderType = 'flnt' kApplicationSupportFolderType = 'asup' ! kTextEncodingsFolderType = '€tex' kStationeryFolderType = 'odst' kOpenDocFolderType = 'odod' kOpenDocShellPlugInsFolderType = 'odsp' kEditorsFolderType = 'oded' ! kOpenDocEditorsFolderType = '€odf' kOpenDocLibrariesFolderType = 'odlb' ! kGenEditorsFolderType = '€edi' ! kHelpFolderType = '€hlp' ! kInternetPlugInFolderType = '€net' ! kModemScriptsFolderType = '€mod' kPrinterDescriptionFolderType = 'ppdf' ! kPrinterDriverFolderType = '€prd' ! kScriptingAdditionsFolderType = '€scr' ! kSharedLibrariesFolderType = '€lib' kVoicesFolderType = 'fvoc' kControlStripModulesFolderType = 'sdev' ! kAssistantsFolderType = 'ast€' ! kUtilitiesFolderType = 'uti€' ! kAppleExtrasFolderType = 'aex€' kContextualMenuItemsFolderType = 'cmnu' ! kMacOSReadMesFolderType = 'mor€' kALMModulesFolderType = 'walk' kALMPreferencesFolderType = 'trip' From jackjansen@users.sourceforge.net Thu May 17 13:38:14 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:38:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib macerrors.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv26615/Python/Mac/Lib Modified Files: macerrors.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: macerrors.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/macerrors.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** macerrors.py 2001/03/27 21:32:34 1.5 --- macerrors.py 2001/05/17 12:38:12 1.6 *************** *** 317,321 **** telBadCodeResource = -10108 #code resource not found telInitFailed = -10107 #initialization failed ! telNoCommFolder = -10106 #Communications/Extensions Ÿ not found telUnknownErr = -10103 #unable to set config telNoSuchTool = -10102 #unable to find tool with name specified --- 317,321 ---- telBadCodeResource = -10108 #code resource not found telInitFailed = -10107 #initialization failed ! telNoCommFolder = -10106 #Communications/Extensions € not found telUnknownErr = -10103 #unable to set config telNoSuchTool = -10102 #unable to find tool with name specified *************** *** 627,631 **** kSysSWTooOld = -6226 #Missing critical pieces of System Software. kDMMirroringNotOn = -6225 #Returned by all calls that need mirroring to be on to do their thing. ! kDMCantBlock = -6224 #Mirroring is already on, can¹t Block now (call DMUnMirror() first). kDMMirroringBlocked = -6223 #DMBlockMirroring() has been called. kDMWrongNumberOfDisplays = -6222 #Can only handle 2 displays for now. --- 627,631 ---- kSysSWTooOld = -6226 #Missing critical pieces of System Software. kDMMirroringNotOn = -6225 #Returned by all calls that need mirroring to be on to do their thing. ! kDMCantBlock = -6224 #Mirroring is already on, canÕt Block now (call DMUnMirror() first). kDMMirroringBlocked = -6223 #DMBlockMirroring() has been called. kDMWrongNumberOfDisplays = -6222 #Can only handle 2 displays for now. *************** *** 654,658 **** errWindowPropertyNotFound = -5604 #tried to get a nonexistent property errInvalidWindowProperty = -5603 #tried to access a property tag with private creator ! errWindowDoesNotHaveProxy = -5602 #tried to do something requiring a proxy to a window which doesn¹t have a proxy errUnsupportedWindowAttributesForClass = -5601 #tried to create a window with WindowAttributes not supported by the WindowClass errInvalidWindowPtr = -5600 #tried to pass a bad WindowRef argument --- 654,658 ---- errWindowPropertyNotFound = -5604 #tried to get a nonexistent property errInvalidWindowProperty = -5603 #tried to access a property tag with private creator ! errWindowDoesNotHaveProxy = -5602 #tried to do something requiring a proxy to a window which doesnÕt have a proxy errUnsupportedWindowAttributesForClass = -5601 #tried to create a window with WindowAttributes not supported by the WindowClass errInvalidWindowPtr = -5600 #tried to pass a bad WindowRef argument *************** *** 848,852 **** kENOSRErr = -3271 # kETIMEErr = -3270 # ! kEPROTOErr = -3269 #€€€ fill out missing codes €€€ kEHOSTUNREACHErr = -3264 #No route to host kEHOSTDOWNErr = -3263 #Host is down --- 848,852 ---- kENOSRErr = -3271 # kETIMEErr = -3270 # ! kEPROTOErr = -3269 #‚‚‚ fill out missing codes ‚‚‚ kEHOSTUNREACHErr = -3264 #No route to host kEHOSTDOWNErr = -3263 #Host is down *************** *** 1044,1048 **** tsmDocumentOpenErr = -2511 #there are open documents tsmTextServiceNotFoundErr = -2510 #no text service found ! tsmCantOpenComponentErr = -2509 #can¹t open the component tsmNoOpenTSErr = -2508 #no open text service tsmDocNotActiveErr = -2507 #document is NOT active --- 1044,1048 ---- tsmDocumentOpenErr = -2511 #there are open documents tsmTextServiceNotFoundErr = -2510 #no text service found ! tsmCantOpenComponentErr = -2509 #canÕt open the component tsmNoOpenTSErr = -2508 #no open text service tsmDocNotActiveErr = -2507 #document is NOT active *************** *** 1077,1083 **** kernelIncompleteErr = -2401 #kernelIncompleteErr badCallOrderErr = -2209 #Usually due to a status call being called prior to being setup first ! noDMAErr = -2208 #Can¹t do DMA digitizing (i.e. can't go to requested dest ! badDepthErr = -2207 #Can¹t digitize into this depth ! notExactSizeErr = -2206 #Can¹t do exact size requested noMoreKeyColorsErr = -2205 #all key indexes in use notExactMatrixErr = -2204 #warning of bad matrix, digitizer did its best --- 1077,1083 ---- kernelIncompleteErr = -2401 #kernelIncompleteErr badCallOrderErr = -2209 #Usually due to a status call being called prior to being setup first ! noDMAErr = -2208 #CanÕt do DMA digitizing (i.e. can't go to requested dest ! badDepthErr = -2207 #CanÕt digitize into this depth ! notExactSizeErr = -2206 #CanÕt do exact size requested noMoreKeyColorsErr = -2205 #all key indexes in use notExactMatrixErr = -2204 #warning of bad matrix, digitizer did its best *************** *** 1429,1433 **** noMMUErr = -626 #no MMU present cannotDeferErr = -625 #unable to defer additional functions ! interruptsMaskedErr = -624 #don¹t call with interrupts masked notLockedErr = -623 #specified range of memory is not locked cannotMakeContiguousErr = -622 #cannot make specified range contiguous --- 1429,1433 ---- noMMUErr = -626 #no MMU present cannotDeferErr = -625 #unable to defer additional functions ! interruptsMaskedErr = -624 #donÕt call with interrupts masked notLockedErr = -623 #specified range of memory is not locked cannotMakeContiguousErr = -622 #cannot make specified range contiguous *************** *** 1709,1716 **** statusErr = -18 #I/O System Errors controlErr = -17 #I/O System Errors ! dsExtensionsDisabled = -13 #say ³Extensions Disabled² ! dsHD20Installed = -12 #say ³HD20 Startup² ! dsDisassemblerInstalled = -11 #say ³Disassembler Installed² ! dsMacsBugInstalled = -10 #say ³MacsBug Installed² seNoDB = -8 #no debugger installed to handle debugger command SlpTypeErr = -5 #invalid queue element --- 1709,1716 ---- statusErr = -18 #I/O System Errors controlErr = -17 #I/O System Errors ! dsExtensionsDisabled = -13 #say –Extensions Disabled” ! dsHD20Installed = -12 #say –HD20 Startup” ! dsDisassemblerInstalled = -11 #say –Disassembler Installed” ! dsMacsBugInstalled = -10 #say –MacsBug Installed” seNoDB = -8 #no debugger installed to handle debugger command SlpTypeErr = -5 #invalid queue element From jackjansen@users.sourceforge.net Thu May 17 13:38:18 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:38:18 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-toolbox Icons.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-toolbox In directory usw-pr-cvs1:/tmp/cvs-serv26656/Python/Mac/Lib/lib-toolbox Modified Files: Icons.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Icons.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-toolbox/Icons.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** Icons.py 2001/02/12 16:09:43 1.6 --- Icons.py 2001/05/17 12:38:16 1.7 *************** *** 278,290 **** kOwnerIcon = FOUR_CHAR_CODE('susr') kGroupIcon = FOUR_CHAR_CODE('grup') ! kAppleExtrasFolderIcon = FOUR_CHAR_CODE('aexŸ') kAppleMenuFolderIcon = FOUR_CHAR_CODE('amnu') kApplicationsFolderIcon = FOUR_CHAR_CODE('apps') kApplicationSupportFolderIcon = FOUR_CHAR_CODE('asup') ! kAssistantsFolderIcon = FOUR_CHAR_CODE('astŸ') kContextualMenuItemsFolderIcon = FOUR_CHAR_CODE('cmnu') kControlPanelDisabledFolderIcon = FOUR_CHAR_CODE('ctrD') kControlPanelFolderIcon = FOUR_CHAR_CODE('ctrl') ! kControlStripModulesFolderIcon = FOUR_CHAR_CODE('sdvŸ') kDocumentsFolderIcon = FOUR_CHAR_CODE('docs') kExtensionsDisabledFolderIcon = FOUR_CHAR_CODE('extD') --- 278,290 ---- kOwnerIcon = FOUR_CHAR_CODE('susr') kGroupIcon = FOUR_CHAR_CODE('grup') ! kAppleExtrasFolderIcon = FOUR_CHAR_CODE('aex€') kAppleMenuFolderIcon = FOUR_CHAR_CODE('amnu') kApplicationsFolderIcon = FOUR_CHAR_CODE('apps') kApplicationSupportFolderIcon = FOUR_CHAR_CODE('asup') ! kAssistantsFolderIcon = FOUR_CHAR_CODE('ast€') kContextualMenuItemsFolderIcon = FOUR_CHAR_CODE('cmnu') kControlPanelDisabledFolderIcon = FOUR_CHAR_CODE('ctrD') kControlPanelFolderIcon = FOUR_CHAR_CODE('ctrl') ! kControlStripModulesFolderIcon = FOUR_CHAR_CODE('sdv€') kDocumentsFolderIcon = FOUR_CHAR_CODE('docs') kExtensionsDisabledFolderIcon = FOUR_CHAR_CODE('extD') *************** *** 292,310 **** kFavoritesFolderIcon = FOUR_CHAR_CODE('favs') kFontsFolderIcon = FOUR_CHAR_CODE('font') ! kHelpFolderIcon = FOUR_CHAR_CODE('Ÿhlp') ! kInternetFolderIcon = FOUR_CHAR_CODE('intŸ') ! kInternetPlugInFolderIcon = FOUR_CHAR_CODE('Ÿnet') ! kLocalesFolderIcon = FOUR_CHAR_CODE('Ÿloc') ! kMacOSReadMeFolderIcon = FOUR_CHAR_CODE('morŸ') ! kPreferencesFolderIcon = FOUR_CHAR_CODE('prfŸ') kPrinterDescriptionFolderIcon = FOUR_CHAR_CODE('ppdf') ! kPrinterDriverFolderIcon = FOUR_CHAR_CODE('Ÿprd') kPrintMonitorFolderIcon = FOUR_CHAR_CODE('prnt') kRecentApplicationsFolderIcon = FOUR_CHAR_CODE('rapp') kRecentDocumentsFolderIcon = FOUR_CHAR_CODE('rdoc') kRecentServersFolderIcon = FOUR_CHAR_CODE('rsrv') ! kScriptingAdditionsFolderIcon = FOUR_CHAR_CODE('Ÿscr') ! kSharedLibrariesFolderIcon = FOUR_CHAR_CODE('Ÿlib') ! kScriptsFolderIcon = FOUR_CHAR_CODE('scrŸ') kShutdownItemsDisabledFolderIcon = FOUR_CHAR_CODE('shdD') kShutdownItemsFolderIcon = FOUR_CHAR_CODE('shdf') --- 292,310 ---- kFavoritesFolderIcon = FOUR_CHAR_CODE('favs') kFontsFolderIcon = FOUR_CHAR_CODE('font') ! kHelpFolderIcon = FOUR_CHAR_CODE('€hlp') ! kInternetFolderIcon = FOUR_CHAR_CODE('int€') ! kInternetPlugInFolderIcon = FOUR_CHAR_CODE('€net') ! kLocalesFolderIcon = FOUR_CHAR_CODE('€loc') ! kMacOSReadMeFolderIcon = FOUR_CHAR_CODE('mor€') ! kPreferencesFolderIcon = FOUR_CHAR_CODE('prf€') kPrinterDescriptionFolderIcon = FOUR_CHAR_CODE('ppdf') ! kPrinterDriverFolderIcon = FOUR_CHAR_CODE('€prd') kPrintMonitorFolderIcon = FOUR_CHAR_CODE('prnt') kRecentApplicationsFolderIcon = FOUR_CHAR_CODE('rapp') kRecentDocumentsFolderIcon = FOUR_CHAR_CODE('rdoc') kRecentServersFolderIcon = FOUR_CHAR_CODE('rsrv') ! kScriptingAdditionsFolderIcon = FOUR_CHAR_CODE('€scr') ! kSharedLibrariesFolderIcon = FOUR_CHAR_CODE('€lib') ! kScriptsFolderIcon = FOUR_CHAR_CODE('scr€') kShutdownItemsDisabledFolderIcon = FOUR_CHAR_CODE('shdD') kShutdownItemsFolderIcon = FOUR_CHAR_CODE('shdf') *************** *** 314,324 **** kSystemExtensionDisabledFolderIcon = FOUR_CHAR_CODE('macD') kSystemFolderIcon = FOUR_CHAR_CODE('macs') ! kTextEncodingsFolderIcon = FOUR_CHAR_CODE('Ÿtex') kAppearanceFolderIcon = FOUR_CHAR_CODE('appr') ! kUtilitiesFolderIcon = FOUR_CHAR_CODE('utiŸ') kVoicesFolderIcon = FOUR_CHAR_CODE('fvoc') kColorSyncFolderIcon = FOUR_CHAR_CODE('prof') kInternetSearchSitesFolderIcon = FOUR_CHAR_CODE('issf') ! kUsersFolderIcon = FOUR_CHAR_CODE('usrŸ') kAppleScriptBadgeIcon = FOUR_CHAR_CODE('scrp') kLockedBadgeIcon = FOUR_CHAR_CODE('lbdg') --- 314,324 ---- kSystemExtensionDisabledFolderIcon = FOUR_CHAR_CODE('macD') kSystemFolderIcon = FOUR_CHAR_CODE('macs') ! kTextEncodingsFolderIcon = FOUR_CHAR_CODE('€tex') kAppearanceFolderIcon = FOUR_CHAR_CODE('appr') ! kUtilitiesFolderIcon = FOUR_CHAR_CODE('uti€') kVoicesFolderIcon = FOUR_CHAR_CODE('fvoc') kColorSyncFolderIcon = FOUR_CHAR_CODE('prof') kInternetSearchSitesFolderIcon = FOUR_CHAR_CODE('issf') ! kUsersFolderIcon = FOUR_CHAR_CODE('usr€') kAppleScriptBadgeIcon = FOUR_CHAR_CODE('scrp') kLockedBadgeIcon = FOUR_CHAR_CODE('lbdg') From jackjansen@users.sourceforge.net Thu May 17 13:38:24 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:38:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-toolbox AppleEvents.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-toolbox In directory usw-pr-cvs1:/tmp/cvs-serv26681/Python/Mac/Lib/lib-toolbox Modified Files: AppleEvents.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: AppleEvents.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-toolbox/AppleEvents.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** AppleEvents.py 2001/02/12 16:09:43 1.7 --- AppleEvents.py 2001/05/17 12:38:22 1.8 *************** *** 705,709 **** kFAIndexParam = FOUR_CHAR_CODE('indx') kAEInternetSuite = FOUR_CHAR_CODE('gurl') ! kAEISWebStarSuite = FOUR_CHAR_CODE('WWW‡') kAEISGetURL = FOUR_CHAR_CODE('gurl') KAEISHandleCGI = FOUR_CHAR_CODE('sdoc') --- 705,709 ---- kFAIndexParam = FOUR_CHAR_CODE('indx') kAEInternetSuite = FOUR_CHAR_CODE('gurl') ! kAEISWebStarSuite = FOUR_CHAR_CODE('WWW½') kAEISGetURL = FOUR_CHAR_CODE('gurl') KAEISHandleCGI = FOUR_CHAR_CODE('sdoc') From jackjansen@users.sourceforge.net Thu May 17 13:38:28 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:38:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites Text_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites In directory usw-pr-cvs1:/tmp/cvs-serv26699/Python/Mac/Lib/lib-scriptpackages/StdSuites Modified Files: Text_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Text_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Text_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Text_Suite.py 2000/08/17 22:14:57 1.1 --- Text_Suite.py 2001/05/17 12:38:26 1.2 *************** *** 76,80 **** class text_flow(aetools.ComponentItem): ! """text flow - A contiguous block of text. Page layout applications call this a Œstory.¹ """ want = 'cflo' # repeated property _3c_inheritance_3e_ inherits some of its properties from this class --- 76,80 ---- class text_flow(aetools.ComponentItem): ! """text flow - A contiguous block of text. Page layout applications call this a •story.Õ """ want = 'cflo' # repeated property _3c_inheritance_3e_ inherits some of its properties from this class From jackjansen@users.sourceforge.net Thu May 17 13:38:33 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:38:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites Table_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites In directory usw-pr-cvs1:/tmp/cvs-serv26720/Python/Mac/Lib/lib-scriptpackages/StdSuites Modified Files: Table_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Table_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Table_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Table_Suite.py 2000/08/17 22:14:57 1.1 --- Table_Suite.py 2001/05/17 12:38:31 1.2 *************** *** 71,75 **** } _Enum_prtn = { ! 'read_only' : 'nmod', # Can¹t change values or formulas 'formulas_protected' : 'fpro', # Can changes values but not formulas 'read_2f_write' : 'modf', # Can change values and formulas --- 71,75 ---- } _Enum_prtn = { ! 'read_only' : 'nmod', # CanÕt change values or formulas 'formulas_protected' : 'fpro', # Can changes values but not formulas 'read_2f_write' : 'modf', # Can change values and formulas From jackjansen@users.sourceforge.net Thu May 17 13:38:38 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:38:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites Standard_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites In directory usw-pr-cvs1:/tmp/cvs-serv26756/Python/Mac/Lib/lib-scriptpackages/StdSuites Modified Files: Standard_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Standard_Suite.py 2000/08/17 22:14:57 1.1 --- Standard_Suite.py 2001/05/17 12:38:36 1.2 *************** *** 430,434 **** Keyword argument _in: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: a record containing the object¹s properties and elements """ _code = 'core' --- 430,434 ---- Keyword argument _in: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: a record containing the objectÕs properties and elements """ _code = 'core' *************** *** 460,464 **** want = 'bool' class selection(aetools.NProperty): ! """selection - the selection visible to the user. Use the Œselect¹ command to set a new selection; use Œcontents of selection¹ to get or change information in the document. """ which = 'sele' want = 'csel' --- 460,464 ---- want = 'bool' class selection(aetools.NProperty): ! """selection - the selection visible to the user. Use the •selectÕ command to set a new selection; use •contents of selectionÕ to get or change information in the document. """ which = 'sele' want = 'csel' *************** *** 501,508 **** class selection_2d_object(aetools.ComponentItem): ! """selection-object - A way to refer to the state of the current of the selection. Use the Œselect¹ command to make a new selection. """ want = 'csel' class contents(aetools.NProperty): ! """contents - the information currently selected. Use Œcontents of selection¹ to get or change information in a document. """ which = 'pcnt' want = '****' --- 501,508 ---- class selection_2d_object(aetools.ComponentItem): ! """selection-object - A way to refer to the state of the current of the selection. Use the •selectÕ command to make a new selection. """ want = 'csel' class contents(aetools.NProperty): ! """contents - the information currently selected. Use •contents of selectionÕ to get or change information in a document. """ which = 'pcnt' want = '****' *************** *** 616,624 **** """> - Greater than """ class _b3_(aetools.NComparison): ! """„ - Greater than or equal to """ class _3c_(aetools.NComparison): """< - Less than """ class _b2_(aetools.NComparison): ! """¾ - Less than or equal to """ _Enum_savo = { 'yes' : 'yes ', # Save objects now --- 616,624 ---- """> - Greater than """ class _b3_(aetools.NComparison): ! """³ - Greater than or equal to """ class _3c_(aetools.NComparison): """< - Less than """ class _b2_(aetools.NComparison): ! """² - Less than or equal to """ _Enum_savo = { 'yes' : 'yes ', # Save objects now From jackjansen@users.sourceforge.net Thu May 17 13:38:46 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:38:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites AppleScript_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites In directory usw-pr-cvs1:/tmp/cvs-serv26778/Python/Mac/Lib/lib-scriptpackages/StdSuites Modified Files: AppleScript_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/StdSuites/AppleScript_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** AppleScript_Suite.py 2000/08/17 22:14:56 1.1 --- AppleScript_Suite.py 2001/05/17 12:38:44 1.2 *************** *** 130,134 **** def tell(self, _no_object=None, _attributes={}, **_arguments): ! """tell: Record or log a Œtell¹ statement Keyword argument _attributes: AppleEvent attribute dictionary """ --- 130,134 ---- def tell(self, _no_object=None, _attributes={}, **_arguments): ! """tell: Record or log a •tellÕ statement Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 149,153 **** def end_tell(self, _no_object=None, _attributes={}, **_arguments): ! """end tell: Record or log an Œend tell¹ statement Keyword argument _attributes: AppleEvent attribute dictionary """ --- 149,153 ---- def end_tell(self, _no_object=None, _attributes={}, **_arguments): ! """end tell: Record or log an •end tellÕ statement Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 230,234 **** def Call_a5_subroutine(self, _object=None, _attributes={}, **_arguments): ! """Call€subroutine: A subroutine call Required argument: anything Keyword argument at: a preposition --- 230,234 ---- def Call_a5_subroutine(self, _object=None, _attributes={}, **_arguments): ! """Call‚subroutine: A subroutine call Required argument: anything Keyword argument at: a preposition *************** *** 300,304 **** def _ad_(self, _object, _attributes={}, **_arguments): ! """‚: Inequality Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary --- 300,304 ---- def _ad_(self, _object, _attributes={}, **_arguments): ! """­: Inequality Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 489,493 **** def _b3_(self, _object, _attributes={}, **_arguments): ! """„: Greater than or equal to Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary --- 489,493 ---- def _b3_(self, _object, _attributes={}, **_arguments): ! """³: Greater than or equal to Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 531,535 **** def _b2_(self, _object, _attributes={}, **_arguments): ! """¾: Less than or equal to Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary --- 531,535 ---- def _b2_(self, _object, _attributes={}, **_arguments): ! """²: Less than or equal to Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 821,825 **** want = 'TEXT' class parent(aetools.NProperty): ! """parent - its parent, i.e. the script that will handle events that this script doesn¹t """ which = 'pare' want = 'scpt' --- 821,825 ---- want = 'TEXT' class parent(aetools.NProperty): ! """parent - its parent, i.e. the script that will handle events that this script doesnÕt """ which = 'pare' want = 'scpt' From jackjansen@users.sourceforge.net Thu May 17 13:38:50 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:38:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Netscape __init__.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv26820/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: __init__.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** __init__.py 2000/08/20 19:28:26 1.2 --- __init__.py 2001/05/17 12:38:48 1.3 *************** *** 1,4 **** """ ! Package generated from Macintosh HD:Internet:Internet-programma's:Netscape Communicator-map:Netscape Communicator Resource aete resid 0 """ --- 1,4 ---- """ ! Package generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ Resource aete resid 0 """ From jackjansen@users.sourceforge.net Thu May 17 13:39:09 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:39:09 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Netscape WorldWideWeb_suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv26923/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: WorldWideWeb_suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: WorldWideWeb_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/WorldWideWeb_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** WorldWideWeb_suite.py 2000/08/17 22:15:41 1.1 --- WorldWideWeb_suite.py 2001/05/17 12:39:07 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape Communicator-map:Netscape Communicator AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 213,217 **** def register_URL_echo(self, _object=None, _attributes={}, **_arguments): ! """register URL echo: Registers the ³echo² application. Each download from now on will be echoed to this application. Required argument: Application signature Keyword argument _attributes: AppleEvent attribute dictionary --- 213,217 ---- def register_URL_echo(self, _object=None, _attributes={}, **_arguments): ! """register URL echo: Registers the –echo” application. Each download from now on will be echoed to this application. Required argument: Application signature Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 258,262 **** def register_viewer(self, _object, _attributes={}, **_arguments): ! """register viewer: Registers an application as a Œspecial¹ viewer for this MIME type. The application will be launched with ViewDoc events Required argument: Application sig Keyword argument MIME_type: MIME type viewer is registering for --- 258,262 ---- def register_viewer(self, _object, _attributes={}, **_arguments): ! """register viewer: Registers an application as a •specialÕ viewer for this MIME type. The application will be launched with ViewDoc events Required argument: Application sig Keyword argument MIME_type: MIME type viewer is registering for *************** *** 311,317 **** def register_protocol(self, _object=None, _attributes={}, **_arguments): ! """register protocol: Registers application as a ³handler² for this protocol with a given prefix. The handler will receive ³OpenURL², or if that fails, ³GetURL² event. Required argument: Application sig ! Keyword argument for_protocol: protocol prefix: ³finger:², ³file², Keyword argument _attributes: AppleEvent attribute dictionary Returns: TRUE if registration has been successful --- 311,317 ---- def register_protocol(self, _object=None, _attributes={}, **_arguments): ! """register protocol: Registers application as a –handler” for this protocol with a given prefix. The handler will receive –OpenURL”, or if that fails, –GetURL” event. Required argument: Application sig ! Keyword argument for_protocol: protocol prefix: –finger:”, –file”, Keyword argument _attributes: AppleEvent attribute dictionary Returns: TRUE if registration has been successful *************** *** 337,341 **** def unregister_protocol(self, _object=None, _attributes={}, **_arguments): ! """unregister protocol: reverses the effects of ³register protocol² Required argument: Application sig. Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols --- 337,341 ---- def unregister_protocol(self, _object=None, _attributes={}, **_arguments): ! """unregister protocol: reverses the effects of –register protocol” Required argument: Application sig. Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols From jackjansen@users.sourceforge.net Thu May 17 13:39:13 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:39:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Text.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv26945/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: Text.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Text.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Text.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Text.py 2000/08/20 19:28:26 1.2 --- Text.py 2001/05/17 12:39:11 1.3 *************** *** 2,6 **** Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape Communicator-map:Netscape Communicator AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 43,47 **** class styleset(aetools.ComponentItem): ! """styleset - A style ³set² that may be used repeatedly in text objects. """ want = 'stys' class name(aetools.NProperty): --- 43,47 ---- class styleset(aetools.ComponentItem): ! """styleset - A style –set” that may be used repeatedly in text objects. """ want = 'stys' class name(aetools.NProperty): From jackjansen@users.sourceforge.net Thu May 17 13:39:17 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:39:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Standard_URL_suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv26973/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: Standard_URL_suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Standard_URL_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Standard_URL_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Standard_URL_suite.py 2000/08/17 22:15:40 1.1 --- Standard_URL_suite.py 2001/05/17 12:39:15 1.2 *************** *** 1,6 **** ! """Suite Standard URL suite: Mac URL standard, supported by many apps Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape Communicator-map:Netscape Communicator AETE/AEUT resource version 1/0, language 0, script 0 """ --- 1,9 ---- ! """Suite Standard URL suite: Mac URL standard, supported by many apps ! ! ! Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 20,24 **** def GetURL(self, _object, _attributes={}, **_arguments): ! """GetURL: Loads the URL (optionally to disk) Required argument: The url Keyword argument to: file the URL should be loaded into --- 23,28 ---- def GetURL(self, _object, _attributes={}, **_arguments): ! """GetURL: Loads the URL (optionally to disk) ! Required argument: The url Keyword argument to: file the URL should be loaded into From jackjansen@users.sourceforge.net Thu May 17 13:39:25 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:39:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Required_suite.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv27029/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: Required_suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Required_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Required_suite.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Required_suite.py 2000/08/20 19:28:26 1.2 --- Required_suite.py 2001/05/17 12:39:23 1.3 *************** *** 2,6 **** Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape Communicator-map:Netscape Communicator AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ From jackjansen@users.sourceforge.net Thu May 17 13:39:29 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:39:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Netscape PowerPlant.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv27056/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: PowerPlant.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: PowerPlant.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/PowerPlant.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** PowerPlant.py 2000/08/17 22:15:40 1.1 --- PowerPlant.py 2001/05/17 12:39:27 1.2 *************** *** 2,6 **** Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape Communicator-map:Netscape Communicator AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 0, version 0 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 43,47 **** def SwitchTellTarget(self, _no_object=None, _attributes={}, **_arguments): ! """SwitchTellTarget: Makes an object the ³focus² of AppleEvents Keyword argument to: reference to new focus of AppleEvents Keyword argument _attributes: AppleEvent attribute dictionary --- 43,47 ---- def SwitchTellTarget(self, _no_object=None, _attributes={}, **_arguments): ! """SwitchTellTarget: Makes an object the –focus” of AppleEvents Keyword argument to: reference to new focus of AppleEvents Keyword argument _attributes: AppleEvent attribute dictionary From jackjansen@users.sourceforge.net Thu May 17 13:39:38 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:39:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Finder Window_classes.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv27114/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Window_classes.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Window_classes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Window_classes.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Window_classes.py 2000/08/22 20:35:17 1.2 --- Window_classes.py 2001/05/17 12:39:36 1.3 *************** *** 163,167 **** class information_window(aetools.ComponentItem): ! """information window - An information window (opened by ³Get Info²) """ want = 'iwnd' class current_panel(aetools.NProperty): --- 163,167 ---- class information_window(aetools.ComponentItem): ! """information window - An information window (opened by –Get Info”) """ want = 'iwnd' class current_panel(aetools.NProperty): *************** *** 218,226 **** want = 'bool' class product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the ³Get Info² window) """ which = 'ver2' want = 'itxt' class version(aetools.NProperty): ! """version - the version of the file (visible at the bottom of the ³Get Info² window) """ which = 'vers' want = 'itxt' --- 218,226 ---- want = 'bool' class product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the –Get Info” window) """ which = 'ver2' want = 'itxt' class version(aetools.NProperty): ! """version - the version of the file (visible at the bottom of the –Get Info” window) """ which = 'vers' want = 'itxt' *************** *** 239,243 **** class content_space(aetools.ComponentItem): ! """content space - All windows, including the desktop window (³Window² does not include the desktop window) """ want = 'dwnd' --- 239,243 ---- class content_space(aetools.ComponentItem): ! """content space - All windows, including the desktop window (–Window” does not include the desktop window) """ want = 'dwnd' From jackjansen@users.sourceforge.net Thu May 17 13:39:46 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:39:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Finder Type_Definitions.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv27167/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Type_Definitions.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Type_Definitions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Type_Definitions.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Type_Definitions.py 2000/08/22 20:35:17 1.2 --- Type_Definitions.py 2001/05/17 12:39:44 1.3 *************** *** 164,168 **** class alias_list(aetools.ComponentItem): ! """alias list - A list of aliases. Use Œas alias list¹ when a list of aliases is needed (instead of a list of file system item references). """ want = 'alst' preferences._propdict = { --- 164,168 ---- class alias_list(aetools.ComponentItem): ! """alias list - A list of aliases. Use •as alias listÕ when a list of aliases is needed (instead of a list of file system item references). """ want = 'alst' preferences._propdict = { From jackjansen@users.sourceforge.net Thu May 17 13:39:55 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:39:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Finder Finder_items.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv27283/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Finder_items.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Finder_items.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Finder_items.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Finder_items.py 2000/08/20 19:29:02 1.1 --- Finder_items.py 2001/05/17 12:39:53 1.2 *************** *** 80,84 **** def empty(self, _object=None, _attributes={}, **_arguments): """empty: Empty the trash ! Required argument: ³empty² and ³empty trash² both do the same thing Keyword argument _attributes: AppleEvent attribute dictionary """ --- 80,84 ---- def empty(self, _object=None, _attributes={}, **_arguments): """empty: Empty the trash ! Required argument: –empty” and –empty trash” both do the same thing Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 228,232 **** want = 'itxt' class comment(aetools.NProperty): ! """comment - the comment of the item, displayed in the ³Get Info² window """ which = 'comt' want = 'itxt' --- 228,232 ---- want = 'itxt' class comment(aetools.NProperty): ! """comment - the comment of the item, displayed in the –Get Info” window """ which = 'comt' want = 'itxt' From jackjansen@users.sourceforge.net Thu May 17 13:39:21 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:39:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Standard_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv27001/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: Standard_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Standard_Suite.py 2000/08/17 22:15:40 1.1 --- Standard_Suite.py 2001/05/17 12:39:19 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape Communicator-map:Netscape Communicator AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 80,84 **** def set(self, _object, _attributes={}, **_arguments): ! """set: Set an object¹s data Required argument: the object to change Keyword argument to: the new value --- 80,84 ---- def set(self, _object, _attributes={}, **_arguments): ! """set: Set an objectÕs data Required argument: the object to change Keyword argument to: the new value *************** *** 105,109 **** want = 'capp' class alert_application(aetools.NProperty): ! """alert application - Most of the alerts will be sent to this application using yet unspecified AE interface. We need a few alert boxes: alert, confirm and notify. Any ideas on how to design this event? mailto:atotic@netscape.com. I¹d like to conform to the standard. """ which = 'ALAP' want = 'type' --- 105,109 ---- want = 'capp' class alert_application(aetools.NProperty): ! """alert application - Most of the alerts will be sent to this application using yet unspecified AE interface. We need a few alert boxes: alert, confirm and notify. Any ideas on how to design this event? mailto:atotic@netscape.com. IÕd like to conform to the standard. """ which = 'ALAP' want = 'type' *************** *** 170,174 **** want = 'TEXT' class unique_ID(aetools.NProperty): ! """unique ID - Window¹s unique ID (a bridge between WWW! suite window id¹s and standard AE windows) """ which = 'wiid' want = 'long' --- 170,174 ---- want = 'TEXT' class unique_ID(aetools.NProperty): ! """unique ID - WindowÕs unique ID (a bridge between WWW! suite window idÕs and standard AE windows) """ which = 'wiid' want = 'long' From jackjansen@users.sourceforge.net Thu May 17 13:39:34 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:39:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Netscape Mozilla_suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape In directory usw-pr-cvs1:/tmp/cvs-serv27081/Python/Mac/Lib/lib-scriptpackages/Netscape Modified Files: Mozilla_suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Mozilla_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Netscape/Mozilla_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Mozilla_suite.py 2000/08/17 22:15:40 1.1 --- Mozilla_suite.py 2001/05/17 12:39:32 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape Communicator-map:Netscape Communicator AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from Macintosh HD:Internet:Internet-programma's:Netscape CommunicatorŽ-map:Netscape CommunicatorŽ AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 21,25 **** """Read help file: Reads in the help file (file should be in the help file format) Required argument: undocumented, typecode 'alis' ! Keyword argument with_index: Index to the help file. Defaults to ŒDEFAULT¹) Keyword argument search_text: Optional text to search for Keyword argument _attributes: AppleEvent attribute dictionary --- 21,25 ---- """Read help file: Reads in the help file (file should be in the help file format) Required argument: undocumented, typecode 'alis' ! Keyword argument with_index: Index to the help file. Defaults to •DEFAULTÕ) Keyword argument search_text: Optional text to search for Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 89,93 **** """Get workingURL: Get the path to the running application in URL format. This will allow a script to construct a relative URL Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Will return text of the from ³FILE://foo/applicationname² """ _code = 'MOSS' --- 89,93 ---- """Get workingURL: Get the path to the running application in URL format. This will allow a script to construct a relative URL Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Will return text of the from –FILE://foo/applicationname” """ _code = 'MOSS' *************** *** 128,132 **** """Get Import Data: Returns a structure containing information that is of use to an external module in importing data from an external mail application into Communicator. Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: vRefNum and dirID of profile folder (2+4 bytes), vRefNum and DirID of the local mail folder (2+4 bytes), window type of front window (0 if none, ŒBrwz¹ browser, ŒAddr¹ addressbook, ŒMesg¹ messenger, etc., 4 bytes) """ _code = 'MOSS' --- 128,132 ---- """Get Import Data: Returns a structure containing information that is of use to an external module in importing data from an external mail application into Communicator. Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: vRefNum and dirID of profile folder (2+4 bytes), vRefNum and DirID of the local mail folder (2+4 bytes), window type of front window (0 if none, •BrwzÕ browser, •AddrÕ addressbook, •MesgÕ messenger, etc., 4 bytes) """ _code = 'MOSS' *************** *** 148,152 **** """Get Profile Name: Get the current User Profile Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Name of the current profile, like ³Joe Bloggs². This is the name of the profile folder in the Netscape Users folder. """ _code = 'MOSS' --- 148,152 ---- """Get Profile Name: Get the current User Profile Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Name of the current profile, like –Joe Bloggs”. This is the name of the profile folder in the Netscape Users folder. """ _code = 'MOSS' From jackjansen@users.sourceforge.net Thu May 17 13:39:50 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:39:50 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Finder Obsolete_terms.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv27252/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Obsolete_terms.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Obsolete_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Obsolete_terms.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Obsolete_terms.py 2000/08/22 20:35:17 1.2 --- Obsolete_terms.py 2001/05/17 12:39:48 1.3 *************** *** 60,64 **** class information_window(aetools.ComponentItem): ! """information window - An information window (opened by ³Get Info²) """ want = 'iwnd' class creation_date_obsolete(aetools.NProperty): --- 60,64 ---- class information_window(aetools.ComponentItem): ! """information window - An information window (opened by –Get Info”) """ want = 'iwnd' class creation_date_obsolete(aetools.NProperty): *************** *** 88,92 **** class sharing_window(aetools.ComponentItem): ! """sharing window - A sharing window (opened by ³SharingŠ²) """ want = 'swnd' class sharable_container(aetools.NProperty): --- 88,92 ---- class sharing_window(aetools.ComponentItem): ! """sharing window - A sharing window (opened by –Sharingƒ”) """ want = 'swnd' class sharable_container(aetools.NProperty): From jackjansen@users.sourceforge.net Thu May 17 13:40:26 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:40:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Finder Finder_Basics.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv27460/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Finder_Basics.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Finder_Basics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Finder_Basics.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Finder_Basics.py 2000/08/20 19:29:02 1.1 --- Finder_Basics.py 2001/05/17 12:40:24 1.2 *************** *** 146,150 **** want = 'capp' class clipboard(aetools.NProperty): ! """clipboard - the Finder¹s clipboard window """ which = 'pcli' want = 'obj ' --- 146,150 ---- want = 'capp' class clipboard(aetools.NProperty): ! """clipboard - the FinderÕs clipboard window """ which = 'pcli' want = 'obj ' *************** *** 154,162 **** want = 'long' class name(aetools.NProperty): ! """name - the Finder¹s name """ which = 'pnam' want = 'itxt' class visible(aetools.NProperty): ! """visible - Is the Finder¹s layer visible? """ which = 'pvis' want = 'bool' --- 154,162 ---- want = 'long' class name(aetools.NProperty): ! """name - the FinderÕs name """ which = 'pnam' want = 'itxt' class visible(aetools.NProperty): ! """visible - Is the FinderÕs layer visible? """ which = 'pvis' want = 'bool' *************** *** 170,174 **** want = 'obj ' class insertion_location(aetools.NProperty): ! """insertion location - the container in which a new folder would appear if ³New Folder² was selected """ which = 'pins' want = 'obj ' --- 170,174 ---- want = 'obj ' class insertion_location(aetools.NProperty): ! """insertion location - the container in which a new folder would appear if –New Folder” was selected """ which = 'pins' want = 'obj ' *************** *** 190,194 **** want = 'itxt' class about_this_computer(aetools.NProperty): ! """about this computer - the ³About this Computer² dialog and the list of running processes displayed in it """ which = 'abbx' want = 'obj ' --- 190,194 ---- want = 'itxt' class about_this_computer(aetools.NProperty): ! """about this computer - the –About this Computer” dialog and the list of running processes displayed in it """ which = 'abbx' want = 'obj ' *************** *** 236,268 **** want = 'obj ' class apple_menu_items_folder(aetools.NProperty): ! """apple menu items folder - the special folder named ³Apple Menu Items,² the contents of which appear in the Apple menu """ which = 'amnu' want = 'obj ' class control_panels_folder(aetools.NProperty): ! """control panels folder - the special folder named ³Control Panels² """ which = 'ctrl' want = 'obj ' class extensions_folder(aetools.NProperty): ! """extensions folder - the special folder named ³Extensions² """ which = 'extn' want = 'obj ' class fonts_folder(aetools.NProperty): ! """fonts folder - the special folder named ³Fonts² """ which = 'font' want = 'obj ' class preferences_folder(aetools.NProperty): ! """preferences folder - the special folder named ³Preferences² """ which = 'pref' want = 'obj ' class shutdown_items_folder(aetools.NProperty): ! """shutdown items folder - the special folder named ³Shutdown Items² """ which = 'shdf' want = 'obj ' class startup_items_folder(aetools.NProperty): ! """startup items folder - the special folder named ³Startup Items² """ which = 'strt' want = 'obj ' class temporary_items_folder(aetools.NProperty): ! """temporary items folder - the special folder named ³Temporary Items² (invisible) """ which = 'temp' want = 'obj ' --- 236,268 ---- want = 'obj ' class apple_menu_items_folder(aetools.NProperty): ! """apple menu items folder - the special folder named –Apple Menu Items,” the contents of which appear in the Apple menu """ which = 'amnu' want = 'obj ' class control_panels_folder(aetools.NProperty): ! """control panels folder - the special folder named –Control Panels” """ which = 'ctrl' want = 'obj ' class extensions_folder(aetools.NProperty): ! """extensions folder - the special folder named –Extensions” """ which = 'extn' want = 'obj ' class fonts_folder(aetools.NProperty): ! """fonts folder - the special folder named –Fonts” """ which = 'font' want = 'obj ' class preferences_folder(aetools.NProperty): ! """preferences folder - the special folder named –Preferences” """ which = 'pref' want = 'obj ' class shutdown_items_folder(aetools.NProperty): ! """shutdown items folder - the special folder named –Shutdown Items” """ which = 'shdf' want = 'obj ' class startup_items_folder(aetools.NProperty): ! """startup items folder - the special folder named –Startup Items” """ which = 'strt' want = 'obj ' class temporary_items_folder(aetools.NProperty): ! """temporary items folder - the special folder named –Temporary Items” (invisible) """ which = 'temp' want = 'obj ' From jackjansen@users.sourceforge.net Thu May 17 13:40:30 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:40:30 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Finder Files_and_suitcases.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv27483/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Files_and_suitcases.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Files_and_suitcases.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Files_and_suitcases.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Files_and_suitcases.py 2000/08/22 20:35:16 1.2 --- Files_and_suitcases.py 2001/05/17 12:40:28 1.3 *************** *** 40,48 **** want = 'bool' class product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the ³Get Info² window) """ which = 'ver2' want = 'itxt' class version(aetools.NProperty): ! """version - the version of the file (visible at the bottom of the ³Get Info² window) """ which = 'vers' want = 'itxt' --- 40,48 ---- want = 'bool' class product_version(aetools.NProperty): ! """product version - the version of the product (visible at the top of the –Get Info” window) """ which = 'ver2' want = 'itxt' class version(aetools.NProperty): ! """version - the version of the file (visible at the bottom of the –Get Info” window) """ which = 'vers' want = 'itxt' *************** *** 51,55 **** class alias_file(aetools.ComponentItem): ! """alias file - An alias file (created with ³Make Alias²) """ want = 'alia' class original_item(aetools.NProperty): --- 51,55 ---- class alias_file(aetools.ComponentItem): ! """alias file - An alias file (created with –Make Alias”) """ want = 'alia' class original_item(aetools.NProperty): From jackjansen@users.sourceforge.net Thu May 17 13:40:35 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:40:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Finder Earlier_terms.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv27524/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Earlier_terms.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Earlier_terms.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Earlier_terms.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Earlier_terms.py 2000/08/22 20:35:16 1.2 --- Earlier_terms.py 2001/05/17 12:40:33 1.3 *************** *** 25,29 **** want = 'reco' class clipboard(aetools.NProperty): ! """clipboard - the Finder¹s clipboard window """ which = 'pcli' want = 'obj ' --- 25,29 ---- want = 'reco' class clipboard(aetools.NProperty): ! """clipboard - the FinderÕs clipboard window """ which = 'pcli' want = 'obj ' *************** *** 33,41 **** want = 'long' class name(aetools.NProperty): ! """name - the Finder¹s name """ which = 'pnam' want = 'itxt' class visible(aetools.NProperty): ! """visible - Is the Finder¹s layer visible? """ which = 'pvis' want = 'bool' --- 33,41 ---- want = 'long' class name(aetools.NProperty): ! """name - the FinderÕs name """ which = 'pnam' want = 'itxt' class visible(aetools.NProperty): ! """visible - Is the FinderÕs layer visible? """ which = 'pvis' want = 'bool' *************** *** 49,53 **** want = 'obj ' class insertion_location(aetools.NProperty): ! """insertion location - the container in which a new folder would appear if ³New Folder² was selected """ which = 'pins' want = 'obj ' --- 49,53 ---- want = 'obj ' class insertion_location(aetools.NProperty): ! """insertion location - the container in which a new folder would appear if –New Folder” was selected """ which = 'pins' want = 'obj ' *************** *** 69,73 **** want = 'itxt' class about_this_computer(aetools.NProperty): ! """about this computer - the ³About this Computer² dialog and the list of running processes displayed in it """ which = 'abbx' want = 'obj ' --- 69,73 ---- want = 'itxt' class about_this_computer(aetools.NProperty): ! """about this computer - the –About this Computer” dialog and the list of running processes displayed in it """ which = 'abbx' want = 'obj ' *************** *** 196,200 **** class information_window(aetools.ComponentItem): ! """information window - An information window (opened by ³Get Info²) """ want = 'iwnd' class comment(aetools.NProperty): --- 196,200 ---- class information_window(aetools.ComponentItem): ! """information window - An information window (opened by –Get Info”) """ want = 'iwnd' class comment(aetools.NProperty): *************** *** 360,364 **** class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the ³trash² object """ want = 'ctrs' --- 360,364 ---- class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the –trash” object """ want = 'ctrs' From jackjansen@users.sourceforge.net Thu May 17 13:40:40 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:40:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/Finder Containers_and_folders.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder In directory usw-pr-cvs1:/tmp/cvs-serv27556/Python/Mac/Lib/lib-scriptpackages/Finder Modified Files: Containers_and_folders.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Containers_and_folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/Finder/Containers_and_folders.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Containers_and_folders.py 2000/08/22 20:35:16 1.2 --- Containers_and_folders.py 2001/05/17 12:40:38 1.3 *************** *** 213,217 **** class desktop_2d_object(aetools.ComponentItem): ! """desktop-object - Desktop-object is the class of the ³desktop² object """ want = 'cdsk' class startup_disk(aetools.NProperty): --- 213,217 ---- class desktop_2d_object(aetools.ComponentItem): ! """desktop-object - Desktop-object is the class of the –desktop” object """ want = 'cdsk' class startup_disk(aetools.NProperty): *************** *** 243,247 **** class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the ³trash² object """ want = 'ctrs' class warns_before_emptying(aetools.NProperty): --- 243,247 ---- class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the –trash” object """ want = 'ctrs' class warns_before_emptying(aetools.NProperty): From jackjansen@users.sourceforge.net Thu May 17 13:40:46 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:40:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior Standard_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior In directory usw-pr-cvs1:/tmp/cvs-serv27583/Python/Mac/Lib/lib-scriptpackages/CodeWarrior Modified Files: Standard_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Standard_Suite.py 2000/08/17 22:16:11 1.1 --- Standard_Suite.py 2001/05/17 12:40:44 1.2 *************** *** 103,107 **** def make(self, _no_object=None, _attributes={}, **_arguments): """make: make a new element ! Keyword argument new: the class of the new element‹keyword 'new' is optional in AppleScript Keyword argument as: the desired types for the data, in order of preference Keyword argument at: the location at which to insert the element --- 103,107 ---- def make(self, _no_object=None, _attributes={}, **_arguments): """make: make a new element ! Keyword argument new: the class of the new element„keyword 'new' is optional in AppleScript Keyword argument as: the desired types for the data, in order of preference Keyword argument at: the location at which to insert the element From jackjansen@users.sourceforge.net Thu May 17 13:40:56 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:40:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior Metrowerks_Shell_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior In directory usw-pr-cvs1:/tmp/cvs-serv27608/Python/Mac/Lib/lib-scriptpackages/CodeWarrior Modified Files: Metrowerks_Shell_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Metrowerks_Shell_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Metrowerks_Shell_Suite.py 2000/08/17 22:16:11 1.1 --- Metrowerks_Shell_Suite.py 2001/05/17 12:40:54 1.2 *************** *** 792,796 **** class Access_Paths(aetools.ComponentItem): ! """Access Paths - Contains the definitions of a project¹s access (search) paths. """ want = 'PATH' class User_Paths(aetools.NProperty): --- 792,796 ---- class Access_Paths(aetools.ComponentItem): ! """Access Paths - Contains the definitions of a projectÕs access (search) paths. """ want = 'PATH' class User_Paths(aetools.NProperty): *************** *** 995,999 **** want = 'bool' class Confirm_Kill(aetools.NProperty): ! """Confirm Kill - Confirm the Œkilling¹ of the process. """ which = 'Dg04' want = 'bool' --- 995,999 ---- want = 'bool' class Confirm_Kill(aetools.NProperty): ! """Confirm Kill - Confirm the •killingÕ of the process. """ which = 'Dg04' want = 'bool' *************** *** 1007,1011 **** want = 'bool' class Dont_Step_in_Runtime(aetools.NProperty): ! """Dont Step in Runtime - Don¹t step into runtime code when debugging. """ which = 'Dg07' want = 'bool' --- 1007,1011 ---- want = 'bool' class Dont_Step_in_Runtime(aetools.NProperty): ! """Dont Step in Runtime - DonÕt step into runtime code when debugging. """ which = 'Dg07' want = 'bool' *************** *** 1044,1048 **** want = 'ctxt' class Cache_symbolics(aetools.NProperty): ! """Cache symbolics - Cache symbolics between runs when executable doesn¹t change, else release symbolics files after killing process. """ which = 'Dt15' want = 'bool' --- 1044,1048 ---- want = 'ctxt' class Cache_symbolics(aetools.NProperty): ! """Cache symbolics - Cache symbolics between runs when executable doesnÕt change, else release symbolics files after killing process. """ which = 'Dt15' want = 'bool' *************** *** 1072,1076 **** want = 'long' class Dynamic_Scroll(aetools.NProperty): ! """Dynamic Scroll - Display a window¹s contents as you move the scroll box. """ which = 'ED02' want = 'bool' --- 1072,1076 ---- want = 'long' class Dynamic_Scroll(aetools.NProperty): ! """Dynamic Scroll - Display a windowÕs contents as you move the scroll box. """ which = 'ED02' want = 'bool' *************** *** 1176,1184 **** want = 'bool' class Recent_Editor_Count(aetools.NProperty): ! """Recent Editor Count - Maximum number of editor documents to show in the ³Open Recent² menu """ which = 'EX16' want = 'shor' class Recent_Project_Count(aetools.NProperty): ! """Recent Project Count - Maximum number of project documents to show in the ³Open Recent² menu """ which = 'EX17' want = 'shor' --- 1176,1184 ---- want = 'bool' class Recent_Editor_Count(aetools.NProperty): ! """Recent Editor Count - Maximum number of editor documents to show in the –Open Recent” menu """ which = 'EX16' want = 'shor' class Recent_Project_Count(aetools.NProperty): ! """Recent Project Count - Maximum number of project documents to show in the –Open Recent” menu """ which = 'EX17' want = 'shor' *************** *** 1295,1299 **** want = 'PPrm' class root(aetools.NProperty): ! """root - Name of the root of the relative path. Pre-defined values are ³Absolute², ³Project², ³CodeWarrior², and ³System². Anything else is a user-defined root. """ which = 'Root' want = 'TEXT' --- 1295,1299 ---- want = 'PPrm' class root(aetools.NProperty): ! """root - Name of the root of the relative path. Pre-defined values are –Absolute”, –Project”, –CodeWarrior”, and –System”. Anything else is a user-defined root. """ which = 'Root' want = 'TEXT' *************** *** 1326,1337 **** which = 'SrcT' want = 'SrcT' ! # repeated property name The file¹s name ! # repeated property disk_file The file¹s location on disk class codesize(aetools.NProperty): ! """codesize - The size of this file¹s code. """ which = 'CSiz' want = 'long' class datasize(aetools.NProperty): ! """datasize - The size of this file¹s data. """ which = 'DSiz' want = 'long' --- 1326,1337 ---- which = 'SrcT' want = 'SrcT' ! # repeated property name The fileÕs name ! # repeated property disk_file The fileÕs location on disk class codesize(aetools.NProperty): ! """codesize - The size of this fileÕs code. """ which = 'CSiz' want = 'long' class datasize(aetools.NProperty): ! """datasize - The size of this fileÕs data. """ which = 'DSiz' want = 'long' *************** *** 1477,1481 **** class Target_Settings(aetools.ComponentItem): ! """Target Settings - Contains the definitions of a project¹s target. """ want = 'TARG' class Linker(aetools.NProperty): --- 1477,1481 ---- class Target_Settings(aetools.ComponentItem): ! """Target Settings - Contains the definitions of a projectÕs target. """ want = 'TARG' class Linker(aetools.NProperty): *************** *** 1496,1504 **** want = 'TEXT' class Output_Directory_Path(aetools.NProperty): ! """Output Directory Path - Path to output directory. Usage of this property is deprecated. Use the ³Output Directory Location² property instead. """ which = 'TA11' want = 'TEXT' class Output_Directory_Origin(aetools.NProperty): ! """Output Directory Origin - Origin of path to output directory. Usage of this property is deprecated. Use the ³Output Directory Location² property instead. """ which = 'TA12' want = 'PPrm' --- 1496,1504 ---- want = 'TEXT' class Output_Directory_Path(aetools.NProperty): ! """Output Directory Path - Path to output directory. Usage of this property is deprecated. Use the –Output Directory Location” property instead. """ which = 'TA11' want = 'TEXT' class Output_Directory_Origin(aetools.NProperty): ! """Output Directory Origin - Origin of path to output directory. Usage of this property is deprecated. Use the –Output Directory Location” property instead. """ which = 'TA12' want = 'PPrm' *************** *** 2044,2049 **** _Enum_PPrm = { 'absolute' : 'Abso', # An absolute path name, including volume name. ! 'project_relative' : 'PRel', # A path relative to the current project¹s folder. ! 'shell_relative' : 'SRel', # A path relative to the CodeWarrior folder. 'system_relative' : 'YRel', # A path relative to the system folder 'root_relative' : 'RRel', # --- 2044,2049 ---- _Enum_PPrm = { 'absolute' : 'Abso', # An absolute path name, including volume name. ! 'project_relative' : 'PRel', # A path relative to the current projectÕs folder. ! 'shell_relative' : 'SRel', # A path relative to the CodeWarriorŽ folder. 'system_relative' : 'YRel', # A path relative to the system folder 'root_relative' : 'RRel', # *************** *** 2051,2055 **** _Enum_DbSA = { ! 'No_Action' : 'DSA1', # Don¹t do anything to non-debug windows 'Hide_Windows' : 'DSA2', # Hide non-debugging windows 'Collapse_Windows' : 'DSA3', # Collapse non-debugging windows --- 2051,2055 ---- _Enum_DbSA = { ! 'No_Action' : 'DSA1', # DonÕt do anything to non-debug windows 'Hide_Windows' : 'DSA2', # Hide non-debugging windows 'Collapse_Windows' : 'DSA3', # Collapse non-debugging windows *************** *** 2104,2110 **** _Enum_STKd = { ! 'Absolute_Path' : 'STK0', # The ³path² property is an absolute path to the location of the source tree. ! 'Registry_Key' : 'STK1', # The ³path² property is the name of a registry key that contains the path to the root. ! 'Environment_Variable' : 'STK2', # The ³path² property is the name of an environment variable that contains the path to the root. } --- 2104,2110 ---- _Enum_STKd = { ! 'Absolute_Path' : 'STK0', # The –path” property is an absolute path to the location of the source tree. ! 'Registry_Key' : 'STK1', # The –path” property is the name of a registry key that contains the path to the root. ! 'Environment_Variable' : 'STK2', # The –path” property is the name of an environment variable that contains the path to the root. } From jackjansen@users.sourceforge.net Thu May 17 13:41:01 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:41:01 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior CodeWarrior_suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior In directory usw-pr-cvs1:/tmp/cvs-serv27643/Python/Mac/Lib/lib-scriptpackages/CodeWarrior Modified Files: CodeWarrior_suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: CodeWarrior_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scriptpackages/CodeWarrior/CodeWarrior_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** CodeWarrior_suite.py 2000/08/17 22:16:10 1.1 --- CodeWarrior_suite.py 2001/05/17 12:40:59 1.2 *************** *** 397,401 **** want = 'bool' class link_index(aetools.NProperty): ! """link index - the index of the source file in its target¹s link order (-1 if source file is not in link order) """ which = 'LIDX' want = 'long' --- 397,401 ---- want = 'bool' class link_index(aetools.NProperty): ! """link index - the index of the source file in its targetÕs link order (-1 if source file is not in link order) """ which = 'LIDX' want = 'long' *************** *** 425,429 **** want = 'bool' class init_before(aetools.NProperty): ! """init before - is the Œinitialize before¹ flag set for this shared library? """ which = 'INIT' want = 'bool' --- 425,429 ---- want = 'bool' class init_before(aetools.NProperty): ! """init before - is the •initialize beforeÕ flag set for this shared library? """ which = 'INIT' want = 'bool' From jackjansen@users.sourceforge.net Thu May 17 13:41:06 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:41:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scripting WWW_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting In directory usw-pr-cvs1:/tmp/cvs-serv27696/Python/Mac/Lib/lib-scripting Modified Files: WWW_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: WWW_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting/WWW_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** WWW_Suite.py 1997/12/18 17:47:12 1.1 --- WWW_Suite.py 2001/05/17 12:41:04 1.2 *************** *** 2,6 **** Level 1, version 1 ! Generated from flap:Programma's:Netscape Navigator Folder:Netscape Navigator 3.01 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 2,6 ---- Level 1, version 1 ! Generated from flap:Programma's:Netscape NavigatorŽ Folder:Netscape NavigatorŽ 3.01 AETE/AEUT resource version 1/0, language 0, script 0 """ *************** *** 213,217 **** def register_URL_echo(self, _object=None, _attributes={}, **_arguments): ! """register URL echo: Registers the ³echo² application. Each download from now on will be echoed to this application. Required argument: Application signature Keyword argument _attributes: AppleEvent attribute dictionary --- 213,217 ---- def register_URL_echo(self, _object=None, _attributes={}, **_arguments): ! """register URL echo: Registers the –echo” application. Each download from now on will be echoed to this application. Required argument: Application signature Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 258,262 **** def register_viewer(self, _object, _attributes={}, **_arguments): ! """register viewer: Registers an application as a Œspecial¹ viewer for this MIME type. The application will be launched with ViewDoc events Required argument: Application sig Keyword argument MIME_type: MIME type viewer is registering for --- 258,262 ---- def register_viewer(self, _object, _attributes={}, **_arguments): ! """register viewer: Registers an application as a •specialÕ viewer for this MIME type. The application will be launched with ViewDoc events Required argument: Application sig Keyword argument MIME_type: MIME type viewer is registering for *************** *** 311,317 **** def register_protocol(self, _object=None, _attributes={}, **_arguments): ! """register protocol: Registers application as a ³handler² for this protocol with a given prefix. The handler will receive ³OpenURL², or if that fails, ³GetURL² event. Required argument: Application sig ! Keyword argument for_protocol: protocol prefix: ³finger:², ³file², Keyword argument _attributes: AppleEvent attribute dictionary Returns: TRUE if registration has been successful --- 311,317 ---- def register_protocol(self, _object=None, _attributes={}, **_arguments): ! """register protocol: Registers application as a –handler” for this protocol with a given prefix. The handler will receive –OpenURL”, or if that fails, –GetURL” event. Required argument: Application sig ! Keyword argument for_protocol: protocol prefix: –finger:”, –file”, Keyword argument _attributes: AppleEvent attribute dictionary Returns: TRUE if registration has been successful *************** *** 337,341 **** def unregister_protocol(self, _object=None, _attributes={}, **_arguments): ! """unregister protocol: reverses the effects of ³register protocol² Required argument: Application sig. Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols --- 337,341 ---- def unregister_protocol(self, _object=None, _attributes={}, **_arguments): ! """unregister protocol: reverses the effects of –register protocol” Required argument: Application sig. Keyword argument for_protocol: protocol prefix. If none, unregister for all protocols From jackjansen@users.sourceforge.net Thu May 17 13:41:10 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:41:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scripting Standard_URL_suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting In directory usw-pr-cvs1:/tmp/cvs-serv27730/Python/Mac/Lib/lib-scripting Modified Files: Standard_URL_suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Standard_URL_suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting/Standard_URL_suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Standard_URL_suite.py 1997/12/18 17:46:27 1.1 --- Standard_URL_suite.py 2001/05/17 12:41:08 1.2 *************** *** 5,9 **** Level 1, version 1 ! Generated from flap:Programma's:Netscape Navigator Folder:Netscape Navigator 3.01 AETE/AEUT resource version 1/0, language 0, script 0 """ --- 5,9 ---- Level 1, version 1 ! Generated from flap:Programma's:Netscape NavigatorŽ Folder:Netscape NavigatorŽ 3.01 AETE/AEUT resource version 1/0, language 0, script 0 """ From jackjansen@users.sourceforge.net Thu May 17 13:41:16 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:41:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scripting Standard_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting In directory usw-pr-cvs1:/tmp/cvs-serv27770/Python/Mac/Lib/lib-scripting Modified Files: Standard_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Standard_Suite.py 1997/12/18 17:46:16 1.1 --- Standard_Suite.py 2001/05/17 12:41:14 1.2 *************** *** 22,26 **** Keyword argument _in: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: a record containing the object¹s properties and elements """ _code = 'core' --- 22,26 ---- Keyword argument _in: the human language and script system in which to return information Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: a record containing the objectÕs properties and elements """ _code = 'core' *************** *** 616,624 **** """> - Greater than""" class _b3_(aetools.NComparison): ! """„ - Greater than or equal to""" class _3c_(aetools.NComparison): """< - Less than""" class _b2_(aetools.NComparison): ! """¾ - Less than or equal to""" _Enum_savo = { 'yes' : 'yes ', # Save objects now --- 616,624 ---- """> - Greater than""" class _b3_(aetools.NComparison): ! """³ - Greater than or equal to""" class _3c_(aetools.NComparison): """< - Less than""" class _b2_(aetools.NComparison): ! """² - Less than or equal to""" _Enum_savo = { 'yes' : 'yes ', # Save objects now From jackjansen@users.sourceforge.net Thu May 17 13:41:24 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:41:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scripting Metrowerks_Shell_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting In directory usw-pr-cvs1:/tmp/cvs-serv27798/Python/Mac/Lib/lib-scripting Modified Files: Metrowerks_Shell_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Metrowerks_Shell_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting/Metrowerks_Shell_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Metrowerks_Shell_Suite.py 1997/12/18 17:45:31 1.1 --- Metrowerks_Shell_Suite.py 2001/05/17 12:41:22 1.2 *************** *** 792,796 **** class Access_Paths(aetools.ComponentItem): ! """Access Paths - Contains the definitions of a project¹s access (search) paths.""" want = 'PATH' class User_Paths(aetools.NProperty): --- 792,796 ---- class Access_Paths(aetools.ComponentItem): ! """Access Paths - Contains the definitions of a projectÕs access (search) paths.""" want = 'PATH' class User_Paths(aetools.NProperty): *************** *** 815,819 **** want = 'long' class Dynamic_scroll(aetools.NProperty): ! """Dynamic scroll - Display a window¹s contents as you move the scroll box.""" which = 'ED02' want = 'bool' --- 815,819 ---- want = 'long' class Dynamic_scroll(aetools.NProperty): ! """Dynamic scroll - Display a windowÕs contents as you move the scroll box.""" which = 'ED02' want = 'bool' *************** *** 1112,1123 **** which = 'SrcT' want = 'SrcT' ! # repeated property name The file¹s name ! # repeated property disk_file The file¹s location on disk class codesize(aetools.NProperty): ! """codesize - The size of this file¹s code.""" which = 'CSiz' want = 'long' class datasize(aetools.NProperty): ! """datasize - The size of this file¹s data.""" which = 'DSiz' want = 'long' --- 1112,1123 ---- which = 'SrcT' want = 'SrcT' ! # repeated property name The fileÕs name ! # repeated property disk_file The fileÕs location on disk class codesize(aetools.NProperty): ! """codesize - The size of this fileÕs code.""" which = 'CSiz' want = 'long' class datasize(aetools.NProperty): ! """datasize - The size of this fileÕs data.""" which = 'DSiz' want = 'long' *************** *** 1173,1177 **** class Target_Settings(aetools.ComponentItem): ! """Target Settings - Contains the definitions of a project¹s target.""" want = 'TARG' class Linker(aetools.NProperty): --- 1173,1177 ---- class Target_Settings(aetools.ComponentItem): ! """Target Settings - Contains the definitions of a projectÕs target.""" want = 'TARG' class Linker(aetools.NProperty): *************** *** 1625,1630 **** _Enum_PPrm = { 'absolute' : 'Abso', # An absolute path name, including volume name. ! 'project_relative' : 'PRel', # A path relative to the current project¹s folder. ! 'shell_relative' : 'SRel', # A path relative to the CodeWarrior folder. 'system_relative' : 'YRel', # A path relative to the system folder } --- 1625,1630 ---- _Enum_PPrm = { 'absolute' : 'Abso', # An absolute path name, including volume name. ! 'project_relative' : 'PRel', # A path relative to the current projectÕs folder. ! 'shell_relative' : 'SRel', # A path relative to the CodeWarriorŽ folder. 'system_relative' : 'YRel', # A path relative to the system folder } From jackjansen@users.sourceforge.net Thu May 17 13:41:32 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:41:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scripting Finder_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting In directory usw-pr-cvs1:/tmp/cvs-serv27833/Python/Mac/Lib/lib-scripting Modified Files: Finder_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Finder_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting/Finder_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Finder_Suite.py 1997/12/18 17:45:19 1.1 --- Finder_Suite.py 2001/05/17 12:41:30 1.2 *************** *** 86,90 **** def empty(self, _object=None, _attributes={}, **_arguments): """empty: Empty the trash ! Required argument: ³empty² and ³empty trash² both do the same thing Keyword argument _attributes: AppleEvent attribute dictionary """ --- 86,90 ---- def empty(self, _object=None, _attributes={}, **_arguments): """empty: Empty the trash ! Required argument: –empty” and –empty trash” both do the same thing Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 312,316 **** class alias_file(aetools.ComponentItem): ! """alias file - An alias file (created with ³Make Alias²)""" want = 'alia' class original_item(aetools.NProperty): --- 312,316 ---- class alias_file(aetools.ComponentItem): ! """alias file - An alias file (created with –Make Alias”)""" want = 'alia' class original_item(aetools.NProperty): *************** *** 325,333 **** want = 'capp' class about_this_macintosh(aetools.NProperty): ! """about this macintosh - the ³About this Macintosh² dialog, and the list of running processes displayed in it""" which = 'abbx' want = 'obj ' class apple_menu_items_folder(aetools.NProperty): ! """apple menu items folder - the special folder ³Apple Menu Items,² the contents of which appear in the Apple menu""" which = 'amnu' want = 'obj ' --- 325,333 ---- want = 'capp' class about_this_macintosh(aetools.NProperty): ! """about this macintosh - the –About this Macintosh” dialog, and the list of running processes displayed in it""" which = 'abbx' want = 'obj ' class apple_menu_items_folder(aetools.NProperty): ! """apple menu items folder - the special folder –Apple Menu Items,” the contents of which appear in the Apple menu""" which = 'amnu' want = 'obj ' *************** *** 337,341 **** want = 'obj ' class control_panels_folder(aetools.NProperty): ! """control panels folder - the special folder ³Control Panels²""" which = 'ctrl' want = 'obj ' --- 337,341 ---- want = 'obj ' class control_panels_folder(aetools.NProperty): ! """control panels folder - the special folder –Control Panels”""" which = 'ctrl' want = 'obj ' *************** *** 345,349 **** want = 'obj ' class extensions_folder(aetools.NProperty): ! """extensions folder - the special folder ³Extensions²""" which = 'extn' want = 'obj ' --- 345,349 ---- want = 'obj ' class extensions_folder(aetools.NProperty): ! """extensions folder - the special folder –Extensions”""" which = 'extn' want = 'obj ' *************** *** 353,357 **** want = 'bool' class fonts_folder(aetools.NProperty): ! """fonts folder - the special folder ³Fonts²""" which = 'ffnt' want = 'obj ' --- 353,357 ---- want = 'bool' class fonts_folder(aetools.NProperty): ! """fonts folder - the special folder –Fonts”""" which = 'ffnt' want = 'obj ' *************** *** 361,365 **** want = 'bool' class insertion_location(aetools.NProperty): ! """insertion location - the container that a new folder would appear in if ³New Folder² was selected""" which = 'pins' want = 'obj ' --- 361,365 ---- want = 'bool' class insertion_location(aetools.NProperty): ! """insertion location - the container that a new folder would appear in if –New Folder” was selected""" which = 'pins' want = 'obj ' *************** *** 369,373 **** want = 'long' class preferences_folder(aetools.NProperty): ! """preferences folder - the special folder ³Preferences²""" which = 'pref' want = 'obj ' --- 369,373 ---- want = 'long' class preferences_folder(aetools.NProperty): ! """preferences folder - the special folder –Preferences”""" which = 'pref' want = 'obj ' *************** *** 385,397 **** want = 'bool' class shortcuts(aetools.NProperty): ! """shortcuts - the ³Finder Shortcuts² item in the Finder's help menu""" which = 'scut' want = 'obj ' class shutdown_items_folder(aetools.NProperty): ! """shutdown items folder - the special folder ³Shutdown Items²""" which = 'shdf' want = 'obj ' class startup_items_folder(aetools.NProperty): ! """startup items folder - the special folder ³Startup Items²""" which = 'strt' want = 'obj ' --- 385,397 ---- want = 'bool' class shortcuts(aetools.NProperty): ! """shortcuts - the –Finder Shortcuts” item in the Finder's help menu""" which = 'scut' want = 'obj ' class shutdown_items_folder(aetools.NProperty): ! """shutdown items folder - the special folder –Shutdown Items”""" which = 'shdf' want = 'obj ' class startup_items_folder(aetools.NProperty): ! """startup items folder - the special folder –Startup Items”""" which = 'strt' want = 'obj ' *************** *** 401,405 **** want = 'obj ' class temporary_items_folder(aetools.NProperty): ! """temporary items folder - the special folder ³Temporary Items² (invisible)""" which = 'temp' want = 'obj ' --- 401,405 ---- want = 'obj ' class temporary_items_folder(aetools.NProperty): ! """temporary items folder - the special folder –Temporary Items” (invisible)""" which = 'temp' want = 'obj ' *************** *** 563,567 **** class content_space(aetools.ComponentItem): ! """content space - All windows, including the desktop window (³Window² does not include the desktop window)""" want = 'dwnd' --- 563,567 ---- class content_space(aetools.ComponentItem): ! """content space - All windows, including the desktop window (–Window” does not include the desktop window)""" want = 'dwnd' *************** *** 633,637 **** class desktop_2d_object(aetools.ComponentItem): ! """desktop-object - Desktop-object is the class of the ³desktop² object""" want = 'cdsk' class startup_disk(aetools.NProperty): --- 633,637 ---- class desktop_2d_object(aetools.ComponentItem): ! """desktop-object - Desktop-object is the class of the –desktop” object""" want = 'cdsk' class startup_disk(aetools.NProperty): *************** *** 721,730 **** which = 'islk' want = 'bool' ! # repeated property product_version the version of the product (visible at the top of the ³Get Info² dialog) class stationery(aetools.NProperty): """stationery - Is the item a stationery pad?""" which = 'pspd' want = 'bool' ! # repeated property version the version of the file (visible at the bottom of the ³Get Info² dialog) files = file --- 721,730 ---- which = 'islk' want = 'bool' ! # repeated property product_version the version of the product (visible at the top of the –Get Info” dialog) class stationery(aetools.NProperty): """stationery - Is the item a stationery pad?""" which = 'pspd' want = 'bool' ! # repeated property version the version of the file (visible at the bottom of the –Get Info” dialog) files = file *************** *** 791,795 **** class information_window(aetools.ComponentItem): ! """information window - An information window (opened by ³Get InfoŠ²)""" want = 'iwnd' class comment(aetools.NProperty): --- 791,795 ---- class information_window(aetools.ComponentItem): ! """information window - An information window (opened by –Get Infoƒ”)""" want = 'iwnd' class comment(aetools.NProperty): *************** *** 814,818 **** which = 'phys' want = 'long' ! # repeated property product_version the version of the product (visible at the top of the ³Get Info² dialog) class size(aetools.NProperty): """size - the logical size of the item""" --- 814,818 ---- which = 'phys' want = 'long' ! # repeated property product_version the version of the product (visible at the top of the –Get Info” dialog) class size(aetools.NProperty): """size - the logical size of the item""" *************** *** 821,827 **** # repeated property stationery Is the item a stationery pad? # repeated property suggested_partition_size the memory size that the developer recommends that the application should be launched with ! # repeated property version the version of the file (visible at the bottom of the ³Get Info² dialog) class warn_before_emptying(aetools.NProperty): ! """warn before emptying - Is a dialog displayed when ³Empty trashŠ² is selected?""" which = 'warn' want = 'bool' --- 821,827 ---- # repeated property stationery Is the item a stationery pad? # repeated property suggested_partition_size the memory size that the developer recommends that the application should be launched with ! # repeated property version the version of the file (visible at the bottom of the –Get Info” dialog) class warn_before_emptying(aetools.NProperty): ! """warn before emptying - Is a dialog displayed when –Empty trashƒ” is selected?""" which = 'warn' want = 'bool' *************** *** 833,837 **** want = 'cobj' # repeated property bounds the bounding rectangle of the item ! # repeated property comment the comment displayed in the ³Get Info² window of the item # repeated property container the container of this item class content_space(aetools.NProperty): --- 833,837 ---- want = 'cobj' # repeated property bounds the bounding rectangle of the item ! # repeated property comment the comment displayed in the –Get Info” window of the item # repeated property container the container of this item class content_space(aetools.NProperty): *************** *** 979,983 **** class sharing_window(aetools.ComponentItem): ! """sharing window - A sharing window (opened by ³SharingŠ²)""" want = 'swnd' # repeated property container the container that this window was opened from --- 979,983 ---- class sharing_window(aetools.ComponentItem): ! """sharing window - A sharing window (opened by –Sharingƒ”)""" want = 'swnd' # repeated property container the container that this window was opened from *************** *** 1021,1027 **** class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the ³trash² object""" want = 'ctrs' ! # repeated property warn_before_emptying Is a dialog displayed when ³Empty trashŠ² is selected? # element 'dsut' as ['indx', 'name'] # element 'alia' as ['indx', 'name'] --- 1021,1027 ---- class trash_2d_object(aetools.ComponentItem): ! """trash-object - Trash-object is the class of the –trash” object""" want = 'ctrs' ! # repeated property warn_before_emptying Is a dialog displayed when –Empty trashƒ” is selected? # element 'dsut' as ['indx', 'name'] # element 'alia' as ['indx', 'name'] From jackjansen@users.sourceforge.net Thu May 17 13:41:37 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:41:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scripting CodeWarrior_Standard_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting In directory usw-pr-cvs1:/tmp/cvs-serv27871/Python/Mac/Lib/lib-scripting Modified Files: CodeWarrior_Standard_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: CodeWarrior_Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting/CodeWarrior_Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** CodeWarrior_Standard_Suite.py 1997/12/18 17:44:57 1.1 --- CodeWarrior_Standard_Suite.py 2001/05/17 12:41:35 1.2 *************** *** 205,209 **** want = 'long' class mode(aetools.NProperty): ! """mode - The document¹s open mode""" which = 'Mode' want = 'Mode' --- 205,209 ---- want = 'long' class mode(aetools.NProperty): ! """mode - The documentÕs open mode""" which = 'Mode' want = 'Mode' From jackjansen@users.sourceforge.net Thu May 17 13:41:44 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:41:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib/lib-scripting AppleScript_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting In directory usw-pr-cvs1:/tmp/cvs-serv27909/Python/Mac/Lib/lib-scripting Modified Files: AppleScript_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: AppleScript_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/lib-scripting/AppleScript_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** AppleScript_Suite.py 1997/12/18 17:44:45 1.1 --- AppleScript_Suite.py 2001/05/17 12:41:42 1.2 *************** *** 276,280 **** def Call_a5_subroutine(self, _object=None, _attributes={}, **_arguments): ! """Call€subroutine: A subroutine call Required argument: anything Keyword argument at: a preposition --- 276,280 ---- def Call_a5_subroutine(self, _object=None, _attributes={}, **_arguments): ! """Call‚subroutine: A subroutine call Required argument: anything Keyword argument at: a preposition *************** *** 348,352 **** def _ad_(self, _object, _attributes={}, **_arguments): ! """‚: Inequality Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary --- 348,352 ---- def _ad_(self, _object, _attributes={}, **_arguments): ! """­: Inequality Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 537,541 **** def _b3_(self, _object, _attributes={}, **_arguments): ! """„: Greater than or equal to Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary --- 537,541 ---- def _b3_(self, _object, _attributes={}, **_arguments): ! """³: Greater than or equal to Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 579,583 **** def _b2_(self, _object, _attributes={}, **_arguments): ! """¾: Less than or equal to Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary --- 579,583 ---- def _b2_(self, _object, _attributes={}, **_arguments): ! """²: Less than or equal to Required argument: an AE object reference Keyword argument _attributes: AppleEvent attribute dictionary From jackjansen@users.sourceforge.net Thu May 17 13:44:33 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:44:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib findertools.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28574/Python/Mac/Lib Modified Files: findertools.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: findertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/findertools.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** findertools.py 2001/04/07 12:52:15 1.5 --- findertools.py 2001/05/17 12:44:31 1.6 *************** *** 122,126 **** def comment(object, comment=None): ! """comment: get or set the Finder-comment of the item, displayed in the ³Get Info² window.""" object = macfs.FSSpec(object) fss = macfs.FSSpec(object) --- 122,126 ---- def comment(object, comment=None): ! """comment: get or set the Finder-comment of the item, displayed in the –Get Info” window.""" object = macfs.FSSpec(object) fss = macfs.FSSpec(object) *************** *** 757,761 **** def _test2(): ! print '\nmorefindertools version %s\nTests coming upŠ' %__version__ import os import random --- 757,761 ---- def _test2(): ! print '\nmorefindertools version %s\nTests coming upƒ' %__version__ import os import random *************** *** 801,805 **** windowposition(base, pos) print '\twindow position', pos ! windowposition(base, orgpos) # park it where it was beforeŠ print 'Put a comment in file', f, ':' --- 801,805 ---- windowposition(base, pos) print '\twindow position', pos ! windowposition(base, orgpos) # park it where it was beforeƒ print 'Put a comment in file', f, ':' From jackjansen@users.sourceforge.net Thu May 17 13:44:37 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:44:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Lib cfmfile.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28606/Python/Mac/Lib Modified Files: cfmfile.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: cfmfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Lib/cfmfile.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cfmfile.py 2000/06/20 21:59:24 1.2 --- cfmfile.py 2001/05/17 12:44:35 1.3 *************** *** 71,75 **** data = Res.Get1Resource('cfrg', 0).data except Res.Error: ! raise Res.Error, "no Œcfrg¹ resource found", sys.exc_traceback finally: Res.CloseResFile(resref) --- 71,75 ---- data = Res.Get1Resource('cfrg', 0).data except Res.Error: ! raise Res.Error, "no •cfrgÕ resource found", sys.exc_traceback finally: Res.CloseResFile(resref) *************** *** 147,151 **** def getfragment(self): if self.where <> 1: ! raise error, "can¹t read fragment, unsupported location" f = open(self.path, "rb") f.seek(self.offset) --- 147,151 ---- def getfragment(self): if self.where <> 1: ! raise error, "canÕt read fragment, unsupported location" f = open(self.path, "rb") f.seek(self.offset) *************** *** 159,163 **** def copydata(self, outfile): if self.where <> 1: ! raise error, "can¹t read fragment, unsupported location" infile = open(self.path, "rb") if self.length == 0: --- 159,163 ---- def copydata(self, outfile): if self.where <> 1: ! raise error, "canÕt read fragment, unsupported location" infile = open(self.path, "rb") if self.length == 0: From jackjansen@users.sourceforge.net Thu May 17 13:44:42 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:44:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/IDE scripts/Hack Toolbox Assistant...,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/IDE scripts/Hack In directory usw-pr-cvs1:/tmp/cvs-serv28622/Python/Mac/IDE scripts/Hack Modified Files: Toolbox Assistant... Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. ***** Bogus filespec: scripts/Hack ***** Bogus filespec: Toolbox From jackjansen@users.sourceforge.net Thu May 17 13:44:47 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:44:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Demo/applescript/Disk_Copy Standard_Suite.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Demo/applescript/Disk_Copy In directory usw-pr-cvs1:/tmp/cvs-serv28640/Python/Mac/Demo/applescript/Disk_Copy Modified Files: Standard_Suite.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Standard_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/applescript/Disk_Copy/Standard_Suite.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Standard_Suite.py 2000/08/20 21:57:30 1.1 --- Standard_Suite.py 2001/05/17 12:44:45 1.2 *************** *** 31,35 **** Keyword argument using_format: the format for the target Keyword argument checksum_verification: Should the checksum be verified before saving? ! Keyword argument signature_verification: Should the DigiSign signature be verified before saving? Keyword argument image_signing: Should the image be signed? Keyword argument leave_image_mounted: Should the image be mounted after saving? --- 31,35 ---- Keyword argument using_format: the format for the target Keyword argument checksum_verification: Should the checksum be verified before saving? ! Keyword argument signature_verification: Should the DigiSignŽ signature be verified before saving? Keyword argument image_signing: Should the image be signed? Keyword argument leave_image_mounted: Should the image be mounted after saving? *************** *** 259,263 **** want = 'TEXT' class signed(aetools.NProperty): ! """signed - Does the disk image have a DigiSign signature? """ which = 'Isin' want = 'bool' --- 259,263 ---- want = 'TEXT' class signed(aetools.NProperty): ! """signed - Does the disk image have a DigiSignŽ signature? """ which = 'Isin' want = 'bool' *************** *** 385,389 **** } _Enum_UIAc = { ! 'never_interact' : 'eNvr', # Don¹t allow any interaction at all 'interact_with_self' : 'eInS', # Only allow interaction from internal events 'interact_with_local' : 'eInL', # Allow interaction from any event originating on this machine --- 385,389 ---- } _Enum_UIAc = { ! 'never_interact' : 'eNvr', # DonÕt allow any interaction at all 'interact_with_self' : 'eInS', # Only allow interaction from internal events 'interact_with_local' : 'eInL', # Allow interaction from any event originating on this machine *************** *** 400,404 **** _Enum_rcpT = { 'block_disk_copy' : 'cpBl', # block-by-block disk-level copy ! 'files_and_file_ID_copy' : 'cpID', # all files including desktop databases and file ID¹s 'files_and_desktop_info' : 'cpDT', # all files and most desktop information 'files_only' : 'cpFI', # all files but no desktop information --- 400,404 ---- _Enum_rcpT = { 'block_disk_copy' : 'cpBl', # block-by-block disk-level copy ! 'files_and_file_ID_copy' : 'cpID', # all files including desktop databases and file IDÕs 'files_and_desktop_info' : 'cpDT', # all files and most desktop information 'files_only' : 'cpFI', # all files but no desktop information From jackjansen@users.sourceforge.net Thu May 17 13:44:51 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:44:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Contrib/PythonScript ReadMe.txt,1.1.1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Contrib/PythonScript In directory usw-pr-cvs1:/tmp/cvs-serv28655/Python/Mac/Contrib/PythonScript Modified Files: ReadMe.txt Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: ReadMe.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Contrib/PythonScript/ReadMe.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** ReadMe.txt 1998/08/18 14:55:17 1.1.1.1 --- ReadMe.txt 2001/05/17 12:44:49 1.2 *************** *** 30,34 **** Object is a appleevent object specifier and is of the form ! PythonScript.PsClass.Class1(arg).Class2(arg)Š.Property() All applescript event, class and property names are capitalised to --- 30,34 ---- Object is a appleevent object specifier and is of the form ! PythonScript.PsClass.Class1(arg).Class2(arg)ƒ.Property() All applescript event, class and property names are capitalised to From jackjansen@users.sourceforge.net Thu May 17 13:44:56 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:44:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Contrib/BBPy.lm PythonBBLM.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Contrib/BBPy.lm In directory usw-pr-cvs1:/tmp/cvs-serv28687/Python/Mac/Contrib/BBPy.lm Modified Files: PythonBBLM.txt Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: PythonBBLM.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Contrib/BBPy.lm/PythonBBLM.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** PythonBBLM.txt 2001/04/06 08:34:55 1.2 --- PythonBBLM.txt 2001/05/17 12:44:54 1.3 *************** *** 3,7 **** This software is a plugin to Bare Bones Software's BBEdit 6.0.2 (or more), designed to make editing & browsing Python Language files easer. ! It parses any file ending in .py (or extentions of your choice.) providing BBEdit with the information BBEdit needs to provide services for python files similar to those it provides for 'C'. Namely: syntax coloring and populating BBEdit's 'Ÿ' popup menu with file's functions and classes. This Plug-in needs to be placed in your :BBEdit 6.0:BBEdit Support:Language Modules: folder. --- 3,7 ---- This software is a plugin to Bare Bones Software's BBEdit 6.0.2 (or more), designed to make editing & browsing Python Language files easer. ! It parses any file ending in .py (or extentions of your choice.) providing BBEdit with the information BBEdit needs to provide services for python files similar to those it provides for 'C'. Namely: syntax coloring and populating BBEdit's '€' popup menu with file's functions and classes. This Plug-in needs to be placed in your :BBEdit 6.0:BBEdit Support:Language Modules: folder. From jackjansen@users.sourceforge.net Thu May 17 13:45:00 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:45:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Contrib/BBPy.lm BBPy.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Contrib/BBPy.lm In directory usw-pr-cvs1:/tmp/cvs-serv28721/Python/Mac/Contrib/BBPy.lm Modified Files: BBPy.c Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: BBPy.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Contrib/BBPy.lm/BBPy.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** BBPy.c 2001/03/10 13:24:40 1.1 --- BBPy.c 2001/05/17 12:44:58 1.2 *************** *** 57,61 **** r.pos = pb.fCalcRunParams.fStartOffset; r.p = ((unsigned char*)pb.fText) + pb.fCalcRunParams.fStartOffset; ! // Adjust for the gap if we¹re not already past it. if ((!r.past_gap) && (r.pos >= pb.fTextGapLocation)){ r.p += pb.fTextGapLength; --- 57,61 ---- r.pos = pb.fCalcRunParams.fStartOffset; r.p = ((unsigned char*)pb.fText) + pb.fCalcRunParams.fStartOffset; ! // Adjust for the gap if weÕre not already past it. if ((!r.past_gap) && (r.pos >= pb.fTextGapLocation)){ r.p += pb.fTextGapLength; From jackjansen@users.sourceforge.net Thu May 17 13:45:06 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:45:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Contrib/BBPy PythonSlave.py,1.1.1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Contrib/BBPy In directory usw-pr-cvs1:/tmp/cvs-serv28777/Python/Mac/Contrib/BBPy Modified Files: PythonSlave.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: PythonSlave.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Contrib/BBPy/PythonSlave.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** PythonSlave.py 1998/08/18 14:54:12 1.1.1.1 --- PythonSlave.py 2001/05/17 12:45:04 1.2 *************** *** 64,68 **** def getabouttext(self): ! return "About PythonSlaveŠ" def do_about(self, id, item, window, event): --- 64,68 ---- def getabouttext(self): ! return "About PythonSlaveƒ" def do_about(self, id, item, window, event): From jackjansen@users.sourceforge.net Thu May 17 13:45:11 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:45:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Contrib/AECaptureParser AECaptureParser.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Contrib/AECaptureParser In directory usw-pr-cvs1:/tmp/cvs-serv28795/Python/Mac/Contrib/AECaptureParser Modified Files: AECaptureParser.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: AECaptureParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Contrib/AECaptureParser/AECaptureParser.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** AECaptureParser.py 2000/04/22 22:56:53 1.1 --- AECaptureParser.py 2001/05/17 12:45:09 1.2 *************** *** 261,266 **** "'null'()": [("'null'()", "None")], 'abso(': [('abso(', "aetypes.Unknown('abso', ")], ! '³': [('³', '"')], ! '²': [('²', '"')], '[': [('[', '('), (', ', ',')], ']': [(']', ')')], --- 261,266 ---- "'null'()": [("'null'()", "None")], 'abso(': [('abso(', "aetypes.Unknown('abso', ")], ! '–': [('–', '"')], ! '”': [('”', '"')], '[': [('[', '('), (', ', ',')], ']': [(']', ')')], *************** *** 354,358 **** [event: target="Finder", class=core, id=setd] ! '----':obj {form:prop, want:type(prop), seld:type(posn), from:obj {form:name, want:type(cfol), seld:³MoPar:Data:DevDev:Python:Python 1.5.2c1:Extensions², from:'null'()}}, data:[100, 10] [/event] --- 354,358 ---- [event: target="Finder", class=core, id=setd] ! '----':obj {form:prop, want:type(prop), seld:type(posn), from:obj {form:name, want:type(cfol), seld:–MoPar:Data:DevDev:Python:Python 1.5.2c1:Extensions”, from:'null'()}}, data:[100, 10] [/event] From jackjansen@users.sourceforge.net Thu May 17 13:45:15 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:45:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Demo/applescript/Disk_Copy Special_Events.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Demo/applescript/Disk_Copy In directory usw-pr-cvs1:/tmp/cvs-serv28814/Python/Mac/Demo/applescript/Disk_Copy Modified Files: Special_Events.py Log Message: Fixed macroman<->latin1 conversion. Some chars don't exist in latin1, but at least the roundtrip results in the same macroman characters. Index: Special_Events.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Demo/applescript/Disk_Copy/Special_Events.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Special_Events.py 2000/08/20 21:57:30 1.1 --- Special_Events.py 2001/05/17 12:45:13 1.2 *************** *** 25,29 **** Keyword argument access_mode: the access mode for mounted volume (default is "any", i.e. best possible) Keyword argument checksum_verification: Verify the checksum before mounting? ! Keyword argument signature_verification: Verify the DigiSign signature before mounting? Keyword argument RAM_caching: Cache the disk image in RAM? (if omitted, don't cache) Keyword argument _attributes: AppleEvent attribute dictionary --- 25,29 ---- Keyword argument access_mode: the access mode for mounted volume (default is "any", i.e. best possible) Keyword argument checksum_verification: Verify the checksum before mounting? ! Keyword argument signature_verification: Verify the DigiSignŽ signature before mounting? Keyword argument RAM_caching: Cache the disk image in RAM? (if omitted, don't cache) Keyword argument _attributes: AppleEvent attribute dictionary *************** *** 58,62 **** Required argument: a reference to the DiskScript to execute Keyword argument checksum_verification: Should checksums be verified when mounting images referenced in the DiskScript? ! Keyword argument signature_verification: Should the DigiSign signature of the DiskScript and the images it references be verified? Keyword argument _attributes: AppleEvent attribute dictionary """ --- 58,62 ---- Required argument: a reference to the DiskScript to execute Keyword argument checksum_verification: Should checksums be verified when mounting images referenced in the DiskScript? ! Keyword argument signature_verification: Should the DigiSignŽ signature of the DiskScript and the images it references be verified? Keyword argument _attributes: AppleEvent attribute dictionary """ *************** *** 159,166 **** def verify_signature(self, _object, _attributes={}, **_arguments): ! """verify signature: Verify the DigiSign signature for a Disk Copy document Required argument: the disk image to be verified Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Is the DigiSign signature valid? """ _code = 'ddsk' --- 159,166 ---- def verify_signature(self, _object, _attributes={}, **_arguments): ! """verify signature: Verify the DigiSignŽ signature for a Disk Copy document Required argument: the disk image to be verified Keyword argument _attributes: AppleEvent attribute dictionary ! Returns: Is the DigiSignŽ signature valid? """ _code = 'ddsk' *************** *** 184,188 **** def sign_image(self, _object, _attributes={}, **_arguments): ! """sign image: Add a DigiSign signature to a Disk Copy document Required argument: the disk image to be signed Keyword argument using_signer: a reference to signer file to use --- 184,188 ---- def sign_image(self, _object, _attributes={}, **_arguments): ! """sign image: Add a DigiSignŽ signature to a Disk Copy document Required argument: the disk image to be signed Keyword argument using_signer: a reference to signer file to use *************** *** 214,218 **** """create a floppy from: create a floppy disk from a Disk Copy document Required argument: the disk image to make a floppy from ! Keyword argument signature_verification: Should the DigiSign signature be verified before creating a floppy disk? Keyword argument erase_confirmation: Should the user be asked to confirm the erasure of the previous contents of floppy disks? Keyword argument make_multiple_floppies: Should the user be prompted to create multiple floppy disks? --- 214,218 ---- """create a floppy from: create a floppy disk from a Disk Copy document Required argument: the disk image to make a floppy from ! Keyword argument signature_verification: Should the DigiSignŽ signature be verified before creating a floppy disk? Keyword argument erase_confirmation: Should the user be asked to confirm the erasure of the previous contents of floppy disks? Keyword argument make_multiple_floppies: Should the user be prompted to create multiple floppy disks? *************** *** 242,246 **** def check_image(self, _object, _attributes={}, **_arguments): ! """check image: Check the disk image¹s internal data structures for any inconsistencies. Works on NDIF, Disk Copy 4.2, DART, or DiskSet images. Required argument: the disk image to be verified Keyword argument details: Should the disk image details be displayed? --- 242,246 ---- def check_image(self, _object, _attributes={}, **_arguments): ! """check image: Check the disk imageÕs internal data structures for any inconsistencies. Works on NDIF, Disk Copy 4.2, DARTŽ, or DiskSet images. Required argument: the disk image to be verified Keyword argument details: Should the disk image details be displayed? *************** *** 314,318 **** Keyword argument version_string: sets the 'vers' 1 resource of the self-mounting image Keyword argument checksum_verification: Should the checksum of the source images be verified before creating the SMI? ! Keyword argument signature_verification: Should the DigiSign signature of the source images be verified before creating the SMI? Keyword argument image_signing: Should the SMI be given a digital signature when it is created? Keyword argument _attributes: AppleEvent attribute dictionary --- 314,318 ---- Keyword argument version_string: sets the 'vers' 1 resource of the self-mounting image Keyword argument checksum_verification: Should the checksum of the source images be verified before creating the SMI? ! Keyword argument signature_verification: Should the DigiSignŽ signature of the source images be verified before creating the SMI? Keyword argument image_signing: Should the SMI be given a digital signature when it is created? Keyword argument _attributes: AppleEvent attribute dictionary From jackjansen@users.sourceforge.net Thu May 17 13:51:59 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:51:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils sysconfig.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv30275/Python/Lib/distutils Modified Files: sysconfig.py Log Message: Made distutils understand the MacPython Carbon runtime model. Distutils will build for the runtime model you are currently using for the interpreter. Index: sysconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** sysconfig.py 2001/02/28 19:40:27 1.34 --- sysconfig.py 2001/05/17 12:51:57 1.35 *************** *** 340,344 **** --- 340,348 ---- g['INCLUDEPY'] = get_python_inc(plat_specific=0) + import MacOS + if not hasattr(MacOS, 'runtimemodel'): g['SO'] = '.ppc.slb' + else: + g['SO'] = '.%s.slb' % MacOS.runtimemodel # XXX are these used anywhere? From jackjansen@users.sourceforge.net Thu May 17 13:52:03 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 05:52:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils mwerkscompiler.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv30293/Python/Lib/distutils Modified Files: mwerkscompiler.py Log Message: Made distutils understand the MacPython Carbon runtime model. Distutils will build for the runtime model you are currently using for the interpreter. Index: mwerkscompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/mwerkscompiler.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** mwerkscompiler.py 2001/01/15 16:09:35 1.1 --- mwerkscompiler.py 2001/05/17 12:52:01 1.2 *************** *** 115,118 **** --- 115,120 ---- if output_filename[-8:] == '.ppc.slb': basename = output_filename[:-8] + elif output_filename[-11:] == '.carbon.slb': + basename = output_filename[:-11] else: basename = os.path.strip(output_filename)[0] From gvanrossum@users.sourceforge.net Thu May 17 16:03:16 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Thu, 17 May 2001 08:03:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils sysconfig.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory usw-pr-cvs1:/tmp/cvs-serv367 Modified Files: sysconfig.py Log Message: Fixed botched indent in _init_mac() code. (It may never be executed, but it still can't have any syntax errors. Went a little too fast there, Jack? :-) Index: sysconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** sysconfig.py 2001/05/17 12:51:57 1.35 --- sysconfig.py 2001/05/17 15:03:14 1.36 *************** *** 342,346 **** import MacOS if not hasattr(MacOS, 'runtimemodel'): ! g['SO'] = '.ppc.slb' else: g['SO'] = '.%s.slb' % MacOS.runtimemodel --- 342,346 ---- import MacOS if not hasattr(MacOS, 'runtimemodel'): ! g['SO'] = '.ppc.slb' else: g['SO'] = '.%s.slb' % MacOS.runtimemodel From jackjansen@users.sourceforge.net Thu May 17 22:54:16 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:54:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/ae AEmodule.c,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ae In directory usw-pr-cvs1:/tmp/cvs-serv7500/Python/Mac/Modules/ae Modified Files: AEmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: AEmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/AEmodule.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** AEmodule.c 2000/12/12 22:09:11 1.24 --- AEmodule.c 2001/05/17 21:54:14 1.25 *************** *** 12,15 **** --- 12,23 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_AEDesc_New(AEDesc *); + extern int _AEDesc_Convert(PyObject *, AEDesc *); + + #define AEDesc_New _AEDesc_New + #define AEDesc_Convert _AEDesc_Convert + #endif + static pascal OSErr GenericEventHandler(); /* Forward */ *************** *** 1332,1335 **** --- 1340,1345 ---- upp_AEIdleProc = NewAEIdleProc(AEIdleProc); upp_GenericEventHandler = NewAEEventHandlerProc(GenericEventHandler); + PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:54:20 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:54:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/ae aesupport.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ae In directory usw-pr-cvs1:/tmp/cvs-serv7527/Python/Mac/Modules/ae Modified Files: aesupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: aesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/aesupport.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** aesupport.py 2000/12/12 22:09:11 1.18 --- aesupport.py 2001/05/17 21:54:18 1.19 *************** *** 86,89 **** --- 86,97 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_AEDesc_New(AEDesc *); + extern int _AEDesc_Convert(PyObject *, AEDesc *); + + #define AEDesc_New _AEDesc_New + #define AEDesc_Convert _AEDesc_Convert + #endif + static pascal OSErr GenericEventHandler(); /* Forward */ *************** *** 139,142 **** --- 147,152 ---- upp_AEIdleProc = NewAEIdleProc(AEIdleProc); upp_GenericEventHandler = NewAEEventHandlerProc(GenericEventHandler); + PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc_Convert); """ From jackjansen@users.sourceforge.net Thu May 17 22:54:31 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:54:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/cm Cmmodule.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cm In directory usw-pr-cvs1:/tmp/cvs-serv7552/Python/Mac/Modules/cm Modified Files: Cmmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: Cmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/Cmmodule.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** Cmmodule.c 2000/12/10 23:43:30 1.12 --- Cmmodule.c 2001/05/17 21:54:29 1.13 *************** *** 10,13 **** --- 10,24 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_CmpObj_New(Component); + extern int _CmpObj_Convert(PyObject *, Component *); + extern PyObject *_CmpInstObj_New(ComponentInstance); + extern int _CmpInstObj_Convert(PyObject *, ComponentInstance *); + + #define CmpObj_New _CmpObj_New + #define CmpObj_Convert _CmpObj_Convert + #define CmpInstObj_New _CmpInstObj_New + #define CmpInstObj_Convert _CmpInstObj_Convert + #endif /* *************** *** 825,828 **** --- 836,844 ---- + + PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpInstObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpInstObj_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:54:37 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:54:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/cm cmsupport.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cm In directory usw-pr-cvs1:/tmp/cvs-serv7575/Python/Mac/Modules/cm Modified Files: cmsupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: cmsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/cmsupport.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** cmsupport.py 2000/07/14 22:16:38 1.2 --- cmsupport.py 2001/05/17 21:54:35 1.3 *************** *** 23,27 **** --- 23,38 ---- includestuff = includestuff + """ #include <%s>""" % MACHEADERFILE + """ + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_CmpObj_New(Component); + extern int _CmpObj_Convert(PyObject *, Component *); + extern PyObject *_CmpInstObj_New(ComponentInstance); + extern int _CmpInstObj_Convert(PyObject *, ComponentInstance *); + #define CmpObj_New _CmpObj_New + #define CmpObj_Convert _CmpObj_Convert + #define CmpInstObj_New _CmpInstObj_New + #define CmpInstObj_Convert _CmpInstObj_Convert + #endif + /* ** Parse/generate ComponentDescriptor records *************** *** 51,54 **** --- 62,72 ---- } + """ + + initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpInstObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpInstObj_Convert); """ From jackjansen@users.sourceforge.net Thu May 17 22:54:47 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:54:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/ctl Ctlmodule.c,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory usw-pr-cvs1:/tmp/cvs-serv7602/Python/Mac/Modules/ctl Modified Files: Ctlmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: Ctlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/Ctlmodule.c,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -r1.42 -r1.43 *** Ctlmodule.c 2001/01/12 23:39:00 1.42 --- Ctlmodule.c 2001/05/17 21:54:45 1.43 *************** *** 14,17 **** --- 14,25 ---- #endif + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_CtlObj_New(ControlHandle); + extern int _CtlObj_Convert(PyObject *, ControlHandle *); + + #define CtlObj_New _CtlObj_New + #define CtlObj_Convert _CtlObj_Convert + #endif + staticforward PyObject *CtlObj_WhichControl(ControlHandle); *************** *** 2926,2929 **** --- 2934,2939 ---- myhittestproc_upp = NewControlUserPaneHitTestProc(myhittestproc); mytrackingproc_upp = NewControlUserPaneTrackingProc(mytrackingproc); + PyMac_INIT_TOOLBOX_OBJECT_NEW(CtlObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CtlObj_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:54:57 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:54:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/ctl ctlsupport.py,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory usw-pr-cvs1:/tmp/cvs-serv7637/Python/Mac/Modules/ctl Modified Files: ctlsupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: ctlsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlsupport.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** ctlsupport.py 2001/01/12 23:39:00 1.37 --- ctlsupport.py 2001/05/17 21:54:55 1.38 *************** *** 55,58 **** --- 55,66 ---- #endif + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_CtlObj_New(ControlHandle); + extern int _CtlObj_Convert(PyObject *, ControlHandle *); + + #define CtlObj_New _CtlObj_New + #define CtlObj_Convert _CtlObj_Convert + #endif + staticforward PyObject *CtlObj_WhichControl(ControlHandle); *************** *** 317,320 **** --- 325,330 ---- myhittestproc_upp = NewControlUserPaneHitTestProc(myhittestproc); mytrackingproc_upp = NewControlUserPaneTrackingProc(mytrackingproc); + PyMac_INIT_TOOLBOX_OBJECT_NEW(CtlObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CtlObj_Convert); """ From jackjansen@users.sourceforge.net Thu May 17 22:55:10 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:55:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/dlg dlgsupport.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/dlg In directory usw-pr-cvs1:/tmp/cvs-serv7783/Python/Mac/Modules/dlg Modified Files: dlgsupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: dlgsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/dlg/dlgsupport.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** dlgsupport.py 2001/02/20 22:27:43 1.22 --- dlgsupport.py 2001/05/17 21:55:08 1.23 *************** *** 33,36 **** --- 33,45 ---- includestuff = includestuff + """ #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_DlgObj_New(DialogRef); + extern PyObject *_DlgObj_WhichDialog(DialogRef); + extern int _DlgObj_Convert(PyObject *, DialogRef *); + + #define DlgObj_New _DlgObj_New + #define DlgObj_WhichDialog _DlgObj_WhichDialog + #define DlgObj_Convert _DlgObj_Convert + #endif #if !ACCESSOR_CALLS_ARE_FUNCTIONS *************** *** 140,144 **** finalstuff = finalstuff + """ /* Return the WindowPtr corresponding to a DialogObject */ ! WindowPtr DlgObj_ConvertToWindow(self) --- 149,153 ---- finalstuff = finalstuff + """ /* Return the WindowPtr corresponding to a DialogObject */ ! #if 0 WindowPtr DlgObj_ConvertToWindow(self) *************** *** 149,152 **** --- 158,162 ---- return NULL; } + #endif /* Return the object corresponding to the dialog, or None */ *************** *** 179,182 **** --- 189,198 ---- return it; } + """ + + initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_New); + PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_WhichDialog); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DlgObj_Convert); """ From jackjansen@users.sourceforge.net Thu May 17 22:55:19 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:55:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/drag Dragmodule.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory usw-pr-cvs1:/tmp/cvs-serv7825/Python/Mac/Modules/drag Modified Files: Dragmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: Dragmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/Dragmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** Dragmodule.c 2001/02/05 13:47:13 1.6 --- Dragmodule.c 2001/05/17 21:55:17 1.7 *************** *** 20,23 **** --- 20,31 ---- #endif + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_DragObj_New(DragRef); + extern int _DragObj_Convert(PyObject *, DragRef *); + + #define DragObj_New _DragObj_New + #define DragObj_Convert _DragObj_Convert + #endif + static PyObject *Drag_Error; *************** *** 1040,1043 **** --- 1048,1054 ---- + + PyMac_INIT_TOOLBOX_OBJECT_NEW(DragObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragObj_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:55:39 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:55:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/drag dragsupport.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory usw-pr-cvs1:/tmp/cvs-serv7876/Python/Mac/Modules/drag Modified Files: dragsupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: dragsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/dragsupport.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** dragsupport.py 2000/12/10 23:43:38 1.4 --- dragsupport.py 2001/05/17 21:55:37 1.5 *************** *** 55,58 **** --- 55,66 ---- DragDrawingUPP dragglue_DrawingUPP; #endif + + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_DragObj_New(DragRef); + extern int _DragObj_Convert(PyObject *, DragRef *); + + #define DragObj_New _DragObj_New + #define DragObj_Convert _DragObj_Convert + #endif """ *************** *** 152,155 **** --- 160,168 ---- #endif + """ + + initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(DragObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragObj_Convert); """ From jackjansen@users.sourceforge.net Thu May 17 22:55:04 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:55:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/dlg Dlgmodule.c,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/dlg In directory usw-pr-cvs1:/tmp/cvs-serv7659/Python/Mac/Modules/dlg Modified Files: Dlgmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: Dlgmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/dlg/Dlgmodule.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** Dlgmodule.c 2001/02/20 22:27:43 1.24 --- Dlgmodule.c 2001/05/17 21:55:02 1.25 *************** *** 10,13 **** --- 10,22 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_DlgObj_New(DialogRef); + extern PyObject *_DlgObj_WhichDialog(DialogRef); + extern int _DlgObj_Convert(PyObject *, DialogRef *); + + #define DlgObj_New _DlgObj_New + #define DlgObj_WhichDialog _DlgObj_WhichDialog + #define DlgObj_Convert _DlgObj_Convert + #endif #if !ACCESSOR_CALLS_ARE_FUNCTIONS *************** *** 1469,1473 **** /* Return the WindowPtr corresponding to a DialogObject */ ! WindowPtr DlgObj_ConvertToWindow(self) --- 1478,1482 ---- /* Return the WindowPtr corresponding to a DialogObject */ ! #if 0 WindowPtr DlgObj_ConvertToWindow(self) *************** *** 1478,1481 **** --- 1487,1491 ---- return NULL; } + #endif /* Return the object corresponding to the dialog, or None */ *************** *** 1516,1519 **** --- 1526,1533 ---- + + PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_New); + PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_WhichDialog); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DlgObj_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:56:10 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:56:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/list listsupport.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/list In directory usw-pr-cvs1:/tmp/cvs-serv8098/Python/Mac/Modules/list Modified Files: listsupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: listsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/listsupport.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** listsupport.py 2000/12/10 23:43:45 1.7 --- listsupport.py 2001/05/17 21:56:08 1.8 *************** *** 38,41 **** --- 38,50 ---- #include <%s>""" % MACHEADERFILE + """ + + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_ListObj_New(ListHandle); + extern int _ListObj_Convert(PyObject *, ListHandle *); + + #define ListObj_New _ListObj_New + #define ListObj_Convert _ListObj_Convert + #endif + #if !ACCESSOR_CALLS_ARE_FUNCTIONS #define GetListPort(list) ((CGrafPtr)(*(list))->port) *************** *** 65,68 **** --- 74,82 ---- #define as_List(x) ((ListHandle)x) #define as_Resource(lh) ((Handle)lh) + """ + + initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(ListObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListObj_Convert); """ From jackjansen@users.sourceforge.net Thu May 17 22:56:20 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:56:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/menu Menumodule.c,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory usw-pr-cvs1:/tmp/cvs-serv8134/Python/Mac/Modules/menu Modified Files: Menumodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: Menumodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/Menumodule.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** Menumodule.c 2001/01/29 13:32:10 1.25 --- Menumodule.c 2001/05/17 21:56:18 1.26 *************** *** 12,15 **** --- 12,24 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + + extern PyObject *_MenuObj_New(MenuHandle); + extern int _MenuObj_Convert(PyObject *, MenuHandle *); + + #define MenuObj_New _MenuObj_New + #define MenuObj_Convert _MenuObj_Convert + #endif + #if !ACCESSOR_CALLS_ARE_FUNCTIONS #define GetMenuID(menu) ((*(menu))->menuID) *************** *** 2780,2783 **** --- 2789,2795 ---- + + PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuObj_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:56:24 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:56:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/menu menusupport.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory usw-pr-cvs1:/tmp/cvs-serv8172/Python/Mac/Modules/menu Modified Files: menusupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: menusupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/menusupport.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** menusupport.py 2000/12/10 23:43:49 1.9 --- menusupport.py 2001/05/17 21:56:22 1.10 *************** *** 40,43 **** --- 40,52 ---- #include <%s>""" % MACHEADERFILE + """ + #ifdef USE_TOOLBOX_OBJECT_GLUE + + extern PyObject *_MenuObj_New(MenuHandle); + extern int _MenuObj_Convert(PyObject *, MenuHandle *); + + #define MenuObj_New _MenuObj_New + #define MenuObj_Convert _MenuObj_Convert + #endif + #if !ACCESSOR_CALLS_ARE_FUNCTIONS #define GetMenuID(menu) ((*(menu))->menuID) *************** *** 52,55 **** --- 61,69 ---- #define as_Menu(h) ((MenuHandle)h) #define as_Resource(h) ((Handle)h) + """ + + initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuObj_Convert); """ From jackjansen@users.sourceforge.net Thu May 17 22:56:45 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:56:45 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qd Qdmodule.c,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory usw-pr-cvs1:/tmp/cvs-serv8195/Python/Mac/Modules/qd Modified Files: Qdmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: Qdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/Qdmodule.c,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -r1.37 -r1.38 *** Qdmodule.c 2001/02/06 16:13:50 1.37 --- Qdmodule.c 2001/05/17 21:56:43 1.38 *************** *** 11,14 **** --- 11,30 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_GrafObj_New(GrafPtr); + extern int _GrafObj_Convert(PyObject *, GrafPtr *); + extern PyObject *_BMObj_New(BitMapPtr); + extern int _BMObj_Convert(PyObject *, BitMapPtr *); + extern PyObject *_QdRGB_New(RGBColorPtr); + extern int _QdRGB_Convert(PyObject *, RGBColorPtr *); + + #define GrafObj_New _GrafObj_New + #define GrafObj_Convert _GrafObj_Convert + #define BMObj_New _BMObj_New + #define BMObj_Convert _BMObj_Convert + #define QdRGB_New _QdRGB_New + #define QdRGB_Convert _QdRGB_Convert + #endif + #if !ACCESSOR_CALLS_ARE_FUNCTIONS #define GetPortBitMapForCopyBits(port) ((const struct BitMap *)&((GrafPort *)(port))->portBits) *************** *** 145,148 **** --- 161,174 ---- GrafPtr *p_itself; { + #if 1 + { + WindowRef win; + if (WinObj_Convert(v, &win) && v) { + *p_itself = (GrafPtr)GetWindowPort(win); + return 1; + } + PyErr_Clear(); + } + #else if (DlgObj_Check(v)) { DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself; *************** *** 155,158 **** --- 181,185 ---- return 1; } + #endif if (!GrafObj_Check(v)) { *************** *** 6194,6197 **** --- 6221,6231 ---- + + PyMac_INIT_TOOLBOX_OBJECT_NEW(BMObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BMObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(QdRGB_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(QdRGB_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:56:04 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:56:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/list Listmodule.c,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/list In directory usw-pr-cvs1:/tmp/cvs-serv8014/Python/Mac/Modules/list Modified Files: Listmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: Listmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/Listmodule.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** Listmodule.c 2001/02/27 13:00:35 1.13 --- Listmodule.c 2001/05/17 21:56:02 1.14 *************** *** 11,14 **** --- 11,23 ---- #include + + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_ListObj_New(ListHandle); + extern int _ListObj_Convert(PyObject *, ListHandle *); + + #define ListObj_New _ListObj_New + #define ListObj_Convert _ListObj_Convert + #endif + #if !ACCESSOR_CALLS_ARE_FUNCTIONS #define GetListPort(list) ((CGrafPtr)(*(list))->port) *************** *** 1066,1069 **** --- 1075,1081 ---- + + PyMac_INIT_TOOLBOX_OBJECT_NEW(ListObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListObj_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:56:53 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:56:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qdoffs Qdoffsmodule.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qdoffs In directory usw-pr-cvs1:/tmp/cvs-serv8265/Python/Mac/Modules/qdoffs Modified Files: Qdoffsmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: Qdoffsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qdoffs/Qdoffsmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** Qdoffsmodule.c 2000/12/19 22:28:14 1.6 --- Qdoffsmodule.c 2001/05/17 21:56:51 1.7 *************** *** 11,14 **** --- 11,22 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_GWorldObj_New(GWorldPtr); + extern int _GWorldObj_Convert(PyObject *, GWorldPtr *); + + #define GWorldObj_New _GWorldObj_New + #define GWorldObj_Convert _GWorldObj_Convert + #endif + #define as_GrafPtr(gworld) ((GrafPtr)(gworld)) *************** *** 622,625 **** --- 630,636 ---- + + PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldObj_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:56:57 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:56:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qdoffs qdoffssupport.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qdoffs In directory usw-pr-cvs1:/tmp/cvs-serv8290/Python/Mac/Modules/qdoffs Modified Files: qdoffssupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: qdoffssupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qdoffs/qdoffssupport.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** qdoffssupport.py 2000/07/14 22:16:42 1.3 --- qdoffssupport.py 2001/05/17 21:56:55 1.4 *************** *** 37,44 **** --- 37,56 ---- #include <%s>""" % MACHEADERFILE + """ + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_GWorldObj_New(GWorldPtr); + extern int _GWorldObj_Convert(PyObject *, GWorldPtr *); + + #define GWorldObj_New _GWorldObj_New + #define GWorldObj_Convert _GWorldObj_Convert + #endif + #define as_GrafPtr(gworld) ((GrafPtr)(gworld)) """ + initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldObj_Convert); + """ class MyObjectDefinition(GlobalObjectDefinition): From jackjansen@users.sourceforge.net Thu May 17 22:57:35 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:57:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qt Qtmodule.c,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qt In directory usw-pr-cvs1:/tmp/cvs-serv8368/Python/Mac/Modules/qt Modified Files: Qtmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: Qtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qt/Qtmodule.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** Qtmodule.c 2001/01/09 22:09:29 1.22 --- Qtmodule.c 2001/05/17 21:57:32 1.23 *************** *** 11,14 **** --- 11,41 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_TrackObj_New(Track); + extern int _TrackObj_Convert(PyObject *, Track *); + extern PyObject *_MovieObj_New(Movie); + extern int _MovieObj_Convert(PyObject *, Movie *); + extern PyObject *_MovieCtlObj_New(MovieController); + extern int _MovieCtlObj_Convert(PyObject *, MovieController *); + extern PyObject *_TimeBaseObj_New(TimeBase); + extern int _TimeBaseObj_Convert(PyObject *, TimeBase *); + extern PyObject *_UserDataObj_New(UserData); + extern int _UserDataObj_Convert(PyObject *, UserData *); + extern PyObject *_MediaObj_New(Media); + extern int _MediaObj_Convert(PyObject *, Media *); + + #define TrackObj_New _TrackObj_New + #define TrackObj_Convert _TrackObj_Convert + #define MovieObj_New _MovieObj_New + #define MovieObj_Convert _MovieObj_Convert + #define MovieCtlObj_New _MovieCtlObj_New + #define MovieCtlObj_Convert _MovieCtlObj_Convert + #define TimeBaseObj_New _TimeBaseObj_New + #define TimeBaseObj_Convert _TimeBaseObj_Convert + #define UserDataObj_New _UserDataObj_New + #define UserDataObj_Convert _UserDataObj_Convert + #define MediaObj_New _MediaObj_New + #define MediaObj_Convert _MediaObj_Convert + #endif /* Macro to allow us to GetNextInterestingTime without duration */ *************** *** 9160,9163 **** --- 9187,9203 ---- + + PyMac_INIT_TOOLBOX_OBJECT_NEW(TrackObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TrackObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieCtlObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieCtlObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBaseObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBaseObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(UserDataObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserDataObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(MediaObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MediaObj_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:57:44 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:57:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qt qtsupport.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qt In directory usw-pr-cvs1:/tmp/cvs-serv8449/Python/Mac/Modules/qt Modified Files: qtsupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: qtsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qt/qtsupport.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** qtsupport.py 2000/12/12 22:10:17 1.15 --- qtsupport.py 2001/05/17 21:57:42 1.16 *************** *** 27,31 **** --- 27,58 ---- #include <%s>""" % MACHEADERFILE + """ + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_TrackObj_New(Track); + extern int _TrackObj_Convert(PyObject *, Track *); + extern PyObject *_MovieObj_New(Movie); + extern int _MovieObj_Convert(PyObject *, Movie *); + extern PyObject *_MovieCtlObj_New(MovieController); + extern int _MovieCtlObj_Convert(PyObject *, MovieController *); + extern PyObject *_TimeBaseObj_New(TimeBase); + extern int _TimeBaseObj_Convert(PyObject *, TimeBase *); + extern PyObject *_UserDataObj_New(UserData); + extern int _UserDataObj_Convert(PyObject *, UserData *); + extern PyObject *_MediaObj_New(Media); + extern int _MediaObj_Convert(PyObject *, Media *); + #define TrackObj_New _TrackObj_New + #define TrackObj_Convert _TrackObj_Convert + #define MovieObj_New _MovieObj_New + #define MovieObj_Convert _MovieObj_Convert + #define MovieCtlObj_New _MovieCtlObj_New + #define MovieCtlObj_Convert _MovieCtlObj_Convert + #define TimeBaseObj_New _TimeBaseObj_New + #define TimeBaseObj_Convert _TimeBaseObj_Convert + #define UserDataObj_New _UserDataObj_New + #define UserDataObj_Convert _UserDataObj_Convert + #define MediaObj_New _MediaObj_New + #define MediaObj_Convert _MediaObj_Convert + #endif + /* Macro to allow us to GetNextInterestingTime without duration */ #define GetMediaNextInterestingTimeOnly(media, flags, time, rate, rv) \ *************** *** 66,69 **** --- 93,111 ---- + """ + + initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(TrackObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TrackObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieCtlObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieCtlObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBaseObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBaseObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(UserDataObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserDataObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(MediaObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MediaObj_Convert); """ From jackjansen@users.sourceforge.net Thu May 17 22:57:57 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:57:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/res Resmodule.c,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv8475/Python/Mac/Modules/res Modified Files: Resmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: Resmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/Resmodule.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** Resmodule.c 2001/03/02 16:32:03 1.25 --- Resmodule.c 2001/05/17 21:57:55 1.26 *************** *** 12,15 **** --- 12,26 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_ResObj_New(Handle); + extern int _ResObj_Convert(PyObject *, Handle *); + extern PyObject *_OptResObj_New(Handle); + extern int _OptResObj_Convert(PyObject *, Handle *); + #define ResObj_New _ResObj_New + #define ResObj_Convert _ResObj_Convert + #define OptResObj_New _OptResObj_New + #define OptResObj_Convert _OptResObj_Convert + #endif + /* Function to dispose a resource, with a "normal" calling sequence */ static void *************** *** 1679,1682 **** --- 1690,1697 ---- + PyMac_INIT_TOOLBOX_OBJECT_NEW(ResObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ResObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(OptResObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(OptResObj_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:57:04 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:57:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qd qdsupport.py,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory usw-pr-cvs1:/tmp/cvs-serv8335/Python/Mac/Modules/qd Modified Files: qdsupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: qdsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/qdsupport.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** qdsupport.py 2001/02/02 22:41:48 1.29 --- qdsupport.py 2001/05/17 21:57:02 1.30 *************** *** 64,67 **** --- 64,83 ---- #include <%s>""" % MACHEADERFILE + """ + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_GrafObj_New(GrafPtr); + extern int _GrafObj_Convert(PyObject *, GrafPtr *); + extern PyObject *_BMObj_New(BitMapPtr); + extern int _BMObj_Convert(PyObject *, BitMapPtr *); + extern PyObject *_QdRGB_New(RGBColorPtr); + extern int _QdRGB_Convert(PyObject *, RGBColorPtr *); + + #define GrafObj_New _GrafObj_New + #define GrafObj_Convert _GrafObj_Convert + #define BMObj_New _BMObj_New + #define BMObj_Convert _BMObj_Convert + #define QdRGB_New _QdRGB_New + #define QdRGB_Convert _QdRGB_Convert + #endif + #if !ACCESSOR_CALLS_ARE_FUNCTIONS #define GetPortBitMapForCopyBits(port) ((const struct BitMap *)&((GrafPort *)(port))->portBits) *************** *** 202,205 **** --- 218,230 ---- """ + initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(BMObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BMObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(QdRGB_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(QdRGB_Convert); + """ + ## not yet... ## *************** *** 220,223 **** --- 245,258 ---- Output("if (itself == NULL) return PyMac_Error(resNotFound);") def outputCheckConvertArg(self): + Output("#if 1") + OutLbrace() + Output("WindowRef win;") + OutLbrace("if (WinObj_Convert(v, &win) && v)") + Output("*p_itself = (GrafPtr)GetWindowPort(win);") + Output("return 1;") + OutRbrace() + Output("PyErr_Clear();") + OutRbrace() + Output("#else") OutLbrace("if (DlgObj_Check(v))") Output("DialogRef dlg = (DialogRef)((GrafPortObject *)v)->ob_itself;") *************** *** 230,233 **** --- 265,269 ---- Output("return 1;") OutRbrace() + Output("#endif") def outputGetattrHook(self): Output("#if !ACCESSOR_CALLS_ARE_FUNCTIONS") From jackjansen@users.sourceforge.net Thu May 17 22:58:04 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:58:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/res ressupport.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv8533/Python/Mac/Modules/res Modified Files: ressupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: ressupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/ressupport.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** ressupport.py 2000/12/12 22:10:19 1.13 --- ressupport.py 2001/05/17 21:58:02 1.14 *************** *** 27,30 **** --- 27,41 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_ResObj_New(Handle); + extern int _ResObj_Convert(PyObject *, Handle *); + extern PyObject *_OptResObj_New(Handle); + extern int _OptResObj_Convert(PyObject *, Handle *); + #define ResObj_New _ResObj_New + #define ResObj_Convert _ResObj_Convert + #define OptResObj_New _OptResObj_New + #define OptResObj_Convert _OptResObj_Convert + #endif + /* Function to dispose a resource, with a "normal" calling sequence */ static void *************** *** 76,79 **** --- 87,94 ---- initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(ResObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ResObj_Convert); + PyMac_INIT_TOOLBOX_OBJECT_NEW(OptResObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(OptResObj_Convert); """ From jackjansen@users.sourceforge.net Thu May 17 22:58:14 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:58:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/te TEmodule.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/te In directory usw-pr-cvs1:/tmp/cvs-serv8604/Python/Mac/Modules/te Modified Files: TEmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: TEmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/te/TEmodule.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** TEmodule.c 2000/12/12 22:10:20 1.12 --- TEmodule.c 2001/05/17 21:58:12 1.13 *************** *** 11,14 **** --- 11,22 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_TEObj_New(TEHandle); + extern int _TEObj_Convert(PyObject *, TEHandle *); + + #define TEObj_New _TEObj_New + #define TEObj_Convert _TEObj_Convert + #endif + #define as_TE(h) ((TEHandle)h) #define as_Resource(teh) ((Handle)teh) *************** *** 1105,1108 **** --- 1113,1119 ---- + + PyMac_INIT_TOOLBOX_OBJECT_NEW(TEObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEObj_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:58:19 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:58:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/te tesupport.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/te In directory usw-pr-cvs1:/tmp/cvs-serv8623/Python/Mac/Modules/te Modified Files: tesupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: tesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/te/tesupport.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** tesupport.py 2000/07/14 22:16:44 1.6 --- tesupport.py 2001/05/17 21:58:17 1.7 *************** *** 35,38 **** --- 35,46 ---- #include <%s>""" % MACHEADERFILE + """ + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_TEObj_New(TEHandle); + extern int _TEObj_Convert(PyObject *, TEHandle *); + + #define TEObj_New _TEObj_New + #define TEObj_Convert _TEObj_Convert + #endif + #define as_TE(h) ((TEHandle)h) #define as_Resource(teh) ((Handle)teh) *************** *** 64,67 **** --- 72,80 ---- return 1; } + """ + + initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(TEObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEObj_Convert); """ From jackjansen@users.sourceforge.net Thu May 17 22:58:30 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:58:30 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/win Winmodule.c,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory usw-pr-cvs1:/tmp/cvs-serv8641/Python/Mac/Modules/win Modified Files: Winmodule.c Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: Winmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/Winmodule.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** Winmodule.c 2001/04/25 22:09:29 1.33 --- Winmodule.c 2001/05/17 21:58:27 1.34 *************** *** 11,14 **** --- 11,24 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_WinObj_New(WindowRef); + extern PyObject *_WinObj_WhichWindow(WindowRef); + extern int _WinObj_Convert(PyObject *, WindowRef *); + + #define WinObj_New _WinObj_New + #define WinObj_WhichWindow _WinObj_WhichWindow + #define WinObj_Convert _WinObj_Convert + #endif + #if !ACCESSOR_CALLS_ARE_FUNCTIONS /* Carbon calls that we emulate in classic mode */ *************** *** 66,73 **** --- 76,94 ---- WindowPtr *p_itself; { + #if 1 + { + DialogRef dlg; + if (DlgObj_Convert(v, &dlg) && dlg) { + *p_itself = GetDialogWindow(dlg); + return 1; + } + PyErr_Clear(); + } + #else if (DlgObj_Check(v)) { *p_itself = DlgObj_ConvertToWindow(v); return 1; } + #endif if (v == Py_None) { *p_itself = NULL; return 1; } *************** *** 3057,3060 **** --- 3078,3085 ---- + + PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_New); + PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_WhichWindow); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WinObj_Convert); From jackjansen@users.sourceforge.net Thu May 17 22:58:36 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 14:58:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/win winsupport.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory usw-pr-cvs1:/tmp/cvs-serv8669/Python/Mac/Modules/win Modified Files: winsupport.py Log Message: First step in porting MacPython modules to OSX/unix: break all references between modules except for the obj_New() and obj_Convert() routines, the PyArg_Parse and Py_BuildValue helpers. And these can now be vectored through glue routines (by defining USE_TOOLBOX_OBJECT_GLUE) which will do the necessary imports, whereupon the module's init routine will tell the glue routine about the real conversion routine address and everything is fine again. Index: winsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/winsupport.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** winsupport.py 2001/04/25 22:09:29 1.22 --- winsupport.py 2001/05/17 21:58:34 1.23 *************** *** 57,60 **** --- 57,70 ---- #include <%s>""" % MACHEADERFILE + """ + #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_WinObj_New(WindowRef); + extern PyObject *_WinObj_WhichWindow(WindowRef); + extern int _WinObj_Convert(PyObject *, WindowRef *); + + #define WinObj_New _WinObj_New + #define WinObj_WhichWindow _WinObj_WhichWindow + #define WinObj_Convert _WinObj_Convert + #endif + #if !ACCESSOR_CALLS_ARE_FUNCTIONS /* Carbon calls that we emulate in classic mode */ *************** *** 104,107 **** --- 114,123 ---- """ + initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_New); + PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_WhichWindow); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WinObj_Convert); + """ + class MyObjectDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): *************** *** 119,126 **** --- 135,153 ---- OutRbrace() def outputCheckConvertArg(self): + Output("#if 1") + OutLbrace() + Output("DialogRef dlg;") + OutLbrace("if (DlgObj_Convert(v, &dlg) && dlg)") + Output("*p_itself = GetDialogWindow(dlg);") + Output("return 1;") + OutRbrace() + Output("PyErr_Clear();") + OutRbrace() + Output("#else") OutLbrace("if (DlgObj_Check(v))") Output("*p_itself = DlgObj_ConvertToWindow(v);") Output("return 1;") OutRbrace() + Output("#endif") Out(""" if (v == Py_None) { *p_itself = NULL; return 1; } From jackjansen@users.sourceforge.net Thu May 17 23:11:09 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 15:11:09 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Python mactoolboxglue.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv11577/Python/Mac/Python Added Files: mactoolboxglue.c Log Message: Glue code to connect obj_New and obj_Convert routines (the PyArg_Parse and Py_BuildTuple helpers) from one dynamically imported module to another. --- NEW FILE: mactoolboxglue.c --- /* ** mactoolboxglue.c - Glue together the toolbox objects. ** ** Because toolbox modules interdepend on each other, they use each others ** object types, on MacOSX/MachO this leads to the situation that they ** cannot be dynamically loaded (or they would all have to be lumped into ** a single .so, but this would be bad for extensibility). ** ** This file defines wrappers for all the _New and _Convert functions, ** which are the Py_BuildValue and PyArg_ParseTuple helpers. The wrappers ** check an indirection function pointer, and if it isn't filled in yet ** they import the appropriate module, whose init routine should fill in ** the pointer. */ #ifdef USE_TOOLBOX_OBJECT_GLUE #include "python.h" #include "pymactoolbox.h" #define GLUE_NEW(object, routinename, module) \ PyObject *(*PyMacGluePtr_##routinename)(object); \ \ PyObject *routinename(object cobj) { \ if (!PyMacGluePtr_##routinename) { \ if (!PyImport_ImportModule(module)) return NULL; \ if (!PyMacGluePtr_##routinename) { \ PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \ return NULL; \ } \ } \ return (*PyMacGluePtr_##routinename)(cobj); \ } #define GLUE_CONVERT(object, routinename, module) \ int (*PyMacGluePtr_##routinename)(PyObject *, object *); \ \ int routinename(PyObject *pyobj, object *cobj) { \ if (!PyMacGluePtr_##routinename) { \ if (!PyImport_ImportModule(module)) return NULL; \ if (!PyMacGluePtr_##routinename) { \ PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \ return NULL; \ } \ } \ return (*PyMacGluePtr_##routinename)(pyobj, cobj); \ } GLUE_NEW(AppleEvent *, AEDesc_New, "AE") /* XXXX Why by address? */ GLUE_CONVERT(AppleEvent, AEDesc_Convert, "AE") GLUE_NEW(Component, CmpObj_New, "Cm") GLUE_CONVERT(Component, CmpObj_Convert, "Cm") GLUE_NEW(ComponentInstance, CmpInstObj_New, "Cm") GLUE_CONVERT(ComponentInstance, CmpInstObj_Convert, "Cm") GLUE_NEW(ControlHandle, CtlObj_New, "Ctl") GLUE_CONVERT(ControlHandle, CtlObj_Convert, "Ctl") GLUE_NEW(DialogPtr, DlgObj_New, "Dlg") GLUE_CONVERT(DialogPtr, DlgObj_Convert, "Dlg") GLUE_NEW(DialogPtr, DlgObj_WhichDialog, "Dlg") GLUE_NEW(DragReference, DragObj_New, "Drag") GLUE_CONVERT(DragReference, DragObj_Convert, "Drag") GLUE_NEW(ListHandle, ListObj_New, "List") GLUE_CONVERT(ListHandle, ListObj_Convert, "List") GLUE_NEW(MenuHandle, MenuObj_New, "Menu") GLUE_CONVERT(MenuHandle, MenuObj_Convert, "Menu") GLUE_NEW(GrafPtr, GrafObj_New, "Qd") GLUE_CONVERT(GrafPtr, GrafObj_Convert, "Qd") GLUE_NEW(BitMapPtr, BMObj_New, "Qd") GLUE_CONVERT(BitMapPtr, BMObj_Convert, "Qd") GLUE_NEW(RGBColor *, QdRGB_New, "Qd") /* XXXX Why? */ GLUE_CONVERT(RGBColor, QdRGB_Convert, "Qd") GLUE_NEW(GWorldPtr, GWorldObj_New, "Qdoffs") GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Qdoffs") GLUE_NEW(Track, TrackObj_New, "Qt") GLUE_CONVERT(Track, TrackObj_Convert, "Qt") GLUE_NEW(Movie, MovieObj_New, "Qt") GLUE_CONVERT(Movie, MovieObj_Convert, "Qt") GLUE_NEW(MovieController, MovieCtlObj_New, "Qt") GLUE_CONVERT(MovieController, MovieCtlObj_Convert, "Qt") GLUE_NEW(TimeBase, TimeBaseObj_New, "Qt") GLUE_CONVERT(TimeBase, TimeBaseObj_Convert, "Qt") GLUE_NEW(UserData, UserDataObj_New, "Qt") GLUE_CONVERT(UserData, UserDataObj_Convert, "Qt") GLUE_NEW(Media, MediaObj_New, "Qt") GLUE_CONVERT(Media, MediaObj_Convert, "Qt") GLUE_NEW(Handle, ResObj_New, "Res") GLUE_CONVERT(Handle, ResObj_Convert, "Res") GLUE_NEW(Handle, OptResObj_New, "Res") GLUE_CONVERT(Handle, OptResObj_Convert, "Res") GLUE_NEW(TEHandle, TEObj_New, "TE") GLUE_CONVERT(TEHandle, TEObj_Convert, "TE") GLUE_NEW(WindowPtr, WinObj_New, "Win") GLUE_CONVERT(WindowPtr, WinObj_Convert, "Win") GLUE_NEW(WindowPtr, WinObj_WhichWindow, "Win") #endif /* USE_TOOLBOX_OBJECT_GLUE */ From jackjansen@users.sourceforge.net Thu May 17 23:11:46 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 15:11:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Include pymactoolbox.h,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv11689/Python/Mac/Include Modified Files: pymactoolbox.h Log Message: Glue code to connect obj_New and obj_Convert routines (the PyArg_Parse and Py_BuildTuple helpers) from one dynamically imported module to another. Index: pymactoolbox.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/pymactoolbox.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** pymactoolbox.h 2001/02/09 15:59:18 1.4 --- pymactoolbox.h 2001/05/17 22:11:44 1.5 *************** *** 16,19 **** --- 16,41 ---- #include + #ifdef USE_TOOLBOX_OBJECT_GLUE + /* + ** These macros are used in the module init code. If we use toolbox object glue + ** it sets the function pointer to point to the real function. + */ + #define PyMac_INIT_TOOLBOX_OBJECT_NEW(rtn) { \ + extern PyObject *(*PyMacGluePtr_##rtn)(object); \ + PyMacGluePtr_##rtn = _##rtn; \ + } + #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(rtn) { \ + extern int (*PyMacGluePtr_##rtn)(object); \ + PyMacGluePtr_##rtn = _##rtn; \ + } + #else + /* + ** If we don't use toolbox object glue the init macros are empty. Moreover, we define + ** _xxx_New to be the same as xxx_New, and the code in mactoolboxglue isn't included. + */ + #define PyMac_INIT_TOOLBOX_OBJECT_NEW(rtn) + #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(rtn) + #endif /* USE_TOOLBOX_OBJECT_GLUE */ + /* AE exports */ extern PyObject *AEDesc_New(AppleEvent *); /* XXXX Why passed by address?? */ *************** *** 33,40 **** extern PyObject *DlgObj_New(DialogPtr); extern int DlgObj_Convert(PyObject *, DialogPtr *); - extern WindowPtr DlgObj_ConvertToWindow(PyObject *); extern PyObject *DlgObj_WhichDialog(DialogPtr); - extern PyTypeObject Dialog_Type; - #define DlgObj_Check(x) ((x)->ob_type == &Dialog_Type) /* Drag exports */ --- 55,59 ---- *************** *** 68,72 **** extern int MovieObj_Convert(PyObject *, Movie *); extern PyObject *MovieCtlObj_New(MovieController); ! extern int MovieCtlObj_Convert(PyObject *, TimeBase *); extern PyObject *TimeBaseObj_New(TimeBase); extern int TimeBaseObj_Convert(PyObject *, TimeBase *); --- 87,91 ---- extern int MovieObj_Convert(PyObject *, Movie *); extern PyObject *MovieCtlObj_New(MovieController); ! extern int MovieCtlObj_Convert(PyObject *, MovieController *); extern PyObject *TimeBaseObj_New(TimeBase); extern int TimeBaseObj_Convert(PyObject *, TimeBase *); *************** *** 90,95 **** extern int WinObj_Convert(PyObject *, WindowPtr *); extern PyObject *WinObj_WhichWindow(WindowPtr); - extern PyTypeObject Window_Type; - #define WinObj_Check(x) ((x)->ob_type == &Window_Type) --- 109,112 ---- From jackjansen@users.sourceforge.net Thu May 17 23:12:57 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 15:12:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/scripts genpluginprojects.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv11827/Python/Mac/scripts Modified Files: genpluginprojects.py Log Message: Dynamically loaded toolbox modules don't need to link against each other anymore, due to the new glue code that ties them together. Index: genpluginprojects.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/genpluginprojects.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** genpluginprojects.py 2001/02/12 14:47:14 1.11 --- genpluginprojects.py 2001/05/17 22:12:55 1.12 *************** *** 108,126 **** genpluginproject("ppc", "App", libraries=["AppearanceLib"]) genpluginproject("carbon", "App") ! genpluginproject("ppc", "Cm", ! libraries=["QuickTimeLib"], ! extraexportsymbols=[ ! "CmpObj_New", ! "CmpObj_Convert", ! "CmpInstObj_New", ! "CmpInstObj_Convert", ! ]) ! genpluginproject("carbon", "Cm", ! extraexportsymbols=[ ! "CmpObj_New", ! "CmpObj_Convert", ! "CmpInstObj_New", ! "CmpInstObj_Convert", ! ]) genpluginproject("all", "Fm") genpluginproject("ppc", "Help") --- 108,128 ---- genpluginproject("ppc", "App", libraries=["AppearanceLib"]) genpluginproject("carbon", "App") ! ## genpluginproject("ppc", "Cm", ! ## libraries=["QuickTimeLib"], ! ## extraexportsymbols=[ ! ## "CmpObj_New", ! ## "CmpObj_Convert", ! ## "CmpInstObj_New", ! ## "CmpInstObj_Convert", ! ## ]) ! ## genpluginproject("carbon", "Cm", ! ## extraexportsymbols=[ ! ## "CmpObj_New", ! ## "CmpObj_Convert", ! ## "CmpInstObj_New", ! ## "CmpInstObj_Convert", ! ## ]) ! genpluginproject("ppc", "Cm", libraries=["QuickTimeLib"]) ! genpluginproject("carbon", "Cm") genpluginproject("all", "Fm") genpluginproject("ppc", "Help") *************** *** 128,137 **** genpluginproject("carbon", "Icn") genpluginproject("all", "List") ! genpluginproject("ppc", "Qt", libraries=["QuickTimeLib", "Cm.ppc.slb", "Qdoffs.ppc.slb"], ! extradirs=["::Plugins"]) ! genpluginproject("carbon", "Qt", libraries=["Cm.carbon.slb", "Qdoffs.carbon.slb"], ! extradirs=["::Plugins"]) ! genpluginproject("all", "Qdoffs", ! extraexportsymbols=["GWorldObj_New", "GWorldObj_Convert"]) genpluginproject("all", "Scrap") genpluginproject("ppc", "Snd", libraries=["SoundLib"]) --- 130,142 ---- genpluginproject("carbon", "Icn") genpluginproject("all", "List") ! ## genpluginproject("ppc", "Qt", libraries=["QuickTimeLib", "Cm.ppc.slb", "Qdoffs.ppc.slb"], ! ## extradirs=["::Plugins"]) ! genpluginproject("ppc", "Qt", libraries=["QuickTimeLib"]) ! ## genpluginproject("carbon", "Qt", libraries=["Cm.carbon.slb", "Qdoffs.carbon.slb"], ! ## extradirs=["::Plugins"]) ! genpluginproject("carbon", "Qt") ! ## genpluginproject("all", "Qdoffs", ! ## extraexportsymbols=["GWorldObj_New", "GWorldObj_Convert"]) ! genpluginproject("all", "Qdoffs") genpluginproject("all", "Scrap") genpluginproject("ppc", "Snd", libraries=["SoundLib"]) From jackjansen@users.sourceforge.net Thu May 17 23:14:09 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 15:14:09 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Build PythonCore.exp,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv11989/Python/Mac/Build Modified Files: PythonCore.exp Log Message: Added pymactoolboxglue.c and changed the exported symbols having to do with this. Index: PythonCore.exp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonCore.exp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** PythonCore.exp 2001/05/12 21:08:32 1.7 --- PythonCore.exp 2001/05/17 22:14:07 1.8 *************** *** 23,26 **** --- 23,27 ---- __ct__15GUSISIOUXSocketFv # GUSISIOUXSocket::GUSISIOUXSocket() Instance__15GUSISIOUXSocketFv # GUSISIOUXSocket::Instance() + Py_FileSystemDefaultEncoding _PyBuiltin_Init _PyEval_SliceIndex *************** *** 487,491 **** --- 488,495 ---- PyString_Size PyString_AsEncodedString + PyString_AsEncodedObject PyString_Encode + PyString_AsDecodedString + PyString_AsDecodedObject PyString_Decode PyString_FromString *************** *** 684,693 **** Control_Type initCtl ! CtlObj_Convert ! CtlObj_New DlgObj_chain Dialog_Type initDlg - DlgObj_ConvertToWindow DlgObj_Convert DlgObj_New --- 688,696 ---- Control_Type initCtl ! _CtlObj_Convert ! _CtlObj_New DlgObj_chain Dialog_Type initDlg DlgObj_Convert DlgObj_New *************** *** 696,701 **** Menu_Type initMenu ! MenuObj_Convert ! MenuObj_New GrafObj_chain GrafPort_Type --- 699,704 ---- Menu_Type initMenu ! _MenuObj_Convert ! _MenuObj_New GrafObj_chain GrafPort_Type *************** *** 705,721 **** initQd BMObj_NewCopied ! BMObj_Convert ! BMObj_New ! GrafObj_Convert ! GrafObj_New ! QdRGB_Convert ! QdRGB_New ResObj_chain Resource_Type initRes ! OptResObj_Convert ! OptResObj_New ! ResObj_Convert ! ResObj_New WinObj_chain Window_Type --- 708,724 ---- initQd BMObj_NewCopied ! _BMObj_Convert ! _BMObj_New ! _GrafObj_Convert ! _GrafObj_New ! _QdRGB_Convert ! _QdRGB_New ResObj_chain Resource_Type initRes ! _OptResObj_Convert ! _OptResObj_New ! _ResObj_Convert ! _ResObj_New WinObj_chain Window_Type *************** *** 874,879 **** upp_AEIdleProc initAE ! AEDesc_Convert ! AEDesc_New init_locale initEvt --- 877,882 ---- upp_AEIdleProc initAE ! _AEDesc_Convert ! _AEDesc_New init_locale initEvt *************** *** 886,891 **** dragglue_SendDataUPP initDrag ! DragObj_Convert ! DragObj_New initxreadlines PyCell_Type --- 889,894 ---- dragglue_SendDataUPP initDrag ! _DragObj_Convert ! _DragObj_New initxreadlines PyCell_Type *************** *** 900,903 **** --- 903,986 ---- PyCallIter_New PySeqIter_New + PyMacGluePtr_AEDesc_New + PyMacGluePtr_AEDesc_Convert + PyMacGluePtr_CmpObj_New + PyMacGluePtr_CmpObj_Convert + PyMacGluePtr_CmpInstObj_New + PyMacGluePtr_CmpInstObj_Convert + PyMacGluePtr_CtlObj_New + PyMacGluePtr_CtlObj_Convert + PyMacGluePtr_DragObj_New + PyMacGluePtr_DragObj_Convert + PyMacGluePtr_ListObj_New + PyMacGluePtr_ListObj_Convert + PyMacGluePtr_MenuObj_New + PyMacGluePtr_MenuObj_Convert + PyMacGluePtr_GrafObj_New + PyMacGluePtr_GrafObj_Convert + PyMacGluePtr_BMObj_New + PyMacGluePtr_BMObj_Convert + PyMacGluePtr_QdRGB_New + PyMacGluePtr_QdRGB_Convert + PyMacGluePtr_GWorldObj_New + PyMacGluePtr_GWorldObj_Convert + PyMacGluePtr_TrackObj_New + PyMacGluePtr_TrackObj_Convert + PyMacGluePtr_MovieObj_New + PyMacGluePtr_MovieObj_Convert + PyMacGluePtr_MovieCtlObj_New + PyMacGluePtr_MovieCtlObj_Convert + PyMacGluePtr_TimeBaseObj_New + PyMacGluePtr_TimeBaseObj_Convert + PyMacGluePtr_UserDataObj_New + PyMacGluePtr_UserDataObj_Convert + PyMacGluePtr_MediaObj_New + PyMacGluePtr_MediaObj_Convert + PyMacGluePtr_ResObj_New + PyMacGluePtr_ResObj_Convert + PyMacGluePtr_OptResObj_New + PyMacGluePtr_OptResObj_Convert + PyMacGluePtr_TEObj_New + PyMacGluePtr_TEObj_Convert + TEObj_Convert + TEObj_New + OptResObj_Convert + OptResObj_New + ResObj_Convert + ResObj_New + MediaObj_Convert + MediaObj_New + UserDataObj_Convert + UserDataObj_New + TimeBaseObj_Convert + TimeBaseObj_New + MovieCtlObj_Convert + MovieCtlObj_New + MovieObj_Convert + MovieObj_New + TrackObj_Convert + TrackObj_New + GWorldObj_Convert + GWorldObj_New + QdRGB_Convert + QdRGB_New + BMObj_Convert + BMObj_New + GrafObj_Convert + GrafObj_New + MenuObj_Convert + MenuObj_New + ListObj_Convert + ListObj_New + DragObj_Convert + DragObj_New + CtlObj_Convert + CtlObj_New + CmpInstObj_Convert + CmpInstObj_New + CmpObj_Convert + CmpObj_New + AEDesc_Convert + AEDesc_New GUSISetupConsoleStdio GUSIStdioFlush From jackjansen@users.sourceforge.net Thu May 17 23:14:26 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 15:14:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Build PythonCore.mcp,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv12062/Python/Mac/Build Modified Files: PythonCore.mcp Log Message: Added pymactoolboxglue.c and changed the exported symbols having to do with this. Index: PythonCore.mcp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonCore.mcp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -r1.20 -r1.21 Binary files /tmp/cvsvObk48 and /tmp/cvsiDHwd7 differ From jackjansen@users.sourceforge.net Thu May 17 23:14:38 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Thu, 17 May 2001 15:14:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Build PythonCoreCarbon.exp,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Build In directory usw-pr-cvs1:/tmp/cvs-serv12122/Python/Mac/Build Modified Files: PythonCoreCarbon.exp Log Message: Added pymactoolboxglue.c and changed the exported symbols having to do with this. Index: PythonCoreCarbon.exp =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Build/PythonCoreCarbon.exp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** PythonCoreCarbon.exp 2001/05/12 21:08:56 1.7 --- PythonCoreCarbon.exp 2001/05/17 22:14:36 1.8 *************** *** 23,26 **** --- 23,27 ---- __ct__15GUSISIOUXSocketFv # GUSISIOUXSocket::GUSISIOUXSocket() Instance__15GUSISIOUXSocketFv # GUSISIOUXSocket::Instance() + Py_FileSystemDefaultEncoding _PyBuiltin_Init _PyEval_SliceIndex *************** *** 487,491 **** --- 488,495 ---- PyString_Size PyString_AsEncodedString + PyString_AsEncodedObject PyString_Encode + PyString_AsDecodedString + PyString_AsDecodedObject PyString_Decode PyString_FromString *************** *** 677,686 **** Control_Type initCtl ! CtlObj_Convert ! CtlObj_New DlgObj_chain Dialog_Type initDlg - DlgObj_ConvertToWindow DlgObj_Convert DlgObj_New --- 681,689 ---- Control_Type initCtl ! _CtlObj_Convert ! _CtlObj_New DlgObj_chain Dialog_Type initDlg DlgObj_Convert DlgObj_New *************** *** 689,694 **** Menu_Type initMenu ! MenuObj_Convert ! MenuObj_New GrafObj_chain GrafPort_Type --- 692,697 ---- Menu_Type initMenu ! _MenuObj_Convert ! _MenuObj_New GrafObj_chain GrafPort_Type *************** *** 698,714 **** initQd BMObj_NewCopied ! BMObj_Convert ! BMObj_New ! GrafObj_Convert ! GrafObj_New ! QdRGB_Convert ! QdRGB_New ResObj_chain Resource_Type initRes ! OptResObj_Convert ! OptResObj_New ! ResObj_Convert ! ResObj_New WinObj_chain Window_Type --- 701,717 ---- initQd BMObj_NewCopied ! _BMObj_Convert ! _BMObj_New ! _GrafObj_Convert ! _GrafObj_New ! _QdRGB_Convert ! _QdRGB_New ResObj_chain Resource_Type initRes ! _OptResObj_Convert ! _OptResObj_New ! _ResObj_Convert ! _ResObj_New WinObj_chain Window_Type *************** *** 867,872 **** upp_AEIdleProc initAE ! AEDesc_Convert ! AEDesc_New init_locale initEvt --- 870,875 ---- upp_AEIdleProc initAE ! _AEDesc_Convert ! _AEDesc_New init_locale initEvt *************** *** 879,884 **** dragglue_SendDataUPP initDrag ! DragObj_Convert ! DragObj_New initxreadlines PyCell_Type --- 882,887 ---- dragglue_SendDataUPP initDrag ! _DragObj_Convert ! _DragObj_New initxreadlines PyCell_Type *************** *** 893,896 **** --- 896,979 ---- PyCallIter_New PySeqIter_New + PyMacGluePtr_AEDesc_New + PyMacGluePtr_AEDesc_Convert + PyMacGluePtr_CmpObj_New + PyMacGluePtr_CmpObj_Convert + PyMacGluePtr_CmpInstObj_New + PyMacGluePtr_CmpInstObj_Convert + PyMacGluePtr_CtlObj_New + PyMacGluePtr_CtlObj_Convert + PyMacGluePtr_DragObj_New + PyMacGluePtr_DragObj_Convert + PyMacGluePtr_ListObj_New + PyMacGluePtr_ListObj_Convert + PyMacGluePtr_MenuObj_New + PyMacGluePtr_MenuObj_Convert + PyMacGluePtr_GrafObj_New + PyMacGluePtr_GrafObj_Convert + PyMacGluePtr_BMObj_New + PyMacGluePtr_BMObj_Convert + PyMacGluePtr_QdRGB_New + PyMacGluePtr_QdRGB_Convert + PyMacGluePtr_GWorldObj_New + PyMacGluePtr_GWorldObj_Convert + PyMacGluePtr_TrackObj_New + PyMacGluePtr_TrackObj_Convert + PyMacGluePtr_MovieObj_New + PyMacGluePtr_MovieObj_Convert + PyMacGluePtr_MovieCtlObj_New + PyMacGluePtr_MovieCtlObj_Convert + PyMacGluePtr_TimeBaseObj_New + PyMacGluePtr_TimeBaseObj_Convert + PyMacGluePtr_UserDataObj_New + PyMacGluePtr_UserDataObj_Convert + PyMacGluePtr_MediaObj_New + PyMacGluePtr_MediaObj_Convert + PyMacGluePtr_ResObj_New + PyMacGluePtr_ResObj_Convert + PyMacGluePtr_OptResObj_New + PyMacGluePtr_OptResObj_Convert + PyMacGluePtr_TEObj_New + PyMacGluePtr_TEObj_Convert + TEObj_Convert + TEObj_New + OptResObj_Convert + OptResObj_New + ResObj_Convert + ResObj_New + MediaObj_Convert + MediaObj_New + UserDataObj_Convert + UserDataObj_New + TimeBaseObj_Convert + TimeBaseObj_New + MovieCtlObj_Convert + MovieCtlObj_New + MovieObj_Convert + MovieObj_New + TrackObj_Convert + TrackObj_New + GWorldObj_Convert + GWorldObj_New + QdRGB_Convert + QdRGB_New + BMObj_Convert + BMObj_New + GrafObj_Convert + GrafObj_New + MenuObj_Convert + MenuObj_New + ListObj_Convert + ListObj_New + DragObj_Convert + DragObj_New + CtlObj_Convert + CtlObj_New + CmpInstObj_Convert + CmpInstObj_New + CmpObj_Convert + CmpObj_New + AEDesc_Convert + AEDesc_New GUSISetupConsoleStdio GUSIStdioFlush From tim_one@users.sourceforge.net Thu May 17 23:25:36 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 17 May 2001 15:25:36 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.88,2.89 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv13430/python/dist/src/Objects Modified Files: dictobject.c Log Message: Speed dictresize by collapsing its two passes into one; the reason given in the comments for using two passes was bogus, as the only object that can get decref'ed due to the copy is the dummy key, and decref'ing dummy can't have side effects (for one thing, dummy is immortal! for another, it's a string object, not a potentially dangerous user-defined object). Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.88 retrieving revision 2.89 diff -C2 -r2.88 -r2.89 *** dictobject.c 2001/05/13 06:43:53 2.88 --- dictobject.c 2001/05/17 22:25:34 2.89 *************** *** 397,410 **** mp->ma_used = 0; ! /* Make two passes, so we can avoid decrefs ! (and possible side effects) till the table is copied */ for (i = 0, ep = oldtable; i < oldsize; i++, ep++) { ! if (ep->me_value != NULL) ! insertdict(mp,ep->me_key,ep->me_hash,ep->me_value); ! } ! for (i = 0, ep = oldtable; i < oldsize; i++, ep++) { ! if (ep->me_value == NULL) { ! Py_XDECREF(ep->me_key); } } --- 397,411 ---- mp->ma_used = 0; ! /* Copy the data over; this is refcount-neutral for active entries; ! dummy entries aren't copied over, of course */ for (i = 0, ep = oldtable; i < oldsize; i++, ep++) { ! if (ep->me_value != NULL) /* active entry */ ! insertdict(mp, ep->me_key, ep->me_hash, ep->me_value); ! ! else if (ep->me_key != NULL) { /* dummy entry */ ! assert(ep->me_key == dummy); ! Py_DECREF(ep->me_key); } + /* else key == value == NULL: nothing to do */ } From gvanrossum@users.sourceforge.net Fri May 18 15:50:54 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Fri, 18 May 2001 07:50:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib HTMLParser.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv27568 Added Files: HTMLParser.py Log Message: A much improved HTML parser -- a replacement for sgmllib. The API is derived from but not quite compatible with that of sgmllib, so it's a new file. I suppose it needs documentation, and htmllib needs to be changed to use this instead of sgmllib, and sgmllib needs to be declared obsolete. But that can all be done later. This code was first published as part of TAL (part of Zope Page Templates), but that was strongly based on sgmllib anyway. Authors are Fred drake and Guido van Rossum. --- NEW FILE: HTMLParser.py --- """A parser for HTML.""" # This file is based on sgmllib.py, but the API is slightly different. # XXX There should be a way to distinguish between PCDATA (parsed # character data -- the normal case), RCDATA (replaceable character # data -- only char and entity references and end tags are special) # and CDATA (character data -- only end tags are special). import re import string # Regular expressions used for parsing interesting_normal = re.compile('[&<]') interesting_cdata = re.compile(r'<(/|\Z)') incomplete = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*|#[0-9]*)?') entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]') charref = re.compile('&#([0-9]+)[^0-9]') starttagopen = re.compile('<[a-zA-Z]') piopen = re.compile(r'<\?') piclose = re.compile('>') endtagopen = re.compile(']*>') commentopen = re.compile(' sample text """, [ ("data", "\n"), ("decl", "DOCTYPE html PUBLIC 'foo'"), ("data", "\n"), ("starttag", "html", []), ("entityref", "entity"), ("charref", "32"), ("data", "\n"), ("comment", "comment1a\n-><
", [ ("starttag", "a", []), ("starttag", "b", []), ("endtag", "a"), ("endtag", "b"), ]) def check_attr_syntax(self): output = [ ("starttag", "a", [("b", "v"), ("c", "v"), ("d", "v"), ("e", None)]) ] self._run_check("""""", output) self._run_check("""""", output) self._run_check("""""", output) self._run_check("""""", output) def check_attr_values(self): self._run_check("""""", [("starttag", "a", [("b", "xxx\n\txxx"), ("c", "yyy\t\nyyy"), ("d", "\txyz\n")]) ]) self._run_check("""""", [ ("starttag", "a", [("b", ""), ("c", "")]), ]) def check_attr_entity_replacement(self): self._run_check("""""", [ ("starttag", "a", [("b", "&><\"'")]), ]) def check_attr_funky_names(self): self._run_check("""""", [ ("starttag", "a", [("a.b", "v"), ("c:d", "v"), ("e-f", "v")]), ]) def check_starttag_end_boundary(self): self._run_check("""""", [("starttag", "a", [("b", "<")])]) self._run_check("""""", [("starttag", "a", [("b", ">")])]) def check_buffer_artefacts(self): output = [("starttag", "a", [("b", "<")])] self._run_check([""], output) self._run_check([""], output) self._run_check([""], output) self._run_check([""], output) self._run_check([""], output) self._run_check([""], output) output = [("starttag", "a", [("b", ">")])] self._run_check([""], output) self._run_check([""], output) self._run_check([""], output) self._run_check(["'>"], output) self._run_check([""], output) self._run_check([""], output) def check_starttag_junk_chars(self): self._parse_error("<") self._parse_error("<>") self._parse_error("") self._parse_error("") self._parse_error("") self._parse_error("") self._parse_error("<$") self._parse_error("<$>") self._parse_error("") self._parse_error("'") self._parse_error("

", [ ("starttag", "p", []), ("startendtag", "img", [("src", "foo")]), ("endtag", "p"), ]) def check_get_starttag_text(self): s = """""" self._run_check_extra(s, [ ("starttag", "foo:bar", [("one", "1"), ("two", "2")]), ("starttag_text", s)]) def check_cdata_content(self): s = """""" self._run_check(s, [ ("starttag", "script", []), ("data", " ¬-an-entity-ref; "), ("endtag", "script"), ]) s = """""" self._run_check(s, [ ("starttag", "script", []), ("data", " "), ("endtag", "script"), ]) test_support.run_unittest(HTMLParserTestCase) From jhylton@users.sourceforge.net Fri May 18 21:53:17 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 18 May 2001 13:53:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.243,2.244 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv6376 Modified Files: ceval.c Log Message: Add a second special case to the inline function call code in eval_code2(). If we have a PyCFunction (builtin) and it is METH_VARARGS only, load the args and dispatch to call_cfunction() directly. This provides a small speedup for perhaps the most common function calls -- builtins. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.243 retrieving revision 2.244 diff -C2 -r2.243 -r2.244 *** ceval.c 2001/05/05 00:14:56 2.243 --- ceval.c 2001/05/18 20:53:14 2.244 *************** *** 1970,1974 **** */ if (PyCFunction_Check(func)) { ! if (PyCFunction_GET_FLAGS(func) == 0) { x = fast_cfunction(func, &stack_pointer, na); --- 1970,1980 ---- */ if (PyCFunction_Check(func)) { ! int flags = PyCFunction_GET_FLAGS(func); ! if (flags == METH_VARARGS) { ! PyObject *callargs; ! callargs = load_args(&stack_pointer, na); ! x = call_cfunction(func, callargs, NULL); ! Py_XDECREF(callargs); ! } else if (flags == 0) { x = fast_cfunction(func, &stack_pointer, na); From jhylton@users.sourceforge.net Fri May 18 21:57:40 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Fri, 18 May 2001 13:57:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python getargs.c,2.56,2.57 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv7254 Modified Files: getargs.c Log Message: vgetargs1() and vgetargskeywords(): Replace uses of PyTuple_Size() and PyTuple_GetItem() with PyTuple_GET_SIZE() and PyTuple_GET_ITEM(). The code has already done a PyTuple_Check(). Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.56 retrieving revision 2.57 diff -C2 -r2.56 -r2.57 *** getargs.c 2001/05/13 08:04:26 2.56 --- getargs.c 2001/05/18 20:57:38 2.57 *************** *** 113,117 **** else if (level != 0) ; /* Pass */ ! else if (c == 'e') ; /* Pass */ else if (isalpha(c)) --- 113,117 ---- else if (level != 0) ; /* Pass */ ! else if (c == 'e') ; /* Pass */ else if (isalpha(c)) *************** *** 167,171 **** } ! len = PyTuple_Size(args); if (len < min || max < len) { --- 167,171 ---- } ! len = PyTuple_GET_SIZE(args); if (len < min || max < len) { *************** *** 189,194 **** if (*format == '|') format++; ! msg = convertitem(PyTuple_GetItem(args, i), &format, p_va, ! levels, msgbuf); if (msg) { seterror(i+1, msg, levels, fname, message); --- 189,194 ---- if (*format == '|') format++; ! msg = convertitem(PyTuple_GET_ITEM(args, i), &format, p_va, ! levels, msgbuf); if (msg) { seterror(i+1, msg, levels, fname, message); *************** *** 1012,1021 **** fname = format; break; ! } ! else if (c == ';') { message = format; break; ! } ! else if (c == 'e') ; /* Pass */ else if (isalpha(c)) --- 1012,1019 ---- fname = format; break; ! } else if (c == ';') { message = format; break; ! } else if (c == 'e') ; /* Pass */ else if (isalpha(c)) *************** *** 1036,1040 **** } ! tplen = PyTuple_Size(args); /* do a cursory check of the keywords just to see how many we got */ --- 1034,1038 ---- } ! tplen = PyTuple_GET_SIZE(args); /* do a cursory check of the keywords just to see how many we got */ *************** *** 1112,1116 **** if (*format == '|') format++; ! msg = convertitem(PyTuple_GetItem(args, i), &format, p_va, levels, msgbuf); if (msg) { --- 1110,1114 ---- if (*format == '|') format++; ! msg = convertitem(PyTuple_GET_ITEM(args, i), &format, p_va, levels, msgbuf); if (msg) { From fdrake@users.sourceforge.net Fri May 18 22:03:42 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 18 May 2001 14:03:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python getargs.c,2.57,2.58 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv8572/Python Modified Files: getargs.c Log Message: Fix whitespace botch. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.57 retrieving revision 2.58 diff -C2 -r2.57 -r2.58 *** getargs.c 2001/05/18 20:57:38 2.57 --- getargs.c 2001/05/18 21:03:40 2.58 *************** *** 113,117 **** else if (level != 0) ; /* Pass */ ! else if (c == 'e') ; /* Pass */ else if (isalpha(c)) --- 113,117 ---- else if (level != 0) ; /* Pass */ ! else if (c == 'e') ; /* Pass */ else if (isalpha(c)) From fdrake@users.sourceforge.net Fri May 18 22:38:54 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 18 May 2001 14:38:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_grp.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16387 Modified Files: test_grp.py Log Message: Simple conversion to PyUnit. Index: test_grp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grp.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** test_grp.py 2001/01/17 21:51:35 1.7 --- test_grp.py 2001/05/18 21:38:52 1.8 *************** *** 1,25 **** ! #! /usr/bin/env python ! """Test script for the grp module ! Roger E. Masse ! """ import grp ! from test_support import verbose ! groups = grp.getgrall() ! if verbose: ! print 'Groups:' ! for group in groups: ! print group ! ! if not groups: ! if verbose: ! print "Empty Group Database -- no further tests of grp module possible" ! else: ! group = grp.getgrgid(groups[0][2]) ! if verbose: ! print 'Group Entry for GID %d: %s' % (groups[0][2], group) ! ! group = grp.getgrnam(groups[0][0]) ! if verbose: ! print 'Group Entry for group %s: %s' % (groups[0][0], group) --- 1,22 ---- ! """Test script for the grp module.""" + # XXX This really needs some work, but what are the expected invariants? + import grp ! import test_support ! import unittest ! ! ! class GroupDatabaseTestCase(unittest.TestCase): ! ! def setUp(self): ! self.groups = grp.getgrall() ! ! def test_getgrgid(self): ! entry = grp.getgrgid(self.groups[0][2]) ! ! def test_getgrnam(self): ! entry = grp.getgrnam(self.groups[0][0]) ! ! test_support.run_unittest(GroupDatabaseTestCase) From fdrake@users.sourceforge.net Fri May 18 22:45:37 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 18 May 2001 14:45:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_hash.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv17838 Modified Files: test_hash.py Log Message: Simple conversion to PyUnit. Index: test_hash.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hash.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_hash.py 2000/10/23 17:22:07 1.2 --- test_hash.py 2001/05/18 21:45:35 1.3 *************** *** 4,23 **** import test_support ! def same_hash(*objlist): ! # hash each object given an raise TestFailed if ! # the hash values are not all the same ! hashed = map(hash, objlist) ! for h in hashed[1:]: ! if h != hashed[0]: ! raise TestFailed, "hashed values differ: %s" % `objlist` ! same_hash(1, 1L, 1.0, 1.0+0.0j) ! same_hash(int(1), long(1), float(1), complex(1)) ! same_hash(long(1.23e300), float(1.23e300)) ! same_hash(float(0.5), complex(0.5, 0.0)) --- 4,31 ---- import test_support + import unittest ! class HashEqualityTestCase(unittest.TestCase): + def same_hash(self, *objlist): + # hash each object given an raise TestFailed if + # the hash values are not all the same + hashed = map(hash, objlist) + for h in hashed[1:]: + if h != hashed[0]: + self.fail("hashed values differ: %s" % `objlist`) + def test_numeric_literals(self): + self.same_hash(1, 1L, 1.0, 1.0+0.0j) ! def test_coerced_integers(self): ! self.same_hash(int(1), long(1), float(1), complex(1), ! int('1'), float('1.0')) ! def test_coerced_floats(self): ! self.same_hash(long(1.23e300), float(1.23e300)) ! self.same_hash(float(0.5), complex(0.5, 0.0)) ! ! test_support.run_unittest(HashEqualityTestCase) From fdrake@users.sourceforge.net Fri May 18 22:50:04 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 18 May 2001 14:50:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_hash.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18913 Modified Files: test_hash.py Log Message: Update a comment. Index: test_hash.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hash.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_hash.py 2001/05/18 21:45:35 1.3 --- test_hash.py 2001/05/18 21:50:02 1.4 *************** *** 10,15 **** def same_hash(self, *objlist): ! # hash each object given an raise TestFailed if ! # the hash values are not all the same hashed = map(hash, objlist) for h in hashed[1:]: --- 10,15 ---- def same_hash(self, *objlist): ! # Hash each object given and fail if ! # the hash values are not all the same. hashed = map(hash, objlist) for h in hashed[1:]: From tim_one@users.sourceforge.net Sat May 19 08:04:41 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 19 May 2001 00:04:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.89,2.90 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25758/python/dist/src/Objects Modified Files: dictobject.c Log Message: Bugfix candidate. Two exceedingly unlikely errors in dictresize(): 1. The loop for finding the new size had an off-by-one error at the end (could over-index the polys[] vector). 2. The polys[] vector ended with a 0, apparently intended as a sentinel value but never used as such; i.e., it was never checked, so 0 could have been used *as* a polynomial. Neither bug could trigger unless a dict grew to 2**30 slots; since that would consume at least 12GB of memory just to hold the dict pointers, I'm betting it's not the cause of the bug Fred's tracking down . Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.89 retrieving revision 2.90 diff -C2 -r2.89 -r2.90 *** dictobject.c 2001/05/17 22:25:34 2.89 --- dictobject.c 2001/05/19 07:04:38 2.90 *************** *** 48,52 **** 536870912 + 5, 1073741824 + 83, - 0 }; --- 48,51 ---- *************** *** 374,379 **** register dictentry *ep; register int i; for (i = 0, newsize = MINSIZE; ; i++, newsize <<= 1) { ! if (i > sizeof(polys)/sizeof(polys[0])) { /* Ran out of polynomials */ PyErr_NoMemory(); --- 373,380 ---- register dictentry *ep; register int i; + + assert(minused >= 0); for (i = 0, newsize = MINSIZE; ; i++, newsize <<= 1) { ! if (i >= sizeof(polys)/sizeof(polys[0])) { /* Ran out of polynomials */ PyErr_NoMemory(); From jackjansen@users.sourceforge.net Sat May 19 13:31:11 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 19 May 2001 05:31:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Python macglue.c,1.92,1.93 mactoolboxglue.c,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv31482 Modified Files: macglue.c Removed Files: mactoolboxglue.c Log Message: Merged mactoolboxglue.c into macglue.c. A later step will be to separate out the stuff that is only needed on classic-MacOS. Index: macglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macglue.c,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -r1.92 -r1.93 *** macglue.c 2001/05/12 22:46:35 1.92 --- macglue.c 2001/05/19 12:31:09 1.93 *************** *** 30,33 **** --- 30,34 ---- #include "import.h" #include "importdl.h" + #include "pymactoolbox.h" #include "pythonresources.h" *************** *** 1148,1149 **** --- 1149,1255 ---- return Py_BuildValue("(ll)", w->hi, w->lo); } + + #ifdef USE_TOOLBOX_OBJECT_GLUE + /* + ** Glue together the toolbox objects. + ** + ** Because toolbox modules interdepend on each other, they use each others + ** object types, on MacOSX/MachO this leads to the situation that they + ** cannot be dynamically loaded (or they would all have to be lumped into + ** a single .so, but this would be bad for extensibility). + ** + ** This file defines wrappers for all the _New and _Convert functions, + ** which are the Py_BuildValue and PyArg_ParseTuple helpers. The wrappers + ** check an indirection function pointer, and if it isn't filled in yet + ** they import the appropriate module, whose init routine should fill in + ** the pointer. + */ + + #define GLUE_NEW(object, routinename, module) \ + PyObject *(*PyMacGluePtr_##routinename)(object); \ + \ + PyObject *routinename(object cobj) { \ + if (!PyMacGluePtr_##routinename) { \ + if (!PyImport_ImportModule(module)) return NULL; \ + if (!PyMacGluePtr_##routinename) { \ + PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \ + return NULL; \ + } \ + } \ + return (*PyMacGluePtr_##routinename)(cobj); \ + } + + #define GLUE_CONVERT(object, routinename, module) \ + int (*PyMacGluePtr_##routinename)(PyObject *, object *); \ + \ + int routinename(PyObject *pyobj, object *cobj) { \ + if (!PyMacGluePtr_##routinename) { \ + if (!PyImport_ImportModule(module)) return NULL; \ + if (!PyMacGluePtr_##routinename) { \ + PyErr_SetString(PyExc_ImportError, "Module did not provide routine: " module ": " #routinename); \ + return NULL; \ + } \ + } \ + return (*PyMacGluePtr_##routinename)(pyobj, cobj); \ + } + + GLUE_NEW(AppleEvent *, AEDesc_New, "AE") /* XXXX Why by address? */ + GLUE_CONVERT(AppleEvent, AEDesc_Convert, "AE") + + GLUE_NEW(Component, CmpObj_New, "Cm") + GLUE_CONVERT(Component, CmpObj_Convert, "Cm") + GLUE_NEW(ComponentInstance, CmpInstObj_New, "Cm") + GLUE_CONVERT(ComponentInstance, CmpInstObj_Convert, "Cm") + + GLUE_NEW(ControlHandle, CtlObj_New, "Ctl") + GLUE_CONVERT(ControlHandle, CtlObj_Convert, "Ctl") + + GLUE_NEW(DialogPtr, DlgObj_New, "Dlg") + GLUE_CONVERT(DialogPtr, DlgObj_Convert, "Dlg") + GLUE_NEW(DialogPtr, DlgObj_WhichDialog, "Dlg") + + GLUE_NEW(DragReference, DragObj_New, "Drag") + GLUE_CONVERT(DragReference, DragObj_Convert, "Drag") + + GLUE_NEW(ListHandle, ListObj_New, "List") + GLUE_CONVERT(ListHandle, ListObj_Convert, "List") + + GLUE_NEW(MenuHandle, MenuObj_New, "Menu") + GLUE_CONVERT(MenuHandle, MenuObj_Convert, "Menu") + + GLUE_NEW(GrafPtr, GrafObj_New, "Qd") + GLUE_CONVERT(GrafPtr, GrafObj_Convert, "Qd") + GLUE_NEW(BitMapPtr, BMObj_New, "Qd") + GLUE_CONVERT(BitMapPtr, BMObj_Convert, "Qd") + GLUE_NEW(RGBColor *, QdRGB_New, "Qd") /* XXXX Why? */ + GLUE_CONVERT(RGBColor, QdRGB_Convert, "Qd") + + GLUE_NEW(GWorldPtr, GWorldObj_New, "Qdoffs") + GLUE_CONVERT(GWorldPtr, GWorldObj_Convert, "Qdoffs") + + GLUE_NEW(Track, TrackObj_New, "Qt") + GLUE_CONVERT(Track, TrackObj_Convert, "Qt") + GLUE_NEW(Movie, MovieObj_New, "Qt") + GLUE_CONVERT(Movie, MovieObj_Convert, "Qt") + GLUE_NEW(MovieController, MovieCtlObj_New, "Qt") + GLUE_CONVERT(MovieController, MovieCtlObj_Convert, "Qt") + GLUE_NEW(TimeBase, TimeBaseObj_New, "Qt") + GLUE_CONVERT(TimeBase, TimeBaseObj_Convert, "Qt") + GLUE_NEW(UserData, UserDataObj_New, "Qt") + GLUE_CONVERT(UserData, UserDataObj_Convert, "Qt") + GLUE_NEW(Media, MediaObj_New, "Qt") + GLUE_CONVERT(Media, MediaObj_Convert, "Qt") + + GLUE_NEW(Handle, ResObj_New, "Res") + GLUE_CONVERT(Handle, ResObj_Convert, "Res") + GLUE_NEW(Handle, OptResObj_New, "Res") + GLUE_CONVERT(Handle, OptResObj_Convert, "Res") + + GLUE_NEW(TEHandle, TEObj_New, "TE") + GLUE_CONVERT(TEHandle, TEObj_Convert, "TE") + + GLUE_NEW(WindowPtr, WinObj_New, "Win") + GLUE_CONVERT(WindowPtr, WinObj_Convert, "Win") + GLUE_NEW(WindowPtr, WinObj_WhichWindow, "Win") + + #endif /* USE_TOOLBOX_OBJECT_GLUE */ \ No newline at end of file --- mactoolboxglue.c DELETED --- From jackjansen@users.sourceforge.net Sat May 19 13:32:41 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 19 May 2001 05:32:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Include getapplbycreator.h,1.2,1.3 pymactoolbox.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv31950/Include Modified Files: getapplbycreator.h pymactoolbox.h Log Message: include Carbon/Carbon.h in stead of universal headers, if appropriate. Index: getapplbycreator.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/getapplbycreator.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** getapplbycreator.h 1997/01/31 16:14:23 1.2 --- getapplbycreator.h 2001/05/19 12:32:39 1.3 *************** *** 23,28 **** --- 23,32 ---- ******************************************************************/ + #ifdef WITHOUT_FRAMEWORKS #include #include + #else + #include + #endif extern OSErr FindApplicationFromCreator(OSType, FSSpecPtr); Index: pymactoolbox.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/pymactoolbox.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** pymactoolbox.h 2001/05/17 22:11:44 1.5 --- pymactoolbox.h 2001/05/19 12:32:39 1.6 *************** *** 7,10 **** --- 7,11 ---- #endif + #ifdef WITHOUT_FRAMEWORKS #include #include *************** *** 15,18 **** --- 16,23 ---- #include #include + #else + #include + #include + #endif #ifdef USE_TOOLBOX_OBJECT_GLUE From jackjansen@users.sourceforge.net Sat May 19 13:35:02 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 19 May 2001 05:35:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules icgluemodule.c,1.4,1.5 macfsmodule.c,1.35,1.36 macosmodule.c,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv32182 Modified Files: icgluemodule.c macfsmodule.c macosmodule.c Log Message: Include Carbon/Carbon.h in stead of universal headers, if appropriate. Test for TARGET_API_MAC_OS8 in stead of !TARGET_API_MAC_CARBON where appropriate. Index: icgluemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icgluemodule.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** icgluemodule.c 2001/01/29 13:27:31 1.4 --- icgluemodule.c 2001/05/19 12:34:59 1.5 *************** *** 35,39 **** extern int ResObj_Convert(PyObject *, Handle *); /* From Resmodule.c */ ! #if TARGET_API_MAC_CARBON /* The Carbon headers define PRAGMA_ALIGN_SUPPORT to something illegal, ** because you shouldn't use it for Carbon. All good and well, but portable --- 35,40 ---- extern int ResObj_Convert(PyObject *, Handle *); /* From Resmodule.c */ ! #ifdef WITHOUT_FRAMEWORKS ! #if !TARGET_API_MAC_OS8 /* The Carbon headers define PRAGMA_ALIGN_SUPPORT to something illegal, ** because you shouldn't use it for Carbon. All good and well, but portable *************** *** 42,48 **** #undef PRAGMA_ALIGN_SUPPORTED #define PRAGMA_ALIGN_SUPPORTED 0 ! #endif /* TARGET_API_MAC_CARBON */ #include "ICAPI.h" static PyObject *ErrorObject; --- 43,61 ---- #undef PRAGMA_ALIGN_SUPPORTED #define PRAGMA_ALIGN_SUPPORTED 0 ! #endif /* !TARGET_API_MAC_OS8 */ #include "ICAPI.h" + #else + #include + typedef OSStatus ICError; + /* Some fields in ICMapEntry have changed names. */ + #define file_type fileType + #define file_creator fileCreator + #define post_creator postCreator + #define creator_app_name creatorAppName + #define post_app_name postAppName + #define MIME_type MIMEType + #define entry_name entryName + #endif static PyObject *ErrorObject; *************** *** 70,74 **** /* ---------------------------------------------------------------- */ ! #if !TARGET_API_MAC_CARBON static char ici_ICFindConfigFile__doc__[] = "()->None; Find config file in standard places" --- 83,87 ---- /* ---------------------------------------------------------------- */ ! #if TARGET_API_MAC_OS8 static char ici_ICFindConfigFile__doc__[] = "()->None; Find config file in standard places" *************** *** 130,136 **** return Py_None; } - #endif /* !TARGET_API_MAC_CARBON */ - static char ici_ICChooseNewConfig__doc__[] = "()->None; Let the user choose a new config file" --- 143,147 ---- *************** *** 151,154 **** --- 162,166 ---- return Py_None; } + #endif /* TARGET_API_MAC_OS8 */ *************** *** 461,470 **** static struct PyMethodDef ici_methods[] = { ! #if !TARGET_API_MAC_CARBON {"ICFindConfigFile", (PyCFunction)ici_ICFindConfigFile, METH_VARARGS, ici_ICFindConfigFile__doc__}, {"ICFindUserConfigFile", (PyCFunction)ici_ICFindUserConfigFile, METH_VARARGS, ici_ICFindUserConfigFile__doc__}, {"ICChooseConfig", (PyCFunction)ici_ICChooseConfig, METH_VARARGS, ici_ICChooseConfig__doc__}, {"ICChooseNewConfig", (PyCFunction)ici_ICChooseNewConfig, METH_VARARGS, ici_ICChooseNewConfig__doc__}, ! #endif /* !TARGET_API_MAC_CARBON */ {"ICGetSeed", (PyCFunction)ici_ICGetSeed, METH_VARARGS, ici_ICGetSeed__doc__}, {"ICBegin", (PyCFunction)ici_ICBegin, METH_VARARGS, ici_ICBegin__doc__}, --- 473,482 ---- static struct PyMethodDef ici_methods[] = { ! #if TARGET_API_MAC_OS8 {"ICFindConfigFile", (PyCFunction)ici_ICFindConfigFile, METH_VARARGS, ici_ICFindConfigFile__doc__}, {"ICFindUserConfigFile", (PyCFunction)ici_ICFindUserConfigFile, METH_VARARGS, ici_ICFindUserConfigFile__doc__}, {"ICChooseConfig", (PyCFunction)ici_ICChooseConfig, METH_VARARGS, ici_ICChooseConfig__doc__}, {"ICChooseNewConfig", (PyCFunction)ici_ICChooseNewConfig, METH_VARARGS, ici_ICChooseNewConfig__doc__}, ! #endif /* TARGET_API_MAC_OS8 */ {"ICGetSeed", (PyCFunction)ici_ICGetSeed, METH_VARARGS, ici_ICGetSeed__doc__}, {"ICBegin", (PyCFunction)ici_ICBegin, METH_VARARGS, ici_ICBegin__doc__}, Index: macfsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macfsmodule.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** macfsmodule.c 2001/03/15 14:38:10 1.35 --- macfsmodule.c 2001/05/19 12:34:59 1.36 *************** *** 26,29 **** --- 26,30 ---- #include "macglue.h" + #ifdef WITHOUT_FRAMEWORKS #include #include *************** *** 32,35 **** --- 33,39 ---- #include #include + #else + #include + #endif #include "getapplbycreator.h" Index: macosmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macosmodule.c,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -r1.53 -r1.54 *** macosmodule.c 2001/05/12 21:31:34 1.53 --- macosmodule.c 2001/05/19 12:34:59 1.54 *************** *** 29,32 **** --- 29,33 ---- #include "pythonresources.h" + #ifdef WITHOUT_FRAMEWORKS #include #include *************** *** 34,37 **** --- 35,41 ---- #include #include + #else + #include + #endif static PyObject *MacOS_Error; /* Exception MacOS.Error */ *************** *** 355,358 **** --- 359,363 ---- } + #if TARGET_API_MAC_OS8 /*----------------------------------------------------------------------*/ /* STDWIN High Level Event interface */ *************** *** 361,365 **** #include - #if TARGET_API_MAC_OS8 static char accepthle_doc[] = "Get arguments of pending high-level event"; --- 366,369 ---- From jackjansen@users.sourceforge.net Sat May 19 13:50:07 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 19 May 2001 05:50:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules macosmodule.c,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv1743/Modules Modified Files: macosmodule.c Log Message: Ifdeffed a few more sections. All functionality that is relevant on MacOSX now appears to work. Index: macosmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macosmodule.c,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -r1.54 -r1.55 *** macosmodule.c 2001/05/19 12:34:59 1.54 --- macosmodule.c 2001/05/19 12:50:05 1.55 *************** *** 401,404 **** --- 401,406 ---- } #endif + + #if !TARGET_API_MAC_OSX static char schedparams_doc[] = "Set/return mainloop interrupt check flag, etc"; *************** *** 489,492 **** --- 491,495 ---- return Py_None; } + #endif /* !TARGET_API_MAC_OSX */ static char geterr_doc[] = "Convert OSErr number to string"; *************** *** 642,645 **** --- 645,649 ---- } + #if !TARGET_API_MAC_OSX static char FreeMem_doc[] = "Return the total amount of free space in the heap"; *************** *** 707,710 **** --- 711,715 ---- return Py_None; } + #endif /* !TARGET_API_MAC_OSX */ static PyMethodDef MacOS_Methods[] = { *************** *** 714,721 **** --- 719,728 ---- {"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc}, {"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc}, + #if !TARGET_API_MAC_OSX {"SchedParams", MacOS_SchedParams, 1, schedparams_doc}, {"EnableAppswitch", MacOS_EnableAppswitch, 1, appswitch_doc}, {"SetEventHandler", MacOS_SetEventHandler, 1, setevh_doc}, {"HandleEvent", MacOS_HandleEvent, 1, handleev_doc}, + #endif {"GetErrorString", MacOS_GetErrorString, 1, geterr_doc}, {"openrf", MacOS_openrf, 1, openrf_doc}, *************** *** 724,727 **** --- 731,735 ---- {"GetTicks", MacOS_GetTicks, 1, GetTicks_doc}, {"SysBeep", MacOS_SysBeep, 1, SysBeep_doc}, + #if !TARGET_API_MAC_OSX {"FreeMem", MacOS_FreeMem, 1, FreeMem_doc}, {"MaxBlock", MacOS_MaxBlock, 1, MaxBlock_doc}, *************** *** 729,732 **** --- 737,741 ---- {"KeepConsole", MacOS_KeepConsole, 1, KeepConsole_doc}, {"OutputSeen", MacOS_OutputSeen, 1, OutputSeen_doc}, + #endif {NULL, NULL} /* Sentinel */ }; *************** *** 764,773 **** Py_BuildValue("i", PyMac_AppearanceCompliant)) != 0) return; ! #if TARGET_API_MAC_CARBON ! #define PY_RUNTIMEMODEL "carbon" #elif TARGET_API_MAC_OS8 #define PY_RUNTIMEMODEL "ppc" ! #elif TARGET_API_MAC_OSX ! #define PY_RUNTIMEMODEL "macho" #else #error "None of the TARGET_API_MAC_XXX I know about is set" --- 773,782 ---- Py_BuildValue("i", PyMac_AppearanceCompliant)) != 0) return; ! #if TARGET_API_MAC_OSX ! #define PY_RUNTIMEMODEL "macho" #elif TARGET_API_MAC_OS8 #define PY_RUNTIMEMODEL "ppc" ! #elif TARGET_API_MAC_CARBON ! #define PY_RUNTIMEMODEL "carbon" #else #error "None of the TARGET_API_MAC_XXX I know about is set" From jackjansen@users.sourceforge.net Sat May 19 13:55:59 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 19 May 2001 05:55:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Python macglue.c,1.93,1.94 macgetargv.c,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv2411 Modified Files: macglue.c macgetargv.c Log Message: Moved PyMac_GetFullPath from macgetargv.c to macglue.c. It should have been there in the first place. Index: macglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macglue.c,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -r1.93 -r1.94 *** macglue.c 2001/05/19 12:31:09 1.93 --- macglue.c 2001/05/19 12:55:57 1.94 *************** *** 233,236 **** --- 233,296 ---- } + /* Given an FSSpec, return the FSSpec of the parent folder */ + + static OSErr + get_folder_parent (FSSpec * fss, FSSpec * parent) + { + CInfoPBRec rec; + short err; + + * parent = * fss; + rec.hFileInfo.ioNamePtr = parent->name; + rec.hFileInfo.ioVRefNum = parent->vRefNum; + rec.hFileInfo.ioDirID = parent->parID; + rec.hFileInfo.ioFDirIndex = -1; + rec.hFileInfo.ioFVersNum = 0; + if (err = PBGetCatInfoSync (& rec)) + return err; + parent->parID = rec.dirInfo.ioDrParID; + /* parent->name[0] = 0; */ + return 0; + } + + /* Given an FSSpec return a full, colon-separated pathname */ + + OSErr + PyMac_GetFullPath (FSSpec *fss, char *buf) + { + short err; + FSSpec fss_parent, fss_current; + char tmpbuf[1024]; + int plen; + + fss_current = *fss; + plen = fss_current.name[0]; + memcpy(buf, &fss_current.name[1], plen); + buf[plen] = 0; + /* Special case for disk names */ + if ( fss_current.parID <= 1 ) { + buf[plen++] = ':'; + buf[plen] = 0; + return 0; + } + while (fss_current.parID > 1) { + /* Get parent folder name */ + if (err = get_folder_parent(&fss_current, &fss_parent)) + return err; + fss_current = fss_parent; + /* Prepend path component just found to buf */ + plen = fss_current.name[0]; + if (strlen(buf) + plen + 1 > 1024) { + /* Oops... Not enough space (shouldn't happen) */ + *buf = 0; + return -1; + } + memcpy(tmpbuf, &fss_current.name[1], plen); + tmpbuf[plen] = ':'; + strcpy(&tmpbuf[plen+1], buf); + strcpy(buf, tmpbuf); + } + return 0; + } #ifdef USE_GUSI1 Index: macgetargv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macgetargv.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** macgetargv.c 2001/01/09 22:25:49 1.21 --- macgetargv.c 2001/05/19 12:55:57 1.22 *************** *** 109,152 **** } - /* Given an FSSpec return a full, colon-separated pathname */ - - OSErr - PyMac_GetFullPath (FSSpec *fss, char *buf) - { - short err; - FSSpec fss_parent, fss_current; - char tmpbuf[1024]; - int plen; - - fss_current = *fss; - plen = fss_current.name[0]; - memcpy(buf, &fss_current.name[1], plen); - buf[plen] = 0; - /* Special case for disk names */ - if ( fss_current.parID <= 1 ) { - buf[plen++] = ':'; - buf[plen] = 0; - return 0; - } - while (fss_current.parID > 1) { - /* Get parent folder name */ - if (err = get_folder_parent(&fss_current, &fss_parent)) - return err; - fss_current = fss_parent; - /* Prepend path component just found to buf */ - plen = fss_current.name[0]; - if (strlen(buf) + plen + 1 > 1024) { - /* Oops... Not enough space (shouldn't happen) */ - *buf = 0; - return -1; - } - memcpy(tmpbuf, &fss_current.name[1], plen); - tmpbuf[plen] = ':'; - strcpy(&tmpbuf[plen+1], buf); - strcpy(buf, tmpbuf); - } - return 0; - } - /* Check that there aren't any args remaining in the event */ --- 109,112 ---- From jackjansen@users.sourceforge.net Sat May 19 13:57:24 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 19 May 2001 05:57:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Python getapplbycreator.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv2656 Modified Files: getapplbycreator.c Log Message: Another include Carbon/Carbon.h Index: getapplbycreator.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/getapplbycreator.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** getapplbycreator.c 1997/01/31 16:14:39 1.2 --- getapplbycreator.c 2001/05/19 12:57:22 1.3 *************** *** 42,48 **** --- 42,52 ---- */ + #ifdef WITHOUT_FRAMEWORKS #include #include #include + #else + #include + #endif #include "getapplbycreator.h" From jackjansen@users.sourceforge.net Sat May 19 14:59:07 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 19 May 2001 06:59:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/bgen/bgen bgenGenerator.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv11281/Python/Tools/bgen/bgen Modified Files: bgenGenerator.py Log Message: Generate prototype-style function headers in stead of K&R style. Makes life easier with gcc -Wstrict-function-prototypes. Index: bgenGenerator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenGenerator.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** bgenGenerator.py 2000/12/12 22:24:35 1.8 --- bgenGenerator.py 2001/05/19 13:59:05 1.9 *************** *** 38,47 **** def functionheader(self): Output() ! Output("static PyObject *%s_%s(_self, _args)", ! self.prefix, self.name) ! IndentLevel() ! Output("%s *_self;", self.objecttype) ! Output("PyObject *_args;") ! DedentLevel() OutLbrace() Output("PyObject *_res = NULL;") --- 38,43 ---- def functionheader(self): Output() ! Output("static PyObject *%s_%s(%s *_self, PyObject *_args)", ! self.prefix, self.name, self.objecttype) OutLbrace() Output("PyObject *_res = NULL;") From jackjansen@users.sourceforge.net Sat May 19 14:59:13 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 19 May 2001 06:59:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/bgen/bgen bgenModule.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv11301/Python/Tools/bgen/bgen Modified Files: bgenModule.py Log Message: Generate prototype-style function headers in stead of K&R style. Makes life easier with gcc -Wstrict-function-prototypes. Index: bgenModule.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenModule.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** bgenModule.py 2000/12/12 22:22:59 1.7 --- bgenModule.py 2001/05/19 13:59:11 1.8 *************** *** 39,43 **** Output() ! Output("void init%s()", self.name) OutLbrace() Output("PyObject *m;") --- 39,43 ---- Output() ! Output("void init%s(void)", self.name) OutLbrace() Output("PyObject *m;") From jackjansen@users.sourceforge.net Sat May 19 14:59:20 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 19 May 2001 06:59:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/bgen/bgen bgenObjectDefinition.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen In directory usw-pr-cvs1:/tmp/cvs-serv11331/Python/Tools/bgen/bgen Modified Files: bgenObjectDefinition.py Log Message: Generate prototype-style function headers in stead of K&R style. Makes life easier with gcc -Wstrict-function-prototypes. Index: bgenObjectDefinition.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/bgenObjectDefinition.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** bgenObjectDefinition.py 2000/12/12 22:24:35 1.9 --- bgenObjectDefinition.py 2001/05/19 13:59:18 1.10 *************** *** 81,88 **** def outputNew(self): Output() ! Output("%sPyObject *%s_New(itself)", self.static, self.prefix) ! IndentLevel() ! Output("%s %sitself;", self.itselftype, self.argref) ! DedentLevel() OutLbrace() Output("%s *it;", self.objecttype) --- 81,86 ---- def outputNew(self): Output() ! Output("%sPyObject *%s_New(%s %sitself)", self.static, self.prefix, ! self.itselftype, self.argref) OutLbrace() Output("%s *it;", self.objecttype) *************** *** 101,109 **** def outputConvert(self): ! Output("%s%s_Convert(v, p_itself)", self.static, self.prefix) ! IndentLevel() ! Output("PyObject *v;") ! Output("%s *p_itself;", self.itselftype) ! DedentLevel() OutLbrace() self.outputCheckConvertArg() --- 99,104 ---- def outputConvert(self): ! Output("%s%s_Convert(PyObject *v, %s *p_itself)", self.static, self.prefix, ! self.itselftype) OutLbrace() self.outputCheckConvertArg() *************** *** 122,129 **** def outputDealloc(self): Output() ! Output("static void %s_dealloc(self)", self.prefix) ! IndentLevel() ! Output("%s *self;", self.objecttype) ! DedentLevel() OutLbrace() self.outputCleanupStructMembers() --- 117,121 ---- def outputDealloc(self): Output() ! Output("static void %s_dealloc(%s *self)", self.prefix, self.objecttype) OutLbrace() self.outputCleanupStructMembers() *************** *** 139,147 **** def outputGetattr(self): Output() ! Output("static PyObject *%s_getattr(self, name)", self.prefix) ! IndentLevel() ! Output("%s *self;", self.objecttype) ! Output("char *name;") ! DedentLevel() OutLbrace() self.outputGetattrBody() --- 131,135 ---- def outputGetattr(self): Output() ! Output("static PyObject *%s_getattr(%s *self, char *name)", self.prefix, self.objecttype) OutLbrace() self.outputGetattrBody() *************** *** 227,234 **** def outputCompare(self): Output() ! Output("static int %s_compare(self, other)", self.prefix) ! IndentLevel() ! Output("%s *self, *other;", self.objecttype) ! DedentLevel() OutLbrace() Output("unsigned long v, w;") --- 215,220 ---- def outputCompare(self): Output() ! Output("static int %s_compare(%s *self, %s *other)", self.prefix, self.objecttype, ! self.objecttype) OutLbrace() Output("unsigned long v, w;") *************** *** 251,258 **** def outputHash(self): Output() ! Output("static long %s_hash(self)", self.prefix) ! IndentLevel() ! Output("%s *self;", self.objecttype) ! DedentLevel() OutLbrace() Output("return (long)self->ob_itself;") --- 237,241 ---- def outputHash(self): Output() ! Output("static long %s_hash(%s *self)", self.prefix, self.objecttype) OutLbrace() Output("return (long)self->ob_itself;") From fdrake@users.sourceforge.net Sun May 20 06:29:03 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sat, 19 May 2001 22:29:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc ACKS,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv7493 Modified Files: ACKS Log Message: Get Aahz listed correctly using his legal/professional name. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ACKS,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** ACKS 2001/02/23 19:11:45 1.16 --- ACKS 2001/05/20 05:29:01 1.17 *************** *** 16,19 **** --- 16,20 ---- + Aahz Jim Ahlstrom A. Amoroso *************** *** 101,105 **** Vladimir Marangozov Vincent Marchetti - Aahz Maruch Laura Matson Daniel May --- 102,105 ---- From fdrake@users.sourceforge.net Sun May 20 13:26:06 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sun, 20 May 2001 05:26:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libsmtplib.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv24813/lib Modified Files: libsmtplib.tex Log Message: Fix bug in smtplib example: the prompt said to end the message with ^D, but doing so raised EOFError. This makes it work as advertised and converts to string methods where reasonable. This closes SF bug #424776. Index: libsmtplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsmtplib.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** libsmtplib.tex 2000/10/03 05:56:55 1.16 --- libsmtplib.tex 2001/05/20 12:26:04 1.17 *************** *** 242,249 **** def prompt(prompt): ! return string.strip(raw_input(prompt)) fromaddr = prompt("From: ") ! toaddrs = string.split(prompt("To: ")) print "Enter message, end with ^D:" --- 242,249 ---- def prompt(prompt): ! return raw_input(prompt).strip() fromaddr = prompt("From: ") ! toaddrs = prompt("To: ").split() print "Enter message, end with ^D:" *************** *** 252,256 **** % (fromaddr, string.join(toaddrs, ", "))) while 1: ! line = raw_input() if not line: break --- 252,259 ---- % (fromaddr, string.join(toaddrs, ", "))) while 1: ! try: ! line = raw_input() ! except EOFError: ! break if not line: break From fdrake@users.sourceforge.net Sun May 20 14:35:48 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sun, 20 May 2001 06:35:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libsmtplib.tex,1.16,1.16.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv2033/lib Modified Files: Tag: release21-maint libsmtplib.tex Log Message: Fix bug in smtplib example: the prompt said to end the message with ^D, but doing so raised EOFError. This makes it work as advertised and converts to string methods where reasonable. This closes SF bug #424776. Index: libsmtplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsmtplib.tex,v retrieving revision 1.16 retrieving revision 1.16.6.1 diff -C2 -r1.16 -r1.16.6.1 *** libsmtplib.tex 2000/10/03 05:56:55 1.16 --- libsmtplib.tex 2001/05/20 13:35:45 1.16.6.1 *************** *** 242,249 **** def prompt(prompt): ! return string.strip(raw_input(prompt)) fromaddr = prompt("From: ") ! toaddrs = string.split(prompt("To: ")) print "Enter message, end with ^D:" --- 242,249 ---- def prompt(prompt): ! return raw_input(prompt).strip() fromaddr = prompt("From: ") ! toaddrs = prompt("To: ").split() print "Enter message, end with ^D:" *************** *** 252,256 **** % (fromaddr, string.join(toaddrs, ", "))) while 1: ! line = raw_input() if not line: break --- 252,259 ---- % (fromaddr, string.join(toaddrs, ", "))) while 1: ! try: ! line = raw_input() ! except EOFError: ! break if not line: break From fdrake@users.sourceforge.net Mon May 21 04:29:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Sun, 20 May 2001 20:29:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules selectmodule.c,2.50,2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv30986 Modified Files: selectmodule.c Log Message: Add :method info to the PyArg_ParseTuple() format strings for poll objects. Index: selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -r2.50 -r2.51 *** selectmodule.c 2001/03/02 06:28:17 2.50 --- selectmodule.c 2001/05/21 03:29:05 2.51 *************** *** 363,367 **** int fd, events = POLLIN | POLLPRI | POLLOUT; ! if (!PyArg_ParseTuple(args, "O|i", &o, &events)) { return NULL; } --- 363,367 ---- int fd, events = POLLIN | POLLPRI | POLLOUT; ! if (!PyArg_ParseTuple(args, "O|i:register", &o, &events)) { return NULL; } *************** *** 393,397 **** int fd; ! if (!PyArg_ParseTuple(args, "O", &o)) { return NULL; } --- 393,397 ---- int fd; ! if (!PyArg_ParseTuple(args, "O:unregister", &o)) { return NULL; } *************** *** 432,436 **** PyObject *value = NULL, *num = NULL; ! if (!PyArg_ParseTuple(args, "|O", &tout)) { return NULL; } --- 432,436 ---- PyObject *value = NULL, *num = NULL; ! if (!PyArg_ParseTuple(args, "|O:poll", &tout)) { return NULL; } From tim_one@users.sourceforge.net Mon May 21 09:07:07 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 21 May 2001 01:07:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.207,2.208 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv10771/Python Modified Files: bltinmodule.c Log Message: SF bug #425836: Reference leak in filter(). Mark Hammond claimed that the iterized filter() forgot to decref the iterator upon return. He was right! Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.207 retrieving revision 2.208 diff -C2 -r2.207 -r2.208 *** bltinmodule.c 2001/05/14 12:17:34 2.207 --- bltinmodule.c 2001/05/21 08:07:05 2.208 *************** *** 265,268 **** --- 265,269 ---- goto Fail_result_it; + Py_DECREF(it); return result; From fdrake@users.sourceforge.net Mon May 21 16:03:37 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 21 May 2001 08:03:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.121,1.122 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv23542/api Modified Files: api.tex Log Message: Typo: "that" --> "than" This closes SF bug #425320. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -r1.121 -r1.122 *** api.tex 2001/05/15 11:58:05 1.121 --- api.tex 2001/05/21 15:03:35 1.122 *************** *** 56,60 **** that automate the process to some extent. While people have embedded Python in other applications since its early existence, the process of ! embedding Python is less straightforward that writing an extension. Many API functions are useful independent of whether you're embedding --- 56,60 ---- that automate the process to some extent. While people have embedded Python in other applications since its early existence, the process of ! embedding Python is less straightforward than writing an extension. Many API functions are useful independent of whether you're embedding From fdrake@users.sourceforge.net Mon May 21 16:04:31 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 21 May 2001 08:04:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.117,1.117.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv23700/api Modified Files: Tag: release21-maint api.tex Log Message: Typo: "that" --> "than" This closes SF bug #425320. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.117 retrieving revision 1.117.2.1 diff -C2 -r1.117 -r1.117.2.1 *** api.tex 2001/04/13 17:55:02 1.117 --- api.tex 2001/05/21 15:04:28 1.117.2.1 *************** *** 56,60 **** that automate the process to some extent. While people have embedded Python in other applications since its early existence, the process of ! embedding Python is less straightforward that writing an extension. Many API functions are useful independent of whether you're embedding --- 56,60 ---- that automate the process to some extent. While people have embedded Python in other applications since its early existence, the process of ! embedding Python is less straightforward than writing an extension. Many API functions are useful independent of whether you're embedding From fdrake@users.sourceforge.net Mon May 21 16:56:57 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 21 May 2001 08:56:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.122,1.123 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv2276/api Modified Files: api.tex Log Message: Add documentation for Py_Main() and PyThreadState_GetDict(). Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -r1.122 -r1.123 *** api.tex 2001/05/21 15:03:35 1.122 --- api.tex 2001/05/21 15:56:55 1.123 *************** *** 610,613 **** --- 610,626 ---- library that the Python runtime is using. + \begin{cfuncdesc}{int}{Py_Main}{int argc, char **argv} + The main program for the standard interpreter. This is made + available for programs which embed Python. The \var{argc} and + \var{argv} parameters should be prepared exactly as those which are + passed to a C program's \cfunction{main()} function. It is + important to note that the argument list may be modified (but the + contents of the strings pointed to by the argument list are not). + The return value will be the integer passed to the + \function{sys.exit()} function, \code{1} if the interpreter exits + due to an exception, or \code{2} if the parameter list does not + represent a valid Python command line. + \end{cfuncdesc} + \begin{cfuncdesc}{int}{PyRun_AnyFile}{FILE *fp, char *filename} If \var{fp} refers to a file associated with an interactive device *************** *** 4630,4633 **** --- 4643,4654 ---- argument \var{tstate}, which may be \NULL{}. The interpreter lock must be held. + \end{cfuncdesc} + + \begin{cfuncdesc}{PyObject*}{PyThreadState_GetDict}{} + Return a dictionary in which extensions can store thread-specific + state information. Each extension should use a unique key to use to + store state in the dictionary. If this function returns \NULL, an + exception has been raised and the caller should allow it to + propogate. \end{cfuncdesc} From fdrake@users.sourceforge.net Mon May 21 16:58:57 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 21 May 2001 08:58:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.117.2.1,1.117.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv2803/api Modified Files: Tag: release21-maint api.tex Log Message: Add documentation for Py_Main() and PyThreadState_GetDict(). Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.117.2.1 retrieving revision 1.117.2.2 diff -C2 -r1.117.2.1 -r1.117.2.2 *** api.tex 2001/05/21 15:04:28 1.117.2.1 --- api.tex 2001/05/21 15:58:54 1.117.2.2 *************** *** 610,613 **** --- 610,626 ---- library that the Python runtime is using. + \begin{cfuncdesc}{int}{Py_Main}{int argc, char **argv} + The main program for the standard interpreter. This is made + available for programs which embed Python. The \var{argc} and + \var{argv} parameters should be prepared exactly as those which are + passed to a C program's \cfunction{main()} function. It is + important to note that the argument list may be modified (but the + contents of the strings pointed to by the argument list are not). + The return value will be the integer passed to the + \function{sys.exit()} function, \code{1} if the interpreter exits + due to an exception, or \code{2} if the parameter list does not + represent a valid Python command line. + \end{cfuncdesc} + \begin{cfuncdesc}{int}{PyRun_AnyFile}{FILE *fp, char *filename} If \var{fp} refers to a file associated with an interactive device *************** *** 4574,4577 **** --- 4587,4598 ---- argument \var{tstate}, which may be \NULL{}. The interpreter lock must be held. + \end{cfuncdesc} + + \begin{cfuncdesc}{PyObject*}{PyThreadState_GetDict}{} + Return a dictionary in which extensions can store thread-specific + state information. Each extension should use a unique key to use to + store state in the dictionary. If this function returns \NULL, an + exception has been raised and the caller should allow it to + propogate. \end{cfuncdesc} From fdrake@users.sourceforge.net Mon May 21 17:55:42 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 21 May 2001 09:55:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.134,1.135 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv22716/tut Modified Files: tut.tex Log Message: Update output to reflect additional precision produced by the repr() of floating point numbers in an interactive example. Added comment to help explain control flow in the example code showing how to check if a number is prime. This closes SF bugs 419434 and 424552. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.134 retrieving revision 1.135 diff -C2 -r1.134 -r1.135 *** tut.tex 2001/04/25 21:03:20 1.134 --- tut.tex 2001/05/21 16:55:39 1.135 *************** *** 1167,1170 **** --- 1167,1171 ---- ... break ... else: + ... # loop fell through without finding a factor ... print n, 'is a prime number' ... *************** *** 2610,2617 **** \begin{verbatim} >>> x = 10 * 3.14 ! >>> y = 200*200 >>> s = 'The value of x is ' + `x` + ', and y is ' + `y` + '...' >>> print s ! The value of x is 31.4, and y is 40000... >>> # Reverse quotes work on other types besides numbers: ... p = [x, y] --- 2611,2618 ---- \begin{verbatim} >>> x = 10 * 3.14 ! >>> y = 200 * 200 >>> s = 'The value of x is ' + `x` + ', and y is ' + `y` + '...' >>> print s ! The value of x is 31.400000000000002, and y is 40000... >>> # Reverse quotes work on other types besides numbers: ... p = [x, y] From fdrake@users.sourceforge.net Mon May 21 18:03:00 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 21 May 2001 10:03:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.133.2.1,1.133.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv24303/tut Modified Files: Tag: release21-maint tut.tex Log Message: Update output to reflect additional precision produced by the repr() of floating point numbers in an interactive example. This closes SF bug #419434. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.133.2.1 retrieving revision 1.133.2.2 diff -C2 -r1.133.2.1 -r1.133.2.2 *** tut.tex 2001/04/25 20:59:47 1.133.2.1 --- tut.tex 2001/05/21 17:02:57 1.133.2.2 *************** *** 2610,2617 **** \begin{verbatim} >>> x = 10 * 3.14 ! >>> y = 200*200 >>> s = 'The value of x is ' + `x` + ', and y is ' + `y` + '...' >>> print s ! The value of x is 31.4, and y is 40000... >>> # Reverse quotes work on other types besides numbers: ... p = [x, y] --- 2610,2617 ---- \begin{verbatim} >>> x = 10 * 3.14 ! >>> y = 200 * 200 >>> s = 'The value of x is ' + `x` + ', and y is ' + `y` + '...' >>> print s ! The value of x is 31.400000000000002, and y is 40000... >>> # Reverse quotes work on other types besides numbers: ... p = [x, y] From guido@digicool.com Mon May 21 19:05:03 2001 From: guido@digicool.com (Guido van Rossum) Date: Mon, 21 May 2001 14:05:03 -0400 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.133.2.1,1.133.2.2 In-Reply-To: Your message of "Mon, 21 May 2001 10:03:00 PDT." References: Message-ID: <200105211805.f4LI54T20962@odiug.digicool.com> > *************** > *** 2610,2617 **** > \begin{verbatim} > >>> x = 10 * 3.14 > ! >>> y = 200*200 > >>> s = 'The value of x is ' + `x` + ', and y is ' + `y` + '...' > >>> print s > ! The value of x is 31.4, and y is 40000... > >>> # Reverse quotes work on other types besides numbers: > ... p = [x, y] > --- 2610,2617 ---- > \begin{verbatim} > >>> x = 10 * 3.14 > ! >>> y = 200 * 200 > >>> s = 'The value of x is ' + `x` + ', and y is ' + `y` + '...' > >>> print s > ! The value of x is 31.400000000000002, and y is 40000... > >>> # Reverse quotes work on other types besides numbers: > ... p = [x, y] Hmm... The tutorial now contains at least one example of floating point imprecision. Does it also contain text to explain this? (I'm sure Tim would be happy to provide some if there isn't any. :-) --Guido van Rossum (home page: http://www.python.org/~guido/) From fdrake@acm.org Mon May 21 19:16:50 2001 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Mon, 21 May 2001 14:16:50 -0400 (EDT) Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.133.2.1,1.133.2.2 In-Reply-To: <200105211805.f4LI54T20962@odiug.digicool.com> References: <200105211805.f4LI54T20962@odiug.digicool.com> Message-ID: <15113.23442.619948.157603@cj42289-a.reston1.va.home.com> Guido van Rossum writes: > Hmm... The tutorial now contains at least one example of floating > point imprecision. Does it also contain text to explain this? (I'm > sure Tim would be happy to provide some if there isn't any. :-) It contains others, and I don't think there's an explanation. Some text from Tim to explain this would be greatly apprectiated! -Fred -- Fred L. Drake, Jr. PythonLabs at Digital Creations From bwarsaw@users.sourceforge.net Mon May 21 20:35:22 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 21 May 2001 12:35:22 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/i18n pygettext.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/i18n In directory usw-pr-cvs1:/tmp/cvs-serv26089 Modified Files: pygettext.py Log Message: write(): A patch inspired by Tokio Kikuchi that sorts location entries first by filename and then by line number. Closes SF patch #425821. Also, fixes a problem with duplicate entries. Index: pygettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/i18n/pygettext.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** pygettext.py 2001/03/01 22:56:17 1.13 --- pygettext.py 2001/05/21 19:35:20 1.14 *************** *** 1,6 **** #! /usr/bin/env python ! # Originally written by Barry Warsaw # ! # minimally patched to make it even more xgettext compatible # by Peter Funk --- 1,6 ---- #! /usr/bin/env python ! # Originally written by Barry Warsaw # ! # Minimally patched to make it even more xgettext compatible # by Peter Funk *************** *** 314,318 **** if not msg in self.__options.toexclude: entry = (self.__curfile, lineno) ! self.__messages.setdefault(msg, []).append(entry) def set_filename(self, filename): --- 314,318 ---- if not msg in self.__options.toexclude: entry = (self.__curfile, lineno) ! self.__messages.setdefault(msg, {})[entry] = 1 def set_filename(self, filename): *************** *** 326,329 **** --- 326,334 ---- print >> fp, pot_header % {'time': timestamp, 'version': __version__} for k, v in self.__messages.items(): + # k is the message string, v is a dictionary-set of (filename, + # lineno) tuples. We want to sort the entries in v first by file + # name and then by line number. + v = v.keys() + v.sort() if not options.writelocations: pass *************** *** 445,450 **** fp.close() except IOError: ! sys.stderr.write(_("Can't read --exclude-file: %s") % ! options.excludefilename) sys.exit(1) else: --- 450,455 ---- fp.close() except IOError: ! print >> sys.stderr, _( ! "Can't read --exclude-file: %s") % options.excludefilename sys.exit(1) else: *************** *** 469,474 **** tokenize.tokenize(fp.readline, eater) except tokenize.TokenError, e: ! sys.stderr.write('%s: %s, line %d, column %d\n' % ! (e[0], filename, e[1][0], e[1][1])) finally: if closep: --- 474,479 ---- tokenize.tokenize(fp.readline, eater) except tokenize.TokenError, e: ! print >> sys.stderr, '%s: %s, line %d, column %d' % ( ! e[0], filename, e[1][0], e[1][1]) finally: if closep: From bwarsaw@users.sourceforge.net Mon May 21 20:51:28 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 21 May 2001 12:51:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/i18n pygettext.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/i18n In directory usw-pr-cvs1:/tmp/cvs-serv29889 Modified Files: pygettext.py Log Message: __addentry(): add optional keyword arg `isdocstring' which is a flag indicating whether the entry was extracted from a docstring or not. write(): If any of the locations of a string appearance came from a docstring, add a comment such as #. docstring before the references (after a suggestion by Martin von Loewis). Index: pygettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/i18n/pygettext.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** pygettext.py 2001/05/21 19:35:20 1.14 --- pygettext.py 2001/05/21 19:51:26 1.15 *************** *** 138,141 **** --- 138,142 ---- import getopt import tokenize + import operator # for selftesting *************** *** 261,265 **** if self.__freshmodule: if ttype == tokenize.STRING: ! self.__addentry(safe_eval(tstring), lineno) self.__freshmodule = 0 elif ttype not in (tokenize.COMMENT, tokenize.NL): --- 262,266 ---- if self.__freshmodule: if ttype == tokenize.STRING: ! self.__addentry(safe_eval(tstring), lineno, isdocstring=1) self.__freshmodule = 0 elif ttype not in (tokenize.COMMENT, tokenize.NL): *************** *** 281,285 **** # ignore any intervening noise if ttype == tokenize.STRING: ! self.__addentry(safe_eval(tstring), lineno) self.__state = self.__waiting elif ttype not in (tokenize.NEWLINE, tokenize.INDENT, --- 282,286 ---- # ignore any intervening noise if ttype == tokenize.STRING: ! self.__addentry(safe_eval(tstring), lineno, isdocstring=1) self.__state = self.__waiting elif ttype not in (tokenize.NEWLINE, tokenize.INDENT, *************** *** 309,318 **** # TBD: should we warn if we seen anything else? ! def __addentry(self, msg, lineno=None): if lineno is None: lineno = self.__lineno if not msg in self.__options.toexclude: entry = (self.__curfile, lineno) ! self.__messages.setdefault(msg, {})[entry] = 1 def set_filename(self, filename): --- 310,319 ---- # TBD: should we warn if we seen anything else? ! def __addentry(self, msg, lineno=None, isdocstring=0): if lineno is None: lineno = self.__lineno if not msg in self.__options.toexclude: entry = (self.__curfile, lineno) ! self.__messages.setdefault(msg, {})[entry] = isdocstring def set_filename(self, filename): *************** *** 326,329 **** --- 327,335 ---- print >> fp, pot_header % {'time': timestamp, 'version': __version__} for k, v in self.__messages.items(): + # If the entry was gleaned out of a docstring, then add a comment + # stating so. This is to aid translators who may wish to skip + # translating some unimportant docstrings. + if reduce(operator.__add__, v.values()): + print >> fp, '#. docstring' # k is the message string, v is a dictionary-set of (filename, # lineno) tuples. We want to sort the entries in v first by file From bwarsaw@users.sourceforge.net Mon May 21 20:58:25 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Mon, 21 May 2001 12:58:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/i18n pygettext.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/i18n In directory usw-pr-cvs1:/tmp/cvs-serv31413 Modified Files: pygettext.py Log Message: main(): default-domain argument to getopt.getopt() was missing a = to indicate it took an argument. This closes SF patch #402223 by Bastian Kleineidam. Index: pygettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/i18n/pygettext.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** pygettext.py 2001/05/21 19:51:26 1.15 --- pygettext.py 2001/05/21 19:58:23 1.16 *************** *** 370,374 **** sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:', ! ['extract-all', 'default-domain', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', --- 370,374 ---- sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:', ! ['extract-all', 'default-domain=', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', From gvanrossum@users.sourceforge.net Mon May 21 21:17:19 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 21 May 2001 13:17:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib sgmllib.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv4001 Modified Files: sgmllib.py Log Message: parse_declaration(): be more lenient in what we accept. We now basically accept where the dots can be single- or double-quoted strings or any other character except >. Background: I found a real-life example that failed to parse with the old assumption: http://www.opensource.org/licenses/jabberpl.html contains a few constructs of the form .... Index: sgmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/sgmllib.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** sgmllib.py 2001/04/15 13:01:41 1.30 --- sgmllib.py 2001/05/21 20:17:17 1.31 *************** *** 40,44 **** r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:;+*%?!&$\(\)_#=~]*))?') ! declname = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\s*') declstringlit = re.compile(r'(\'[^\']*\'|"[^"]*")\s*') --- 40,44 ---- r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./:;+*%?!&$\(\)_#=~]*))?') ! decldata = re.compile(r'[^>\'\"]+') declstringlit = re.compile(r'(\'[^\']*\'|"[^"]*")\s*') *************** *** 213,218 **** rawdata = self.rawdata j = i + 2 ! # in practice, this should look like: ((name|stringlit) S*)+ '>' ! while 1: c = rawdata[j:j+1] if c == ">": --- 213,218 ---- rawdata = self.rawdata j = i + 2 ! n = len(rawdata) ! while j < n: c = rawdata[j:j+1] if c == ">": *************** *** 226,242 **** return -1 j = m.end() ! elif c in "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ": ! m = declname.match(rawdata, j) if not m: # incomplete or an error? return -1 j = m.end() ! elif i == len(rawdata): ! # end of buffer between tokens ! return -1 ! else: ! raise SGMLParseError( ! "unexpected char in declaration: %s" % `rawdata[i]`) ! assert 0, "can't get here!" # Internal -- parse processing instr, return length or -1 if not terminated --- 226,237 ---- return -1 j = m.end() ! else: ! m = decldata.match(rawdata, j) if not m: # incomplete or an error? return -1 j = m.end() ! # end of buffer between tokens ! return -1 # Internal -- parse processing instr, return length or -1 if not terminated From fdrake@users.sourceforge.net Mon May 21 21:23:23 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 21 May 2001 13:23:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mailbox.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5222 Modified Files: test_mailbox.py Log Message: Re-write the mailbox test suite to use PyUnit. Cover a lot more ground for the Maildir mailbox format. This still does not address other mailbox formats. Index: test_mailbox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mailbox.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_mailbox.py 2001/04/10 15:01:20 1.3 --- test_mailbox.py 2001/05/21 20:23:21 1.4 *************** *** 2,7 **** import os import test_support ! # cleanup try: os.unlink(test_support.TESTFN) --- 2,9 ---- import os import test_support + import time + import unittest ! # cleanup earlier tests try: os.unlink(test_support.TESTFN) *************** *** 9,34 **** pass - # create a new maildir mailbox to work with: - curdir = os.path.join(test_support.TESTFN, "cur") - newdir = os.path.join(test_support.TESTFN, "new") - try: - os.mkdir(test_support.TESTFN) - os.mkdir(curdir) - os.mkdir(newdir) - - # Test for regression on bug #117490: - # http://sourceforge.net/bugs/?func=detailbug&bug_id=117490&group_id=5470 - # Make sure the boxes attribute actually gets set. - mbox = mailbox.Maildir(test_support.TESTFN) - mbox.boxes - print "newly created maildir contains", len(mbox.boxes), "messages" # XXX We still need more tests! ! finally: ! try: os.rmdir(newdir) ! except os.error: pass ! try: os.rmdir(curdir) ! except os.error: pass ! try: os.rmdir(test_support.TESTFN) ! except os.error: pass --- 11,94 ---- pass + DUMMY_MESSAGE = """\ + From: some.body@dummy.domain + To: me@my.domain + + This is a dummy message. + """ + + + class MaildirTestCase(unittest.TestCase): + + def setUp(self): + # create a new maildir mailbox to work with: + self._dir = test_support.TESTFN + os.mkdir(self._dir) + os.mkdir(os.path.join(self._dir, "cur")) + os.mkdir(os.path.join(self._dir, "tmp")) + os.mkdir(os.path.join(self._dir, "new")) + self._counter = 1 + self._msgfiles = [] + + def tearDown(self): + map(os.unlink, self._msgfiles) + os.rmdir(os.path.join(self._dir, "cur")) + os.rmdir(os.path.join(self._dir, "tmp")) + os.rmdir(os.path.join(self._dir, "new")) + os.rmdir(self._dir) + + def createMessage(self, dir): + t = int(time.time()) + pid = self._counter + self._counter += 1 + filename = "%s.%s.myhostname.mydomain" % (t, pid) + tmpname = os.path.join(self._dir, "tmp", filename) + newname = os.path.join(self._dir, dir, filename) + fp = open(tmpname, "w") + self._msgfiles.append(tmpname) + fp.write(DUMMY_MESSAGE) + fp.close() + os.link(tmpname, newname) + self._msgfiles.append(newname) + + def test_empty_maildir(self): + """Test an empty maildir mailbox""" + # Test for regression on bug #117490: + # Make sure the boxes attribute actually gets set. + self.mbox = mailbox.Maildir(test_support.TESTFN) + self.assert_(hasattr(self.mbox, "boxes")) + self.assert_(len(self.mbox.boxes) == 0) + self.assert_(self.mbox.next() is None) + self.assert_(self.mbox.next() is None) + + def test_nonempty_maildir_cur(self): + self.createMessage("cur") + self.mbox = mailbox.Maildir(test_support.TESTFN) + self.assert_(len(self.mbox.boxes) == 1) + self.assert_(self.mbox.next() is not None) + self.assert_(self.mbox.next() is None) + self.assert_(self.mbox.next() is None) + + def test_nonempty_maildir_new(self): + self.createMessage("new") + self.mbox = mailbox.Maildir(test_support.TESTFN) + self.assert_(len(self.mbox.boxes) == 1) + self.assert_(self.mbox.next() is not None) + self.assert_(self.mbox.next() is None) + self.assert_(self.mbox.next() is None) + + def test_nonempty_maildir_both(self): + self.createMessage("cur") + self.createMessage("new") + self.mbox = mailbox.Maildir(test_support.TESTFN) + self.assert_(len(self.mbox.boxes) == 2) + self.assert_(self.mbox.next() is not None) + self.assert_(self.mbox.next() is not None) + self.assert_(self.mbox.next() is None) + self.assert_(self.mbox.next() is None) + # XXX We still need more tests! + ! test_support.run_unittest(MaildirTestCase) From fdrake@users.sourceforge.net Mon May 21 21:23:23 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 21 May 2001 13:23:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_mailbox,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv5222/output Modified Files: test_mailbox Log Message: Re-write the mailbox test suite to use PyUnit. Cover a lot more ground for the Maildir mailbox format. This still does not address other mailbox formats. Index: test_mailbox =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_mailbox,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_mailbox 2000/10/23 13:39:15 1.1 --- test_mailbox 2001/05/21 20:23:21 1.2 *************** *** 1,2 **** test_mailbox - newly created maildir contains 0 messages --- 1 ---- From akuchling@users.sourceforge.net Mon May 21 21:29:30 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Mon, 21 May 2001 13:29:30 -0700 Subject: [Python-checkins] CVS: python/dist/src setup.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv6451 Modified Files: setup.py Log Message: Fix bug #232619: fix misleading warning on installing to lib-dynload Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -r1.38 -r1.39 *** setup.py 2001/04/15 15:16:12 1.38 --- setup.py 2001/05/21 20:29:27 1.39 *************** *** 13,16 **** --- 13,17 ---- from distutils.core import Extension, setup from distutils.command.build_ext import build_ext + from distutils.command.install import install # This global variable is used to hold the list of modules to be disabled. *************** *** 599,606 **** # -lGL -lGLU -lXext -lXmu \ def main(): setup(name = 'Python standard library', version = '%d.%d' % sys.version_info[:2], ! cmdclass = {'build_ext':PyBuildExt}, # The struct module is defined here, because build_ext won't be # called unless there's at least one extension module defined. --- 600,615 ---- # -lGL -lGLU -lXext -lXmu \ + class PyBuildInstall(install): + # Suppress the warning about installation into the lib_dynload + # directory, which is not in sys.path when running Python during + # installation: + def initialize_options (self): + install.initialize_options(self) + self.warn_dir=0 + def main(): setup(name = 'Python standard library', version = '%d.%d' % sys.version_info[:2], ! cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall}, # The struct module is defined here, because build_ext won't be # called unless there's at least one extension module defined. From lemburg@users.sourceforge.net Mon May 21 21:30:17 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Mon, 21 May 2001 13:30:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include unicodeobject.h,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv5748/Include Modified Files: unicodeobject.h Log Message: This patch changes the behaviour of the UTF-16 codec family. Only the UTF-16 codec will now interpret and remove a *leading* BOM mark. Sub- sequent BOM characters are no longer interpreted and removed. UTF-16-LE and -BE pass through all BOM mark characters. These changes should get the UTF-16 codec more in line with what the Unicode FAQ recommends w/r to BOM marks. Index: unicodeobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -r2.20 -r2.21 *** unicodeobject.h 2001/04/23 14:44:21 2.20 --- unicodeobject.h 2001/05/21 20:30:15 2.21 *************** *** 460,467 **** *byteorder == 1: big endian ! and then switches according to all BOM marks it finds in the input ! data. BOM marks are not copied into the resulting Unicode string. ! After completion, *byteorder is set to the current byte order at ! the end of input data. If byteorder is NULL, the codec starts in native order mode. --- 460,468 ---- *byteorder == 1: big endian ! In native mode, the first two bytes of the stream are checked for a ! BOM mark. If found, the BOM mark is analysed, the byte order ! adjusted and the BOM skipped. In the other modes, no BOM mark ! interpretation is done. After completion, *byteorder is set to the ! current byte order at the end of input data. If byteorder is NULL, the codec starts in native order mode. From lemburg@users.sourceforge.net Mon May 21 21:30:17 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Mon, 21 May 2001 13:30:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.90,2.91 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5748/Objects Modified Files: unicodeobject.c Log Message: This patch changes the behaviour of the UTF-16 codec family. Only the UTF-16 codec will now interpret and remove a *leading* BOM mark. Sub- sequent BOM characters are no longer interpreted and removed. UTF-16-LE and -BE pass through all BOM mark characters. These changes should get the UTF-16 codec more in line with what the Unicode FAQ recommends w/r to BOM marks. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.90 retrieving revision 2.91 diff -C2 -r2.90 -r2.91 *** unicodeobject.c 2001/05/08 04:00:45 2.90 --- unicodeobject.c 2001/05/21 20:30:15 2.91 *************** *** 1002,1030 **** bo = *byteorder; ! while (q < e) { ! register Py_UNICODE ch = *q++; ! ! /* Check for BOM marks (U+FEFF) in the input and adjust ! current byte order setting accordingly. Swap input ! bytes if needed. (This assumes sizeof(Py_UNICODE) == 2 ! !) */ #ifdef BYTEORDER_IS_LITTLE_ENDIAN ! if (ch == 0xFEFF) { bo = -1; ! continue; ! } else if (ch == 0xFFFE) { bo = 1; - continue; } - if (bo == 1) - ch = (ch >> 8) | (ch << 8); #else ! if (ch == 0xFEFF) { bo = 1; ! continue; ! } else if (ch == 0xFFFE) { bo = -1; - continue; } if (bo == -1) ch = (ch >> 8) | (ch << 8); --- 1002,1038 ---- bo = *byteorder; ! /* Check for BOM marks (U+FEFF) in the input and adjust current ! byte order setting accordingly. In native mode, the leading BOM ! mark is skipped, in all other modes, it is copied to the output ! stream as-is (giving a ZWNBSP character). */ ! if (bo == 0) { #ifdef BYTEORDER_IS_LITTLE_ENDIAN ! if (*q == 0xFEFF) { ! q++; bo = -1; ! } else if (*q == 0xFFFE) { ! q++; bo = 1; } #else ! if (*q == 0xFEFF) { ! q++; bo = 1; ! } else if (*q == 0xFFFE) { ! q++; bo = -1; } + #endif + } + + while (q < e) { + register Py_UNICODE ch = *q++; + + /* Swap input bytes if needed. (This assumes + sizeof(Py_UNICODE) == 2 !) */ + #ifdef BYTEORDER_IS_LITTLE_ENDIAN + if (bo == 1) + ch = (ch >> 8) | (ch << 8); + #else if (bo == -1) ch = (ch >> 8) | (ch << 8); From akuchling@users.sourceforge.net Mon May 21 21:34:41 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Mon, 21 May 2001 13:34:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/distutils/command bdist_rpm.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory usw-pr-cvs1:/tmp/cvs-serv8020 Modified Files: bdist_rpm.py Log Message: Fix bug #418369: typo in bdist_rpm Index: bdist_rpm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** bdist_rpm.py 2000/09/30 18:27:54 1.23 --- bdist_rpm.py 2001/05/21 20:34:38 1.24 *************** *** 190,194 **** for readme in ('README', 'README.txt'): if os.path.exists(readme) and readme not in self.doc_files: ! self.doc.append(readme) self.ensure_string('release', "1") --- 190,194 ---- for readme in ('README', 'README.txt'): if os.path.exists(readme) and readme not in self.doc_files: ! self.doc_files.append(readme) self.ensure_string('release', "1") From akuchling@users.sourceforge.net Mon May 21 21:44:50 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Mon, 21 May 2001 13:44:50 -0700 Subject: [Python-checkins] CVS: python/dist/src setup.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv10672 Modified Files: setup.py Log Message: Trim out some cruft Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -r1.39 -r1.40 *** setup.py 2001/05/21 20:29:27 1.39 --- setup.py 2001/05/21 20:44:48 1.40 *************** *** 1,7 **** # Autodetecting setup.py script for building the Python extensions # - # To be fixed: - # Implement --disable-modules setting - # __version__ = "$Revision$" --- 1,4 ---- *************** *** 389,395 **** exts.append( Extension('resource', ['resource.c']) ) - # Generic dynamic loading module - #exts.append( Extension('dl', ['dlmodule.c']) ) - # Sun yellow pages. Some systems have the functions in libc. if platform not in ['cygwin']: --- 386,389 ---- From akuchling@users.sourceforge.net Mon May 21 21:48:11 2001 From: akuchling@users.sourceforge.net (A.M. Kuchling) Date: Mon, 21 May 2001 13:48:11 -0700 Subject: [Python-checkins] CVS: python/dist/src setup.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src In directory usw-pr-cvs1:/tmp/cvs-serv11510 Modified Files: setup.py Log Message: Patch #411055 from MvL: import each extension after building it, and delete ones that can't be imported due to missing symbols or other causes. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -r1.40 -r1.41 *** setup.py 2001/05/21 20:44:48 1.40 --- setup.py 2001/05/21 20:48:09 1.41 *************** *** 131,134 **** --- 131,145 ---- self.announce('WARNING: building of extension "%s" failed: %s' % (ext.name, sys.exc_info()[1])) + return + try: + __import__(ext.name) + except ImportError: + self.announce('WARNING: removing "%s" since importing it failed' % + ext.name) + assert not self.inplace + fullname = self.get_ext_fullname(ext.name) + ext_filename = os.path.join(self.build_lib, + self.get_ext_filename(fullname)) + os.remove(ext_filename) def get_platform (self): *************** *** 603,606 **** --- 614,620 ---- def main(): + # turn off warnings when deprecated modules are imported + import warnings + warnings.filterwarnings("ignore",category=DeprecationWarning) setup(name = 'Python standard library', version = '%d.%d' % sys.version_info[:2], From fdrake@users.sourceforge.net Mon May 21 22:08:14 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 21 May 2001 14:08:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test regrtest.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18703 Modified Files: regrtest.py Log Message: If the file containing expected output does not exist, assume that it contains a single line of text giving the name of the output file. This covers all tests that do not actually produce any output in the test code. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** regrtest.py 2001/04/18 01:19:27 1.33 --- regrtest.py 2001/05/21 21:08:12 1.34 *************** *** 38,41 **** --- 38,42 ---- import traceback import random + import StringIO import test_support *************** *** 285,289 **** def __init__(self, filename): ! self.fp = open(filename, 'r') self.stuffthatmatched = [] --- 286,294 ---- def __init__(self, filename): ! if os.path.exists(filename): ! self.fp = open(filename, 'r') ! else: ! self.fp = StringIO.StringIO( ! os.path.basename(filename) + "\n") self.stuffthatmatched = [] From fdrake@users.sourceforge.net Mon May 21 22:12:13 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 21 May 2001 14:12:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test___all__,1.1,NONE test___future__,1.1,NONE test_al,1.1,NONE test_array,1.1,NONE test_audioop,1.1,NONE test_binhex,1.1,NONE test_bisect,1.1,NONE test_bsddb,1.1,NONE test_bufio,1.1,NONE test_capi,1.1,NONE test_cd,1.1,NONE test_cl,1.1,NONE test_cmath,1.1,NONE test_complex,1.1,NONE test_contains,1.1,NONE test_crypt,1.2,NONE test_dbm,1.1,NONE test_dl,1.1,NONE test_dumbdbm,1.1,NONE test_errno,1.1,NONE test_fcntl,1.1,NONE test_file,1.1,NONE test_fnmatch,1.1,NONE test_fork1,1.1,NONE test_format,1.1,NONE test_funcattrs,1.1,NONE test_gc,1.2,NONE test_gdbm,1.1,NONE test_getopt,1.2,NONE test_gl,1.1,NONE test_grp,1.1,NONE test_gzip,1.1,NONE test_hash,1.1,NONE test_htmlparser,1.1,NONE test_imageop,1.1,NONE test_imgfile,1.1,NONE test_import,1.1,NONE test_inspect,1.1,NONE test_iter,1.2,NONE test_largefile,1.1,NONE test_locale,1.1,NONE test_mailbox,1.2,NONE test_mutants,1.1,NONE test_pprint,1.1,NONE test_rfc822,1.1,NONE test_select,1.2,NONE test_sre,1.12,NONE test_strftime,1.2,NONE test_struct,1.2,NONE test_sunaudiodev,1.1,NONE test_sundry,1.1,NONE test_symtable,1.1,NONE test_time,1.1,NONE test_timing,1.1,NONE test_traceback,1.1,NONE test_unpack,1.1,NONE test_urllib,1.1,NONE test_urllib2,1.1,NONE test_userdict,1.1,NONE test_userlist,1.1,NONE test_userstring,1.3,NONE test_wave,1.1,NONE test_weakref,1.3,NONE test_xmllib,1.1,NONE test_zipfile,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv20613 Removed Files: test___all__ test___future__ test_al test_array test_audioop test_binhex test_bisect test_bsddb test_bufio test_capi test_cd test_cl test_cmath test_complex test_contains test_crypt test_dbm test_dl test_dumbdbm test_errno test_fcntl test_file test_fnmatch test_fork1 test_format test_funcattrs test_gc test_gdbm test_getopt test_gl test_grp test_gzip test_hash test_htmlparser test_imageop test_imgfile test_import test_inspect test_iter test_largefile test_locale test_mailbox test_mutants test_pprint test_rfc822 test_select test_sre test_strftime test_struct test_sunaudiodev test_sundry test_symtable test_time test_timing test_traceback test_unpack test_urllib test_urllib2 test_userdict test_userlist test_userstring test_wave test_weakref test_xmllib test_zipfile Log Message: Remove all files of expected output that contain only the name of the test; there is no need to store this in a file if the actual test code does not produce any output. --- test___all__ DELETED --- --- test___future__ DELETED --- --- test_al DELETED --- --- test_array DELETED --- --- test_audioop DELETED --- --- test_binhex DELETED --- --- test_bisect DELETED --- --- test_bsddb DELETED --- --- test_bufio DELETED --- --- test_capi DELETED --- --- test_cd DELETED --- --- test_cl DELETED --- --- test_cmath DELETED --- --- test_complex DELETED --- --- test_contains DELETED --- --- test_crypt DELETED --- --- test_dbm DELETED --- --- test_dl DELETED --- --- test_dumbdbm DELETED --- --- test_errno DELETED --- --- test_fcntl DELETED --- --- test_file DELETED --- --- test_fnmatch DELETED --- --- test_fork1 DELETED --- --- test_format DELETED --- --- test_funcattrs DELETED --- --- test_gc DELETED --- --- test_gdbm DELETED --- --- test_getopt DELETED --- --- test_gl DELETED --- --- test_grp DELETED --- --- test_gzip DELETED --- --- test_hash DELETED --- --- test_htmlparser DELETED --- --- test_imageop DELETED --- --- test_imgfile DELETED --- --- test_import DELETED --- --- test_inspect DELETED --- --- test_iter DELETED --- --- test_largefile DELETED --- --- test_locale DELETED --- --- test_mailbox DELETED --- --- test_mutants DELETED --- --- test_pprint DELETED --- --- test_rfc822 DELETED --- --- test_select DELETED --- --- test_sre DELETED --- --- test_strftime DELETED --- --- test_struct DELETED --- --- test_sunaudiodev DELETED --- --- test_sundry DELETED --- --- test_symtable DELETED --- --- test_time DELETED --- --- test_timing DELETED --- --- test_traceback DELETED --- --- test_unpack DELETED --- --- test_urllib DELETED --- --- test_urllib2 DELETED --- --- test_userdict DELETED --- --- test_userlist DELETED --- --- test_userstring DELETED --- --- test_wave DELETED --- --- test_weakref DELETED --- --- test_xmllib DELETED --- --- test_zipfile DELETED --- From fdrake@users.sourceforge.net Mon May 21 22:23:03 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Mon, 21 May 2001 14:23:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libmailbox.tex,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv25067/lib Modified Files: libmailbox.tex Log Message: Add a "See also" section with useful links. More should be added giving pointers to information about the other mailbox formats; if anyone can provide the information needed, please let me know! Index: libmailbox.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmailbox.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** libmailbox.tex 2001/05/02 20:22:12 1.19 --- libmailbox.tex 2001/05/21 21:23:01 1.20 *************** *** 85,88 **** --- 85,103 ---- + \begin{seealso} + \seetitle[http://www.qmail.org/man/man5/mbox.html]{mbox - + file containing mail messages}{Description of the + traditional ``mbox'' mailbox format.} + \seetitle[http://www.qmail.org/man/man5/maildir.html]{maildir - + directory for incoming mail messages}{Description of the + ``maildir'' mailbox format.} + \seetitle[http://home.netscape.com/eng/mozilla/2.0/relnotes/demo/content-length.html]{Configuring + Netscape Mail on \UNIX: Why the Content-Length Format is + Bad}{A description of problems with relying on the + Content-Length header for messages stored in mailbox + files.} + \end{seealso} + + \subsection{Mailbox Objects \label{mailbox-objects}} From gvanrossum@users.sourceforge.net Mon May 21 22:31:52 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 21 May 2001 14:31:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.22,2.16.8.23 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv29100 Modified Files: Tag: descr-branch typeobject.c Log Message: INCREF the type object in type_call() when the type object is allocated on the heap. This removes the need for subtype_construct() (which existed *just* to INCREF self->ob_type). We still need subtype_dealloc() to do the matching DECREF, because the base type's dealloc won't do this. I don't want to require all types to INCREF the type object for each object they own, but we do need this for type objects allocated on the heap. Doing the INCREF in subtype_construct was too late, because if subtype_construct() failed, type_call() would DECREF the partially initialized object, which would invoke subtype_dealloc(), which would incorrect DECREF'ed the type object. The only safe thing to do is to INCREF the type in type_call(), which this patch does. Also correct a bug in subtype_dealloc(), which would call base->tp_dealloc, even though it intended to call f, which it had calculated as the first base->base->...->tp_dealloc found that wasn't subtype_dealloc. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.22 retrieving revision 2.16.8.23 diff -C2 -r2.16.8.22 -r2.16.8.23 *** typeobject.c 2001/05/15 16:31:35 2.16.8.22 --- typeobject.c 2001/05/21 21:31:50 2.16.8.23 *************** *** 77,80 **** --- 77,82 ---- else obj = (PyObject *)mem; + if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) + Py_INCREF(type); PyObject_INIT(obj, type); *************** *** 105,131 **** } ! /* Helpers for subtyping */ - static PyObject * - subtype_construct(PyObject *self, PyObject *args, PyObject *kwds) - { - PyObject *res; - PyTypeObject *base; - ternaryfunc f; - - if (self == NULL) { - PyErr_SetString(PyExc_TypeError, - "can't allocate subtype instances"); - return NULL; - } - base = self->ob_type->tp_base; - while ((f = base->tp_construct) == subtype_construct) - base = base->tp_base; - res = f(self, args, kwds); - if (res == self) - Py_INCREF(self->ob_type); - return res; - } - static void subtype_dealloc(PyObject *self) --- 107,112 ---- } ! /* Helper for subtyping */ static void subtype_dealloc(PyObject *self) *************** *** 135,140 **** destructor f; ! /* XXX Alternatively, we could call tp_clear to clear the object; ! but this is not guaranteed to delete all pointers, just likely. */ base = self->ob_type->tp_base; --- 116,120 ---- destructor f; ! /* This exists so we can DECREF self->ob_type */ base = self->ob_type->tp_base; *************** *** 148,154 **** *dictptr = NULL; } } - base->tp_dealloc(self); - Py_DECREF(self->ob_type); } --- 128,136 ---- *dictptr = NULL; } + } + f(self); + if (self->ob_type->tp_flags & Py_TPFLAGS_HEAPTYPE) { + Py_DECREF(self->ob_type); } } *************** *** 274,279 **** /* Override some slots with specific requirements */ - if (type->tp_construct) - type->tp_construct = subtype_construct; if (type->tp_dealloc) type->tp_dealloc = subtype_dealloc; --- 256,259 ---- From gvanrossum@users.sourceforge.net Tue May 22 03:33:10 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 21 May 2001 19:33:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.131,2.132 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv26236 Modified Files: classobject.c Log Message: init_name_op(): add (void) to the argument list to make it a valid prototype, for gcc -Wstrict-prototypes. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.131 retrieving revision 2.132 diff -C2 -r2.131 -r2.132 *** classobject.c 2001/05/11 14:48:41 2.131 --- classobject.c 2001/05/22 02:33:08 2.132 *************** *** 1656,1660 **** static int ! init_name_op() { int i; --- 1656,1660 ---- static int ! init_name_op(void) { int i; From gvanrossum@users.sourceforge.net Tue May 22 04:04:29 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 21 May 2001 20:04:29 -0700 Subject: [Python-checkins] CVS: python/nondist/peps pep-0252.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory usw-pr-cvs1:/tmp/cvs-serv30689 Modified Files: pep-0252.txt Log Message: Add implementation information. Index: pep-0252.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0252.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** pep-0252.txt 2001/04/28 16:10:39 1.6 --- pep-0252.txt 2001/05/22 03:04:27 1.7 *************** *** 394,398 **** Implementation ! XXX References --- 394,408 ---- Implementation ! A partial implementation of this PEP is available from CVS as a ! branch named "descr-branch". To experiment with this ! implementation, proceed to check out Python from CVS according to ! the instructions at http://sourceforge.net/cvs/?group_id=5470 but ! add the arguments "-r descr-branch" to the cvs checkout command. ! (You can also start with an existing checkout and do "cvs update ! -r descr-branch".) For some examples of the features described ! here, see the file Lib/test/test_descr.py. ! ! Note: the code in this branch goes beyond this PEP; it is also ! on the way to implementing PEP 253 (Subtyping Built-in Types). References From gvanrossum@users.sourceforge.net Tue May 22 05:00:19 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 21 May 2001 21:00:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.80.2.5,2.80.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5899 Modified Files: Tag: descr-branch dictobject.c Log Message: insertdict(): cope with the possibility that ma_lookup is NULL. This can happen when a derived type doesn't call dict_construct(). Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.80.2.5 retrieving revision 2.80.2.6 diff -C2 -r2.80.2.5 -r2.80.2.6 *** dictobject.c 2001/05/14 21:35:52 2.80.2.5 --- dictobject.c 2001/05/22 04:00:17 2.80.2.6 *************** *** 308,312 **** PyObject *old_value; register dictentry *ep; ! ep = (mp->ma_lookup)(mp, key, hash); if (ep->me_value != NULL) { old_value = ep->me_value; --- 308,318 ---- PyObject *old_value; register dictentry *ep; ! typedef PyDictEntry *(*lookupfunc)(PyDictObject *, PyObject *, long); ! register lookupfunc lookup; ! ! lookup = mp->ma_lookup; ! if (lookup == NULL) ! mp->ma_lookup = lookup = lookdict_string; ! ep = lookup(mp, key, hash); if (ep->me_value != NULL) { old_value = ep->me_value; From gvanrossum@users.sourceforge.net Tue May 22 05:21:10 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Mon, 21 May 2001 21:21:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.23,2.16.8.24 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8509 Modified Files: Tag: descr-branch typeobject.c Log Message: Treat tp_construct as any other slot, mapped to __init__ method. Also map tp_descr_get and tp_descr_set to __get__ and __set__ methods. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.23 retrieving revision 2.16.8.24 diff -C2 -r2.16.8.23 -r2.16.8.24 *** typeobject.c 2001/05/21 21:31:50 2.16.8.23 --- typeobject.c 2001/05/22 04:21:08 2.16.8.24 *************** *** 88,107 **** if (PyType_IS_GC(type)) PyObject_GC_Init(res); - if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { - PyObject *init, *dummy; - - init = PyObject_GetAttrString(res, "__init__"); - if (init == NULL) { - PyErr_Clear(); - return res; - } - dummy = PyObject_Call(init, args, kwds); - Py_DECREF(init); - if (dummy == NULL) { - Py_DECREF(obj); - return NULL; - } - Py_DECREF(dummy); - } return res; } --- 88,91 ---- *************** *** 1076,1079 **** --- 1060,1113 ---- }; + static struct wrapperbase tab_descr_get[] = { + {"__get__", (wrapperfunc)wrap_binaryfunc, + "descr.__get__(obj) -> value"}, + {0} + }; + + static PyObject * + wrap_descrsetfunc(PyObject *self, PyObject *args, void *wrapped) + { + descrsetfunc func = (descrsetfunc)wrapped; + PyObject *obj, *value; + int ret; + + if (!PyArg_ParseTuple(args, "OO", &obj, &value)) + return NULL; + ret = (*func)(self, obj, value); + if (ret < 0) + return NULL; + Py_INCREF(Py_None); + return Py_None; + } + + static struct wrapperbase tab_descr_set[] = { + {"__set__", (wrapperfunc)wrap_descrsetfunc, + "descr.__set__(obj, value)"}, + {0} + }; + + static PyObject * + wrap_init(PyObject *self, PyObject *args, void *wrapped) + { + ternaryfunc func = (ternaryfunc)wrapped; + PyObject *res; + + /* XXX What about keyword arguments? */ + res = (*func)(self, args, NULL); + if (res == NULL) + return NULL; + /* tp_construct doesn't return a new object; it just returns self, + un-INCREF-ed */ + Py_INCREF(Py_None); + return Py_None; + } + + static struct wrapperbase tab_init[] = { + {"__init__", (wrapperfunc)wrap_init, + "x.__init__() -> initialize object"}, + {0} + }; + static int add_operators(PyTypeObject *type) *************** *** 1160,1163 **** --- 1194,1200 ---- ADD(type->tp_iter, tab_iter); ADD(type->tp_iternext, tab_next); + ADD(type->tp_descr_get, tab_descr_get); + ADD(type->tp_descr_set, tab_descr_set); + ADD(type->tp_construct, tab_init); return 0; *************** *** 1378,1381 **** --- 1415,1447 ---- } + SLOT1(tp_descr_get, get, PyObject *, O); + + static int + slot_tp_descr_set(PyObject *self, PyObject *target, PyObject *value) + { + PyObject *res = PyObject_CallMethod(self, "__set__", + "OO", target, value); + if (res == NULL) + return -1; + Py_DECREF(res); + return 0; + } + + static PyObject * + slot_tp_construct(PyObject *self, PyObject *args, PyObject *kwds) + { + PyObject *meth = PyObject_GetAttrString(self, "__init__"); + PyObject *res; + + if (meth == NULL) + return NULL; + res = PyObject_Call(meth, args, kwds); + Py_DECREF(meth); + if (res == NULL) + return NULL; + Py_DECREF(res); + return self; + } + static void override_slots(PyTypeObject *type, PyObject *dict) *************** *** 1471,1474 **** TPSLOT(ge, tp_richcompare); TPSLOT(iter, tp_iter); ! TPSLOT(next, tp_iternext); } --- 1537,1544 ---- TPSLOT(ge, tp_richcompare); TPSLOT(iter, tp_iter); ! if (PyDict_GetItemString(dict, "next")) ! type->tp_iternext = slot_tp_iternext; ! TPSLOT(get, tp_descr_get); ! TPSLOT(set, tp_descr_set); ! TPSLOT(init, tp_construct); } From tim_one@users.sourceforge.net Tue May 22 07:54:41 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 21 May 2001 23:54:41 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex,1.135,1.136 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory usw-pr-cvs1:/tmp/cvs-serv30053/python/dist/src/Doc/tut Modified Files: tut.tex Log Message: Changed all the examples with ugly platform-dependent float output to use numbers that display nicely after repr(). From much doctest experience with the same trick, I believe people find examples with simple fractions easier to understand too: they can usually check the results in their head, and so feel confident about what they're seeing. Not even I get a warm feeling from a result that looks like 70330.345024097141 ... Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -r1.135 -r1.136 *** tut.tex 2001/05/21 16:55:39 1.135 --- tut.tex 2001/05/22 06:54:14 1.136 *************** *** 427,432 **** \begin{verbatim} ! >>> 4 * 2.5 / 3.3 ! 3.0303030303030303 >>> 7.0 / 2 3.5 --- 427,432 ---- \begin{verbatim} ! >>> 3 * 3.75 / 1.5 ! 7.5 >>> 7.0 / 2 3.5 *************** *** 470,474 **** \begin{verbatim} ! >>> a=1.5+0.5j >>> float(a) Traceback (most recent call last): --- 470,474 ---- \begin{verbatim} ! >>> a=3.0+4.0j >>> float(a) Traceback (most recent call last): *************** *** 476,482 **** TypeError: can't convert complex to float; use e.g. abs(z) >>> a.real ! 1.5 ! >>> abs(a) ! 1.5811388300841898 \end{verbatim} --- 476,485 ---- TypeError: can't convert complex to float; use e.g. abs(z) >>> a.real ! 3.0 ! >>> a.imag ! 4.0 ! >>> abs(a) # sqrt(a.real**2 + a.imag**2) ! 5.0 ! >>> \end{verbatim} *************** *** 487,498 **** \begin{verbatim} ! >>> tax = 17.5 / 100 ! >>> price = 3.50 >>> price * tax ! 0.61249999999999993 >>> price + _ ! 4.1124999999999998 >>> round(_, 2) ! 4.1100000000000003 \end{verbatim} --- 490,502 ---- \begin{verbatim} ! >>> tax = 12.5 / 100 ! >>> price = 100.50 >>> price * tax ! 12.5625 >>> price + _ ! 113.0625 >>> round(_, 2) ! 113.06 ! >>> \end{verbatim} *************** *** 2610,2623 **** \begin{verbatim} ! >>> x = 10 * 3.14 >>> y = 200 * 200 >>> s = 'The value of x is ' + `x` + ', and y is ' + `y` + '...' >>> print s ! The value of x is 31.400000000000002, and y is 40000... >>> # Reverse quotes work on other types besides numbers: ... p = [x, y] >>> ps = repr(p) >>> ps ! '[31.400000000000002, 40000]' >>> # Converting a string adds string quotes and backslashes: ... hello = 'hello, world\n' --- 2614,2627 ---- \begin{verbatim} ! >>> x = 10 * 3.25 >>> y = 200 * 200 >>> s = 'The value of x is ' + `x` + ', and y is ' + `y` + '...' >>> print s ! The value of x is 32.5, and y is 40000... >>> # Reverse quotes work on other types besides numbers: ... p = [x, y] >>> ps = repr(p) >>> ps ! '[32.5, 40000]' >>> # Converting a string adds string quotes and backslashes: ... hello = 'hello, world\n' *************** *** 2627,2631 **** >>> # The argument of reverse quotes may be a tuple: ... `x, y, ('spam', 'eggs')` ! "(31.400000000000002, 40000, ('spam', 'eggs'))" \end{verbatim} --- 2631,2635 ---- >>> # The argument of reverse quotes may be a tuple: ... `x, y, ('spam', 'eggs')` ! "(32.5, 40000, ('spam', 'eggs'))" \end{verbatim} *************** *** 3478,3482 **** ... self.i = imagpart ... ! >>> x = Complex(3.0,-4.5) >>> x.r, x.i (3.0, -4.5) --- 3482,3486 ---- ... self.i = imagpart ... ! >>> x = Complex(3.0, -4.5) >>> x.r, x.i (3.0, -4.5) From lemburg@users.sourceforge.net Tue May 22 09:58:25 2001 From: lemburg@users.sourceforge.net (M.-A. Lemburg) Date: Tue, 22 May 2001 01:58:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.173,1.174 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv21176 Modified Files: NEWS Log Message: Added NEWS item for the UTF-16 change. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.173 retrieving revision 1.174 diff -C2 -r1.173 -r1.174 *** NEWS 2001/05/15 18:38:45 1.173 --- NEWS 2001/05/22 08:58:23 1.174 *************** *** 4,7 **** --- 4,12 ---- Core + - The UTF-16 codec was modified to be more RFC compliant. It will now + only remove BOM characters at the start of the string and then + only if running in native mode (UTF-16-LE and -BE won't remove a + leading BMO character). + - Strings now have a new method .decode() to complement the already existing .encode() method. These two methods provide direct access From tim_one@users.sourceforge.net Tue May 22 10:34:29 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 22 May 2001 02:34:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_threaded_import.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28575/python/dist/src/Lib/test Added Files: test_threaded_import.py Log Message: New test adapted from the ancient Demo/threads/bug.py. ICK ALERT: read the long comment block before run_the_test(). It was almost impossible to get this to run without instant deadlock, and the solution here sucks on several counts. If you can dream up a better way, let me know! --- NEW FILE: test_threaded_import.py --- # This is a variant of the very old (early 90's) file # Demo/threads/bug.py. It simply provokes a number of threads into # trying to import the same module "at the same time". # There are no pleasant failure modes -- most likely is that Python # complains several times about module random having no attribute # randrange, and then Python hangs. import thread critical_section = thread.allocate_lock() done = thread.allocate_lock() def task(): global N, critical_section, done import random x = random.randrange(1, 3) critical_section.acquire() N -= 1 if N == 0: done.release() critical_section.release() # Tricky, tricky, tricky. # When regrtest imports this module, the thread running regrtest grabs the # import lock and won't let go of it until this module returns. All other # threads attempting an import hang for the duration. So we have to spawn # a thread to run the test and return to regrtest.py right away, else the # test can't make progress. # # One miserable consequence: This test can't wait to make sure all the # threads complete! # # Another: If this test fails, the output may show up while running # some other test. # # Another: If you run this test directly, the OS will probably kill # all the threads right away, because the program exits immediately # after spawning a thread to run the real test. # # Another: If this test ever does fail and you attempt to run it by # itself via regrtest, the same applies: regrtest will get out so fast # the OS will kill all the threads here. def run_the_test(): global N, done done.acquire() for N in [1, 2, 3, 4, 20, 4, 3, 2]: for i in range(N): thread.start_new_thread(task, ()) done.acquire() thread.start_new_thread(run_the_test, ()) From jackjansen@users.sourceforge.net Tue May 22 15:13:04 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 07:13:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Python macimport.c,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv19738/Python/Mac/Python Modified Files: macimport.c Log Message: Fixed a nasty slowdown in imports in frozen applications: the shortcut for loading modules from the application resource fork stopped working when sys.path component normalization was implemented. Comparison of sys.path components is now done by FSSpec in stead of by pathname. Index: macimport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macimport.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** macimport.c 2001/02/21 15:48:19 1.9 --- macimport.c 2001/05/22 14:13:02 1.10 *************** *** 48,51 **** --- 48,52 ---- #endif #include + #include #ifdef USE_GUSI1 *************** *** 56,59 **** --- 57,67 ---- #define FUNCNAME_PATTERN "init%.200s" + static int + fssequal(FSSpec *fs1, FSSpec *fs2) + { + if ( fs1->vRefNum != fs2->vRefNum || fs1->parID != fs2->parID ) + return 0; + return EqualString(fs1->name, fs2->name, false, true); + } /* ** findnamedresource - Common code for the various *ResourceModule functions. *************** *** 94,99 **** } #endif /* INTERN_STRINGS */ ! ! if ( strcmp(filename, PyMac_ApplicationPath) == 0 ) { /* ** Special case: the application itself. Use a shortcut to --- 102,118 ---- } #endif /* INTERN_STRINGS */ ! #ifdef USE_GUSI1 ! if ( Path2FSSpec(filename, &fss) != noErr ) { ! #else ! if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr ) { ! #endif ! #ifdef INTERN_STRINGS ! if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) ! not_a_file[max_not_a_file++] = obj; ! #endif /* INTERN_STRINGS */ ! /* doesn't exist or is folder */ ! return 0; ! } ! if ( fssequal(&fss, &PyMac_ApplicationFSSpec) ) { /* ** Special case: the application itself. Use a shortcut to *************** *** 105,121 **** filerh = -1; } else { - #ifdef USE_GUSI1 - if ( Path2FSSpec(filename, &fss) != noErr || - #else - if ( FSMakeFSSpec(0, 0, Pstring(filename), &fss) != noErr || - #endif - FSpGetFInfo(&fss, &finfo) != noErr ) { #ifdef INTERN_STRINGS if ( obj && max_not_a_file < MAXPATHCOMPONENTS && obj->ob_sinterned ) not_a_file[max_not_a_file++] = obj; ! #endif /* INTERN_STRINGS */ ! /* doesn't exist or is folder */ return 0; } oldrh = CurResFile(); filerh = FSpOpenResFile(&fss, fsRdPerm); --- 124,135 ---- filerh = -1; } else { #ifdef INTERN_STRINGS + 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; } + #endif /* INTERN_STRINGS */ oldrh = CurResFile(); filerh = FSpOpenResFile(&fss, fsRdPerm); *************** *** 294,298 **** long num, size; ! if ( strcmp(filename, PyMac_ApplicationPath) == 0 ) { /* ** Special case: the application itself. Use a shortcut to --- 308,319 ---- long num, size; ! #ifdef USE_GUSI1 ! if ( (err=Path2FSSpec(filename, &fss)) != noErr || ! FSpGetFInfo(&fss, &finfo) != noErr ) ! #else ! if ( (err=FSMakeFSSpec(0, 0, Pstring(filename), &fss)) != noErr ) ! #endif ! goto error; ! if ( fssequal(&fss, &PyMac_ApplicationFSSpec) ) { /* ** Special case: the application itself. Use a shortcut to *************** *** 304,314 **** filerh = -1; } else { - #ifdef USE_GUSI1 - if ( (err=Path2FSSpec(filename, &fss)) != noErr || - FSpGetFInfo(&fss, &finfo) != noErr ) - #else - if ( (err=FSMakeFSSpec(0, 0, Pstring(filename), &fss)) != noErr ) - #endif - goto error; if ( (err=FSpGetFInfo(&fss, &finfo)) != noErr ) goto error; --- 325,328 ---- From fdrake@users.sourceforge.net Tue May 22 15:36:32 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 07:36:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib librfc822.tex,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv28617/lib Modified Files: librfc822.tex Log Message: Add some clarifications about the mapping interface presented by rfc822.Message objects, based on comments from Barry. Index: librfc822.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** librfc822.tex 2001/04/09 15:42:56 1.31 --- librfc822.tex 2001/05/22 14:36:30 1.32 *************** *** 212,216 **** \end{methoddesc} ! \class{Message} instances also support a read-only mapping interface. In particular: \code{\var{m}[name]} is like \code{\var{m}.getheader(name)} but raises \exception{KeyError} if --- 212,216 ---- \end{methoddesc} ! \class{Message} instances also support a limited mapping interface. In particular: \code{\var{m}[name]} is like \code{\var{m}.getheader(name)} but raises \exception{KeyError} if *************** *** 218,222 **** \code{\var{m}.has_key(name)}, \code{\var{m}.keys()}, \code{\var{m}.values()} and \code{\var{m}.items()} act as expected ! (and consistently). Finally, \class{Message} instances have two public instance variables: --- 218,224 ---- \code{\var{m}.has_key(name)}, \code{\var{m}.keys()}, \code{\var{m}.values()} and \code{\var{m}.items()} act as expected ! (and consistently). \class{Message} instances also support the ! mapping writable interface \code{\var{m}[name] = value} and \code{del ! \var{m}[name]}. Finally, \class{Message} instances have two public instance variables: From fdrake@users.sourceforge.net Tue May 22 15:37:20 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 07:37:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib librfc822.tex,1.31,1.31.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv28900/lib Modified Files: Tag: release21-maint librfc822.tex Log Message: Add some clarifications about the mapping interface presented by rfc822.Message objects, based on comments from Barry. Index: librfc822.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v retrieving revision 1.31 retrieving revision 1.31.2.1 diff -C2 -r1.31 -r1.31.2.1 *** librfc822.tex 2001/04/09 15:42:56 1.31 --- librfc822.tex 2001/05/22 14:37:18 1.31.2.1 *************** *** 212,216 **** \end{methoddesc} ! \class{Message} instances also support a read-only mapping interface. In particular: \code{\var{m}[name]} is like \code{\var{m}.getheader(name)} but raises \exception{KeyError} if --- 212,216 ---- \end{methoddesc} ! \class{Message} instances also support a limited mapping interface. In particular: \code{\var{m}[name]} is like \code{\var{m}.getheader(name)} but raises \exception{KeyError} if *************** *** 218,222 **** \code{\var{m}.has_key(name)}, \code{\var{m}.keys()}, \code{\var{m}.values()} and \code{\var{m}.items()} act as expected ! (and consistently). Finally, \class{Message} instances have two public instance variables: --- 218,224 ---- \code{\var{m}.has_key(name)}, \code{\var{m}.keys()}, \code{\var{m}.values()} and \code{\var{m}.items()} act as expected ! (and consistently). \class{Message} instances also support the ! mapping writable interface \code{\var{m}[name] = value} and \code{del ! \var{m}[name]}. Finally, \class{Message} instances have two public instance variables: From fdrake@users.sourceforge.net Tue May 22 15:58:12 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 07:58:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib rfc822.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5433 Modified Files: rfc822.py Log Message: Added .get() and .setdefault() support to rfc822.Message. Index: rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rfc822.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -r1.54 -r1.55 *** rfc822.py 2001/02/15 22:15:13 1.54 --- rfc822.py 2001/05/22 14:58:10 1.55 *************** *** 422,425 **** --- 422,445 ---- del self.headers[i] + def get(self, name, default=None): + name = name.lower() + if self.dict.has_key(name): + return self.dict[name] + else: + return default + + def setdefault(self, name, default=''): + lowername = name.lower() + if self.dict.has_key(lowername): + return self.dict[lowername] + else: + default = default or "" + self.dict[lowername] = default + text = "%s: %s" % (name, default) + lines = text.split("\n") + for line in lines: + self.headers.append(line + "\n") + return default + def has_key(self, name): """Determine whether a message contains the named header.""" From fdrake@users.sourceforge.net Tue May 22 16:02:21 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 08:02:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_rfc822.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv7266/test Modified Files: test_rfc822.py Log Message: Add tests for the new .get() and .setdefault() methods of rfc822.Message objects. Index: test_rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_rfc822.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** test_rfc822.py 2001/01/17 21:51:36 1.9 --- test_rfc822.py 2001/05/22 15:02:19 1.10 *************** *** 1,3 **** ! from test_support import verbose import rfc822, sys try: --- 1,3 ---- ! from test_support import verbose, verify import rfc822, sys try: *************** *** 125,126 **** --- 125,144 ---- foo''', [('', 'guido@[132.151.1.21]')]) + + + msg = rfc822.Message(StringIO('''To: "last, first" + + test + ''')) + verify(msg.get("to") == '"last, first" ') + verify(msg.get("TO") == '"last, first" ') + verify(msg.get("No-Such-Header") is None) + verify(msg.get("No-Such-Header", "No-Such-Value") == "No-Such-Value") + + verify(not msg.has_key("New-Header")) + verify(msg.setdefault("New-Header", "New-Value") == "New-Value") + verify(msg.setdefault("New-Header", "Different-Value") == "New-Value") + verify(msg["new-header"] == "New-Value") + + verify(msg.setdefault("Another-Header") == "") + verify(msg["another-header"] == "") From fdrake@users.sourceforge.net Tue May 22 16:12:48 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 08:12:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib librfc822.tex,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv11972/lib Modified Files: librfc822.tex Log Message: Update to add get() and setdefault() as supported mapping operations, and add a list of the mapping methods which are not supported (per Barry's comments). Index: librfc822.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** librfc822.tex 2001/05/22 14:36:30 1.32 --- librfc822.tex 2001/05/22 15:12:46 1.33 *************** *** 216,224 **** \code{\var{m}.getheader(name)} but raises \exception{KeyError} if there is no matching header; and \code{len(\var{m})}, \code{\var{m}.has_key(name)}, \code{\var{m}.keys()}, ! \code{\var{m}.values()} and \code{\var{m}.items()} act as expected (and consistently). \class{Message} instances also support the mapping writable interface \code{\var{m}[name] = value} and \code{del ! \var{m}[name]}. Finally, \class{Message} instances have two public instance variables: --- 216,230 ---- \code{\var{m}.getheader(name)} but raises \exception{KeyError} if there is no matching header; and \code{len(\var{m})}, + \code{\var{m}.get(name\optional{, deafult})}, \code{\var{m}.has_key(name)}, \code{\var{m}.keys()}, ! \code{\var{m}.values()} \code{\var{m}.items()}, and ! \code{\var{m}.setdefault(name\optional{, default})} act as expected (and consistently). \class{Message} instances also support the mapping writable interface \code{\var{m}[name] = value} and \code{del ! \var{m}[name]}. \class{Message} objects do not support the ! \method{clear()}, \method{copy()}, \method{popitem()}, or ! \method{update()} methods of the mapping interface. (Support for ! \method{.get()} and \method{.setdefault()} was only added in Python ! 2.2.) Finally, \class{Message} instances have two public instance variables: From fdrake@users.sourceforge.net Tue May 22 16:17:14 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 08:17:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib librfc822.tex,1.31.2.1,1.31.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv13866/lib Modified Files: Tag: release21-maint librfc822.tex Log Message: Add a list of mapping interface methods which are not supported by rfc822.Message (per Barry's comments). Index: librfc822.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v retrieving revision 1.31.2.1 retrieving revision 1.31.2.2 diff -C2 -r1.31.2.1 -r1.31.2.2 *** librfc822.tex 2001/05/22 14:37:18 1.31.2.1 --- librfc822.tex 2001/05/22 15:17:12 1.31.2.2 *************** *** 220,224 **** (and consistently). \class{Message} instances also support the mapping writable interface \code{\var{m}[name] = value} and \code{del ! \var{m}[name]}. Finally, \class{Message} instances have two public instance variables: --- 220,227 ---- (and consistently). \class{Message} instances also support the mapping writable interface \code{\var{m}[name] = value} and \code{del ! \var{m}[name]}. \class{Message} objects do not support the ! \method{clear()}, \method{copy()}, \method{get()}, \method{popitem()}, ! \method{setdefault()}, or \method{update()} methods of the mapping ! interface. Finally, \class{Message} instances have two public instance variables: From fdrake@users.sourceforge.net Tue May 22 16:44:17 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 08:44:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.28,2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv24795/Modules Modified Files: termios.c Log Message: Correct the sense of a couple of conditional compilations -- used #ifndef when #ifdef was needed. This closes (reallu!) SF bug #417418. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -r2.28 -r2.29 *** termios.c 2001/05/11 16:14:17 2.28 --- termios.c 2001/05/22 15:44:15 2.29 *************** *** 537,544 **** {"VSUSP", VSUSP}, {"VEOL", VEOL}, ! #ifndef VREPRINT {"VREPRINT", VREPRINT}, #endif ! #ifndef VDISCARD {"VDISCARD", VDISCARD}, #endif --- 537,544 ---- {"VSUSP", VSUSP}, {"VEOL", VEOL}, ! #ifdef VREPRINT {"VREPRINT", VREPRINT}, #endif ! #ifdef VDISCARD {"VDISCARD", VDISCARD}, #endif From bwarsaw@users.sourceforge.net Tue May 22 16:58:32 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 22 May 2001 08:58:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib calendar.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv28926 Modified Files: calendar.py Log Message: Application of patch #401842 by Denis S. Otkidach to support localization of month and day names. Index: calendar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/calendar.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** calendar.py 2001/01/20 19:54:20 1.21 --- calendar.py 2001/05/22 15:58:30 1.22 *************** *** 9,13 **** # Import functions and variables from time module ! from time import localtime, mktime __all__ = ["error","setfirstweekday","firstweekday","isleap", --- 9,13 ---- # Import functions and variables from time module ! from time import localtime, mktime, strftime __all__ = ["error","setfirstweekday","firstweekday","isleap", *************** *** 25,39 **** mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # Full and abbreviated names of weekdays ! day_name = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', ! 'Friday', 'Saturday', 'Sunday'] ! day_abbr = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] # Full and abbreviated names of months (1-based arrays!!!) ! month_name = ['', 'January', 'February', 'March', 'April', ! 'May', 'June', 'July', 'August', ! 'September', 'October', 'November', 'December'] ! month_abbr = [' ', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', ! 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] # Constants for weekdays --- 25,41 ---- mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + class _localized_name: + def __init__(self, format): + self.format = format + def __getitem__(self, item): + return strftime(self.format, (item,)*9).capitalize() + # Full and abbreviated names of weekdays ! day_name = _localized_name('%A') ! day_abbr = _localized_name('%a') # Full and abbreviated names of months (1-based arrays!!!) ! month_name = _localized_name('%B') ! month_abbr = _localized_name('%b') # Constants for weekdays From bwarsaw@users.sourceforge.net Tue May 22 17:00:13 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Tue, 22 May 2001 09:00:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.174,1.175 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv29216 Modified Files: NEWS Log Message: - calendar.py uses month and day names based on the current locale. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.174 retrieving revision 1.175 diff -C2 -r1.174 -r1.175 *** NEWS 2001/05/22 08:58:23 1.174 --- NEWS 2001/05/22 16:00:10 1.175 *************** *** 118,121 **** --- 118,123 ---- Library + - calendar.py uses month and day names based on the current locale. + - strop is now *really* obsolete (this was announced before with 1.6), and issues DeprecationWarning when used (except for the four items From guido@digicool.com Tue May 22 17:04:41 2001 From: guido@digicool.com (Guido van Rossum) Date: Tue, 22 May 2001 12:04:41 -0400 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_threaded_import.py,NONE,1.1 In-Reply-To: Your message of "Tue, 22 May 2001 02:34:29 PDT." References: Message-ID: <200105221604.f4MG4fw01972@odiug.digicool.com> > ICK ALERT: read the long comment block before run_the_test(). It was > almost impossible to get this to run without instant deadlock, and the > solution here sucks on several counts. If you can dream up a better way, > let me know! > # Tricky, tricky, tricky. > # When regrtest imports this module, the thread running regrtest grabs the > # import lock and won't let go of it until this module returns. All other > # threads attempting an import hang for the duration. So we have to spawn > # a thread to run the test and return to regrtest.py right away, else the > # test can't make progress. I guess the only way around this is to design a protocol so that tests may be imported and run in two steps: import test.test_foo test.test_foo.run() I can imagine making regrtest look for a specific name in the imported module (e.g. test_main()) and call it if it exists. Then the test (if it uses this feature) should end with the usual if __name__ == '__main__': test_main() > # One miserable consequence: This test can't wait to make sure all the > # threads complete! > # > # Another: If this test fails, the output may show up while running > # some other test. > # > # Another: If you run this test directly, the OS will probably kill > # all the threads right away, because the program exits immediately > # after spawning a thread to run the real test. This one could be fixed by testing for __name__ == '__main__', and should be unless we decide to do the above feature (which I like). > # Another: If this test ever does fail and you attempt to run it by > # itself via regrtest, the same applies: regrtest will get out so fast > # the OS will kill all the threads here. --Guido van Rossum (home page: http://www.python.org/~guido/) From tim_one@users.sourceforge.net Tue May 22 17:29:03 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 22 May 2001 09:29:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mailbox.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2774/python/dist/src/Lib/test Modified Files: test_mailbox.py Log Message: create_message(): When os.link() doesn't exist, make a copy of the msg instead. Allows this test to finish on Windows again. Index: test_mailbox.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mailbox.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** test_mailbox.py 2001/05/21 20:23:21 1.4 --- test_mailbox.py 2001/05/22 16:29:01 1.5 *************** *** 50,54 **** fp.write(DUMMY_MESSAGE) fp.close() ! os.link(tmpname, newname) self._msgfiles.append(newname) --- 50,59 ---- fp.write(DUMMY_MESSAGE) fp.close() ! if hasattr(os, "link"): ! os.link(tmpname, newname) ! else: ! fp = open(newname, "w") ! fp.write(DUMMY_MESSAGE) ! fp.close() self._msgfiles.append(newname) From gvanrossum@users.sourceforge.net Tue May 22 17:41:34 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 22 May 2001 09:41:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules xreadlinesmodule.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv5862 Modified Files: xreadlinesmodule.c Log Message: Iterator support: made the xreadlines object its own iterator. This ought to be faster. Index: xreadlinesmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/xreadlinesmodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** xreadlinesmodule.c 2001/03/23 18:30:19 1.5 --- xreadlinesmodule.c 2001/05/22 16:41:32 1.6 *************** *** 55,65 **** static PyObject * ! xreadlines_item(PyXReadlinesObject *a, int i) { - if (i != a->abslineno) { - PyErr_SetString(PyExc_RuntimeError, - "xreadlines object accessed out of order"); - return NULL; - } if (a->lineno >= a->lineslen) { Py_XDECREF(a->lines); --- 55,60 ---- static PyObject * ! xreadlines_common(PyXReadlinesObject *a) { if (a->lineno >= a->lineslen) { Py_XDECREF(a->lines); *************** *** 76,79 **** --- 71,129 ---- } + static PyObject * + xreadlines_item(PyXReadlinesObject *a, int i) + { + if (i != a->abslineno) { + PyErr_SetString(PyExc_RuntimeError, + "xreadlines object accessed out of order"); + return NULL; + } + return xreadlines_common(a); + } + + static PyObject * + xreadlines_getiter(PyXReadlinesObject *a) + { + Py_INCREF(a); + return (PyObject *)a; + } + + static PyObject * + xreadlines_iternext(PyXReadlinesObject *a) + { + PyObject *res; + + res = xreadlines_common(a); + if (res == NULL && PyErr_ExceptionMatches(PyExc_IndexError)) + PyErr_Clear(); + return res; + } + + static PyObject * + xreadlines_next(PyXReadlinesObject *a, PyObject *args) + { + PyObject *res; + + if (!PyArg_ParseTuple(args, "")) + return NULL; + res = xreadlines_common(a); + if (res == NULL && PyErr_ExceptionMatches(PyExc_IndexError)) + PyErr_SetObject(PyExc_StopIteration, Py_None); + return res; + } + + static char next_doc[] = "x.next() -> the next line or raise StopIteration"; + + static PyMethodDef xreadlines_methods[] = { + {"next", (PyCFunction)xreadlines_next, METH_VARARGS, next_doc}, + {NULL, NULL} + }; + + static PyObject * + xreadlines_getattr(PyObject *a, char *name) + { + return Py_FindMethod(xreadlines_methods, a, name); + } + static PySequenceMethods xreadlines_as_sequence = { 0, /*sq_length*/ *************** *** 89,112 **** sizeof(PyXReadlinesObject) + PyGC_HEAD_SIZE, 0, ! (destructor)xreadlines_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! 0, /*tp_compare*/ ! 0, /*tp_repr*/ ! 0, /*tp_as_number*/ ! &xreadlines_as_sequence, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! 0, /*tp_hash*/ ! 0, /*tp_call*/ ! 0, /*tp_str*/ ! 0, /*tp_getattro*/ ! 0, /*tp_setattro*/ ! 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT, /*tp_flags*/ ! 0, /* tp_doc */ }; ! static PyMethodDef xreadlines_methods[] = { {"xreadlines", xreadlines, METH_VARARGS, xreadlines_doc}, {NULL, NULL} --- 139,168 ---- sizeof(PyXReadlinesObject) + PyGC_HEAD_SIZE, 0, ! (destructor)xreadlines_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! xreadlines_getattr, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! &xreadlines_as_sequence, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT, /* tp_flags */ ! 0, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! (getiterfunc)xreadlines_getiter, /* tp_iter */ ! (iternextfunc)xreadlines_iternext, /* tp_iternext */ }; ! static PyMethodDef xreadlines_functions[] = { {"xreadlines", xreadlines, METH_VARARGS, xreadlines_doc}, {NULL, NULL} *************** *** 119,122 **** XReadlinesObject_Type.ob_type = &PyType_Type; ! m = Py_InitModule("xreadlines", xreadlines_methods); } --- 175,178 ---- XReadlinesObject_Type.ob_type = &PyType_Type; ! m = Py_InitModule("xreadlines", xreadlines_functions); } From fdrake@users.sourceforge.net Tue May 22 17:44:35 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 09:44:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_strop,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv6534/output Removed Files: test_strop Log Message: Migrate the strop test to PyUnit. --- test_strop DELETED --- From fdrake@users.sourceforge.net Tue May 22 17:44:35 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 09:44:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_strop.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6534 Modified Files: test_strop.py Log Message: Migrate the strop test to PyUnit. Index: test_strop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strop.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** test_strop.py 2001/05/15 02:14:44 1.13 --- test_strop.py 2001/05/22 16:44:33 1.14 *************** *** 1,91 **** - from test_support import verbose import warnings warnings.filterwarnings("ignore", "", DeprecationWarning, __name__) ! import strop, sys - def test(name, input, output, *args): - if verbose: - print 'string.%s%s =? %s... ' % (name, (input,) + args, output), - f = getattr(strop, name) - try: - value = apply(f, (input,) + args) - except: - value = sys.exc_type - if value != output: - if verbose: - print 'no' - print f, `input`, `output`, `value` - else: - if verbose: - print 'yes' - - test('atoi', " 1 ", 1) - test('atoi', " 1x", ValueError) - test('atoi', " x1 ", ValueError) - test('atol', " 1 ", 1L) - test('atol', " 1x ", ValueError) - test('atol', " x1 ", ValueError) - test('atof', " 1 ", 1.0) - test('atof', " 1x ", ValueError) - test('atof', " x1 ", ValueError) - - test('capitalize', ' hello ', ' hello ') - test('capitalize', 'hello ', 'Hello ') - test('find', 'abcdefghiabc', 0, 'abc') - test('find', 'abcdefghiabc', 9, 'abc', 1) - test('find', 'abcdefghiabc', -1, 'def', 4) - test('rfind', 'abcdefghiabc', 9, 'abc') - test('lower', 'HeLLo', 'hello') - test('upper', 'HeLLo', 'HELLO') 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' - test('maketrans', 'abc', transtable, 'xyz') - test('maketrans', 'abc', ValueError, 'xyzq') ! test('split', 'this is the split function', ! ['this', 'is', 'the', 'split', 'function']) ! test('split', 'a|b|c|d', ['a', 'b', 'c', 'd'], '|') ! test('split', 'a|b|c|d', ['a', 'b', 'c|d'], '|', 2) ! test('split', 'a b c d', ['a', 'b c d'], None, 1) ! test('split', 'a b c d', ['a', 'b', 'c d'], None, 2) ! test('split', 'a b c d', ['a', 'b', 'c', 'd'], None, 3) ! test('split', 'a b c d', ['a', 'b', 'c', 'd'], None, 4) ! test('split', 'a b c d', ['a', 'b', 'c', 'd'], None, 0) ! test('split', 'a b c d', ['a', 'b', 'c d'], None, 2) ! ! # join now works with any sequence type class Sequence: def __init__(self): self.seq = 'wxyz' def __len__(self): return len(self.seq) def __getitem__(self, i): return self.seq[i] ! test('join', ['a', 'b', 'c', 'd'], 'a b c d') ! test('join', ('a', 'b', 'c', 'd'), 'abcd', '') ! test('join', Sequence(), 'w x y z') ! ! # try a few long ones ! print strop.join(['x' * 100] * 100, ':') ! print strop.join(('x' * 100,) * 100, ':') ! ! test('strip', ' hello ', 'hello') ! test('lstrip', ' hello ', 'hello ') ! test('rstrip', ' hello ', ' hello') ! ! test('swapcase', 'HeLLo cOmpUteRs', 'hEllO CoMPuTErS') ! test('translate', 'xyzabcdef', 'xyzxyz', transtable, 'def') ! ! test('replace', 'one!two!three!', 'one@two!three!', '!', '@', 1) ! test('replace', 'one!two!three!', 'one@two@three!', '!', '@', 2) ! test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 3) ! test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 4) ! # CAUTION: a replace count of 0 means infinity only to strop, not to the ! # string .replace() method or to the string.replace() function. ! test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 0) ! test('replace', 'one!two!three!', 'one@two@three@', '!', '@') ! test('replace', 'one!two!three!', 'one!two!three!', 'x', '@') ! test('replace', 'one!two!three!', 'one!two!three!', 'x', '@', 2) ! ! strop.whitespace ! strop.lowercase ! strop.uppercase --- 1,128 ---- import warnings warnings.filterwarnings("ignore", "", DeprecationWarning, __name__) ! warnings.filterwarnings("ignore", "", DeprecationWarning, "unittest") ! import strop ! import test_support ! import unittest ! ! ! class StropFunctionTestCase(unittest.TestCase): ! ! def test_atoi(self): ! self.assert_(strop.atoi(" 1 ") == 1) ! self.assertRaises(ValueError, strop.atoi, " 1x") ! self.assertRaises(ValueError, strop.atoi, " x1 ") ! ! def test_atol(self): ! self.assert_(strop.atol(" 1 ") == 1L) ! self.assertRaises(ValueError, strop.atol, " 1x") ! self.assertRaises(ValueError, strop.atol, " x1 ") ! ! def test_atof(self): ! self.assert_(strop.atof(" 1 ") == 1.0) ! self.assertRaises(ValueError, strop.atof, " 1x") ! self.assertRaises(ValueError, strop.atof, " x1 ") ! ! def test_capitalize(self): ! self.assert_(strop.capitalize(" hello ") == " hello ") ! self.assert_(strop.capitalize("hello ") == "Hello ") ! ! def test_find(self): ! self.assert_(strop.find("abcdefghiabc", "abc") == 0) ! self.assert_(strop.find("abcdefghiabc", "abc", 1) == 9) ! self.assert_(strop.find("abcdefghiabc", "def", 4) == -1) ! ! def test_rfind(self): ! self.assert_(strop.rfind("abcdefghiabc", "abc") == 9) ! ! def test_lower(self): ! self.assert_(strop.lower("HeLLo") == "hello") ! ! def test_upper(self): ! self.assert_(strop.upper("HeLLo") == "HELLO") ! ! def test_swapcase(self): ! self.assert_(strop.swapcase("HeLLo cOmpUteRs") == "hEllO CoMPuTErS") ! ! def test_strip(self): ! self.assert_(strop.strip(" \t\n hello \t\n ") == "hello") ! ! def test_lstrip(self): ! self.assert_(strop.lstrip(" \t\n hello \t\n ") == "hello \t\n ") ! ! def test_rstrip(self): ! self.assert_(strop.rstrip(" \t\n hello \t\n ") == " \t\n hello") ! ! def test_replace(self): ! replace = strop.replace ! self.assert_(replace("one!two!three!", '!', '@', 1) ! == "one@two!three!") ! self.assert_(replace("one!two!three!", '!', '@', 2) ! == "one@two@three!") ! self.assert_(replace("one!two!three!", '!', '@', 3) ! == "one@two@three@") ! self.assert_(replace("one!two!three!", '!', '@', 4) ! == "one@two@three@") ! ! # CAUTION: a replace count of 0 means infinity only to strop, ! # not to the string .replace() method or to the ! # string.replace() function. ! ! self.assert_(replace("one!two!three!", '!', '@', 0) ! == "one@two@three@") ! self.assert_(replace("one!two!three!", '!', '@') ! == "one@two@three@") ! self.assert_(replace("one!two!three!", 'x', '@') ! == "one!two!three!") ! self.assert_(replace("one!two!three!", 'x', '@', 2) ! == "one!two!three!") ! ! def test_split(self): ! split = strop.split ! self.assert_(split("this is the split function") ! == ['this', 'is', 'the', 'split', 'function']) ! self.assert_(split("a|b|c|d", '|') == ['a', 'b', 'c', 'd']) ! self.assert_(split("a|b|c|d", '|', 2) == ['a', 'b', 'c|d']) ! self.assert_(split("a b c d", None, 1) == ['a', 'b c d']) ! self.assert_(split("a b c d", None, 2) == ['a', 'b', 'c d']) ! self.assert_(split("a b c d", None, 3) == ['a', 'b', 'c', 'd']) ! self.assert_(split("a b c d", None, 4) == ['a', 'b', 'c', 'd']) ! self.assert_(split("a b c d", None, 0) == ['a', 'b', 'c', 'd']) ! self.assert_(split("a b c d", None, 2) == ['a', 'b', 'c d']) ! ! def test_join(self): ! self.assert_(strop.join(['a', 'b', 'c', 'd']) == 'a b c d') ! self.assert_(strop.join(('a', 'b', 'c', 'd'), '') == 'abcd') ! self.assert_(strop.join(Sequence()) == 'w x y z') ! ! # try a few long ones ! self.assert_(strop.join(['x' * 100] * 100, ':') ! == (('x' * 100) + ":") * 99 + "x" * 100) ! self.assert_(strop.join(('x' * 100,) * 100, ':') ! == (('x' * 100) + ":") * 99 + "x" * 100) ! ! def test_maketrans(self): ! self.assert_(strop.maketrans("abc", "xyz") == transtable) ! self.assertRaises(ValueError, strop.maketrans, "abc", "xyzq") ! ! def test_translate(self): ! self.assert_(strop.translate("xyzabcdef", transtable, "def") ! == "xyzxyz") ! ! def test_data_attributes(self): ! strop.lowercase ! strop.uppercase ! strop.whitespace 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' ! # join() now works with any sequence type. class Sequence: def __init__(self): self.seq = 'wxyz' def __len__(self): return len(self.seq) def __getitem__(self, i): return self.seq[i] + ! test_support.run_unittest(StropFunctionTestCase) From gvanrossum@users.sourceforge.net Tue May 22 17:48:39 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 22 May 2001 09:48:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.112,2.113 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7544 Modified Files: fileobject.c Log Message: file_getiter(): make iter(file) be equivalent to file.xreadlines(). This should be faster. This means: (1) "for line in file:" won't work if the xreadlines module can't be imported. (2) The body of "for line in file:" shouldn't use the file directly; the effects (e.g. of file.readline(), file.seek() or even file.tell()) would be undefined because of the buffering that goes on in the xreadlines module. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.112 retrieving revision 2.113 diff -C2 -r2.112 -r2.113 *** fileobject.c 2001/04/23 14:08:49 2.112 --- fileobject.c 2001/05/22 16:48:37 2.113 *************** *** 1299,1314 **** static PyObject * ! file_getiter(PyFileObject *f) { ! static PyObject *es; ! PyObject *iter; ! PyObject *rl = Py_FindMethod(file_methods, (PyObject *)f, "readline"); ! if (rl == NULL) ! return NULL; ! if (es == NULL) ! es = PyString_FromString(""); ! iter = PyCallIter_New(rl, es); ! Py_DECREF(rl); ! return iter; } --- 1299,1305 ---- static PyObject * ! file_getiter(PyObject *f) { ! return PyObject_CallMethod(f, "xreadlines", ""); } *************** *** 1340,1344 **** 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! (getiterfunc)file_getiter, /* tp_iter */ 0, /* tp_iternext */ }; --- 1331,1335 ---- 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ ! file_getiter, /* tp_iter */ 0, /* tp_iternext */ }; From gvwilson@users.sourceforge.net Tue May 22 17:54:22 2001 From: gvwilson@users.sourceforge.net (Greg Wilson) Date: Tue, 22 May 2001 09:54:22 -0700 Subject: [Python-checkins] CVS: python/nondist/sandbox/sets - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv8825/sets Log Message: Directory /cvsroot/python/python/nondist/sandbox/sets added to the repository From gvwilson@users.sourceforge.net Tue May 22 17:55:14 2001 From: gvwilson@users.sourceforge.net (Greg Wilson) Date: Tue, 22 May 2001 09:55:14 -0700 Subject: [Python-checkins] CVS: python/nondist/sandbox/sets set.py,NONE,1.1 test_set.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv9016 Added Files: set.py test_set.py Log Message: First beta version of set module for Python. --- NEW FILE: set.py --- """A class to represent sets in Python. This class implements sets as dictionaries whose values are ignored. The usual operations (union, intersection, deletion, etc.) are provided as both methods and operators. The only unusual feature of this class is that once a set's hash code has been calculated (for example, once it has been used as a dictionary key, or as an element in another set), that set 'freezes', and becomes immutable. See PEP-0218 for a full discussion. """ __version__ = "$Revision: 1.1 $" __author__ = "$Author: gvwilson $" __date__ = "$Date: 2001/05/22 16:55:12 $" from copy import deepcopy class Set: # Displayed when operation forbidden because set has been frozen _Frozen_Msg = "Set is frozen: %s not permitted" #---------------------------------------- def __init__(self, seq=None, sortRepr=0): """Construct a set, optionally initializing it with elements drawn from a sequence. If 'sortRepr' is true, the set's elements are displayed in sorted order. This slows down conversion, but simplifies comparison during testing. The 'hashcode' element is given a non-None value the first time the set's hashcode is calculated; the set is frozen thereafter.""" self.elements = {} self.sortRepr = sortRepr if seq is not None: for x in seq: self.elements[x] = None self.hashcode = None #---------------------------------------- def __str__(self): """Convert set to string.""" content = self.elements.keys() if self.sortRepr: content.sort() return 'Set(' + `content` + ')' #---------------------------------------- # '__repr__' returns the same thing as '__str__' __repr__ = __str__ #---------------------------------------- def __len__(self): """Return number of elements in set.""" return len(self.elements) #---------------------------------------- def __contains__(self, item): """Test presence of value in set.""" return item in self.elements #---------------------------------------- def __iter__(self): """Return iterator for enumerating set elements. This is a keys iterator for the underlying dictionary.""" return self.elements.iterkeys() #---------------------------------------- def __cmp__(self, other): """Compare one set with another. Sets may only be compared with sets; ordering is determined by the keys in the underlying dictionary.""" if not isinstance(other, Set): raise ValueError, "Sets can only be compared to sets" return cmp(self.elements, other.elements) #---------------------------------------- def __hash__(self): """Calculate hash code for set by xor'ing hash codes of set elements. This algorithm ensures that the hash code does not depend on the order in which elements are added to the code.""" # If set already has hashcode, the set has been frozen, so # code is still valid. if self.hashcode is not None: return self.hashcode # Combine hash codes of set elements to produce set's hash code. self.hashcode = 0 for elt in self.elements: self.hashcode ^= hash(elt) return self.hashcode #---------------------------------------- def isFrozen(self): """Report whether set is frozen or not. A frozen set is one whose hash code has already been calculated. Frozen sets may not be mutated, but unfrozen sets can be.""" return self.hashcode is not None #---------------------------------------- def __copy__(self): """Return a shallow copy of the set.""" result = Set() result.elements = self.elements.copy() return result #---------------------------------------- # Define 'copy' method as readable alias for '__copy__'. copy = __copy__ #---------------------------------------- def __deepcopy__(self, memo): result = Set() memo[id(self)] = result result.elements = deepcopy(self.elements, memo) return result #---------------------------------------- def clear(self): """Remove all elements of unfrozen set.""" if self.hashcode is not None: raise ValueError, Set._Frozen_Msg % "clearing" self.elements.clear() #---------------------------------------- def unionUpdate(self, other): """Update set with union of its own elements and the elements in another set.""" self._binaryOpSanityCheck(other, "updating union") self.elements.update(other.elements) return self #---------------------------------------- def union(self, other): """Create new set whose elements are the union of this set's and another's.""" self._binaryOpSanityCheck(other) result = self.__copy__() result.unionUpdate(other) return result #---------------------------------------- def intersectUpdate(self, other): """Update set with intersection of its own elements and the elements in another set.""" self._binaryOpSanityCheck(other, "updating intersection") new_elements = {} for elt in self.elements: if elt in other.elements: new_elements[elt] = None self.elements = new_elements return self #---------------------------------------- def intersect(self, other): """Create new set whose elements are the intersection of this set's and another's.""" self._binaryOpSanityCheck(other) if len(self) <= len(other): little, big = self, other else: little, big = other, self result = Set() for elt in little.elements: if elt in big.elements: result.elements[elt] = None return result #---------------------------------------- def symDifferenceUpdate(self, other): """Update set with symmetric difference of its own elements and the elements in another set. A value 'x' is in the result if it was originally present in one or the other set, but not in both.""" self._binaryOpSanityCheck(other, "updating symmetric difference") self.elements = self._rawSymDifference(self.elements, other.elements) return self #---------------------------------------- def symDifference(self, other): """Create new set with symmetric difference of this set's own elements and the elements in another set. A value 'x' is in the result if it was originally present in one or the other set, but not in both.""" self._binaryOpSanityCheck(other) result = Set() result.elements = self._rawSymDifference(self.elements, other.elements) return result #---------------------------------------- def differenceUpdate(self, other): """Remove all elements of another set from this set.""" self._binaryOpSanityCheck(other, "updating difference") new_elements = {} for elt in self.elements: if elt not in other.elements: new_elements[elt] = None self.elements = new_elements return self #---------------------------------------- def difference(self, other): """Create new set containing elements of this set that are not present in another set.""" self._binaryOpSanityCheck(other) result = Set() for elt in self.elements: if elt not in other.elements: result.elements[elt] = None return result #---------------------------------------- def add(self, item): """Add an item to a set. This has no effect if the item is already present.""" if self.hashcode is not None: raise ValueError, Set._Frozen_Msg % "adding an element" self.elements[item] = None #---------------------------------------- def update(self, iterable): """Add all values from an iteratable (such as a tuple, list, or file) to this set.""" if self.hashcode is not None: raise ValueError, Set._Frozen_Msg % "adding an element" for item in iterable: self.elements[item] = None #---------------------------------------- def remove(self, item): """Remove an element from a set if it is present, or raise a LookupError if it is not.""" if self.hashcode is not None: raise ValueError, Set._Frozen_Msg % "removing an element" try: del self.elements[item] except KeyError: raise LookupError, `item` #---------------------------------------- def discard(self, item): """Remove an element from a set if it is present, or do nothing if it is not.""" if self.hashcode is not None: raise ValueError, Set._Frozen_Msg % "removing an element" try: del self.elements[item] except KeyError: pass #---------------------------------------- def popitem(self): """Remove and return a randomly-chosen set element.""" try: (key, value) = self.elements.popitem() return key except KeyError: raise LookupError, "set is empty" #---------------------------------------- def isSubsetOf(self, other): """Reports whether other set contains this set.""" if not isinstance(other, Set): raise ValueError, "Subset tests only permitted between sets" for element in self.elements: if element not in other.elements: return 0 return 1 #---------------------------------------- def containsAllOf(self, other): """Report whether other subset is subset of this set.""" if not isinstance(other, Set): raise ValueError, "Subset tests only permitted between sets" for element in other.elements: if element not in self.elements: return 0 return 1 #---------------------------------------- # Arithmetic forms of operations __or__ = union __ror__ = union __ior__ = unionUpdate __and__ = intersect __rand__ = intersect __iand__ = intersectUpdate __xor__ = symDifference __rxor__ = symDifference __ixor__ = symDifferenceUpdate __sub__ = difference __rsub__ = difference __isub__ = differenceUpdate #---------------------------------------- # Check that the other argument to a binary operation is also a # set, and that this set is still mutable (if appropriate), # raising a ValueError if either condition is not met. def _binaryOpSanityCheck(self, other, updating_op=''): if updating_op and (self.hashcode is not None): raise ValueError, Set._Frozen_Msg % updating_op if not isinstance(other, Set): raise ValueError, "Binary operation only permitted between sets" #---------------------------------------- # Calculate the symmetric difference between the keys in two # dictionaries with don't-care values. def _rawSymDifference(self, left, right): result = {} for elt in left: if elt not in right: result[elt] = None for elt in right: if elt not in left: result[elt] = None return result #---------------------------------------------------------------------- # Rudimentary self-tests #---------------------------------------------------------------------- if __name__ == "__main__": # Empty set red = Set() assert `red` == "Set([])", "Empty set: %s" % `red` # Unit set green = Set((0,)) assert `green` == "Set([0])", "Unit set: %s" % `green` # 3-element set blue = Set([0, 1, 2]) assert `blue` == "Set([2, 1, 0])", "3-element set: %s" % `blue` # 2-element set with other values black = Set([0, 5]) assert `black` == "Set([5, 0])", "2-element set: %s" % `black` # All elements from all sets white = Set([0, 1, 2, 5]) assert `white` == "Set([5, 2, 1, 0])", "4-element set: %s" % `white` # Add element to empty set red.add(9) assert `red` == "Set([9])", "Add to empty set: %s" % `red` # Remove element from unit set red.remove(9) assert `red` == "Set([])", "Remove from unit set: %s" % `red` # Remove element from empty set try: red.remove(0) assert 0, "Remove element from empty set: %s" % `red` except KeyError: pass # Length assert len(red) == 0, "Length of empty set" assert len(green) == 1, "Length of unit set" assert len(blue) == 3, "Length of 3-element set" # Compare assert green == Set([0]), "Equality failed" assert green != Set([1]), "Inequality failed" # Union assert blue | red == blue, "Union non-empty with empty" assert red | blue == blue, "Union empty with non-empty" assert green | blue == blue, "Union non-empty with non-empty" assert blue | black == white, "Enclosing union" # Intersection assert blue & red == red, "Intersect non-empty with empty" assert red & blue == red, "Intersect empty with non-empty" assert green & blue == green, "Intersect non-empty with non-empty" assert blue & black == green, "Enclosing intersection" # Symmetric difference assert red ^ green == green, "Empty symdiff non-empty" assert green ^ blue == Set([1, 2]), "Non-empty symdiff" assert white ^ white == red, "Self symdiff" # Difference assert red - green == red, "Empty - non-empty" assert blue - red == blue, "Non-empty - empty" assert white - black == Set([1, 2]), "Non-empty - non-empty" # In-place union orange = Set([]) orange |= Set([1]) assert orange == Set([1]), "In-place union" # In-place intersection orange = Set([1, 2]) orange &= Set([2]) assert orange == Set([2]), "In-place intersection" # In-place difference orange = Set([1, 2, 3]) orange -= Set([2, 4]) assert orange == Set([1, 3]), "In-place difference" # In-place symmetric difference orange = Set([1, 2, 3]) orange ^= Set([3, 4]) assert orange == Set([1, 2, 4]), "In-place symmetric difference" print "All tests passed" --- NEW FILE: test_set.py --- #!/usr/bin/env python from set import Set import unittest, operator, copy EmptySet = Set() #=============================================================================== class TestBasicOps(unittest.TestCase): def checkRepr(self): if self.repr is not None: assert `self.set` == self.repr, "Wrong representation for " + self.case def checkLength(self): assert len(self.set) == self.length, "Wrong length for " + self.case def checkSelfEquality(self): assert self.set == self.set, "Self-equality failed for " + self.case def checkEquivalentEquality(self): assert self.set == self.dup, "Equivalent equality failed for " + self.case def checkCopy(self): assert self.set.copy() == self.dup, "Copy and comparison failed for " + self.case def checkSelfUnion(self): result = self.set | self.set assert result == self.dup, "Self-union failed for " + self.case def checkEmptyUnion(self): result = self.set | EmptySet assert result == self.dup, "Union with empty failed for " + self.case def checkUnionEmpty(self): result = EmptySet | self.set assert result == self.dup, "Union with empty failed for " + self.case def checkSelfIntersection(self): result = self.set & self.set assert result == self.dup, "Self-intersection failed for " + self.case def checkEmptyIntersection(self): result = self.set & EmptySet assert result == EmptySet, "Intersection with empty failed for " + self.case def checkIntersectionEmpty(self): result = EmptySet & self.set assert result == EmptySet, "Intersection with empty failed for " + self.case def checkSelfSymmetricDifference(self): result = self.set ^ self.set assert result == EmptySet, "Self-symdiff failed for " + self.case def checkEmptySymmetricDifference(self): result = self.set ^ EmptySet assert result == self.set, "Symdiff with empty failed for " + self.case def checkSelfDifference(self): result = self.set - self.set assert result == EmptySet, "Self-difference failed for " + self.case def checkEmptyDifference(self): result = self.set - EmptySet assert result == self.dup, "Difference with empty failed for " + self.case def checkEmptyDifferenceRev(self): result = EmptySet - self.set assert result == EmptySet, "Difference from empty failed for " + self.case def checkIteration(self): for v in self.set: assert v in self.values, "Missing item in iteration for " + self.case #------------------------------------------------------------------------------- class TestBasicOpsEmpty(TestBasicOps): def setUp(self): self.case = "empty set" self.values = [] self.set = Set(self.values, 1) self.dup = Set(self.values, 1) self.length = 0 self.repr = "Set([])" #------------------------------------------------------------------------------- class TestBasicOpsSingleton(TestBasicOps): def setUp(self): self.case = "unit set (number)" self.values = [3] self.set = Set(self.values, 1) self.dup = Set(self.values, 1) self.length = 1 self.repr = "Set([3])" def checkIn(self): assert 3 in self.set, "Valueship for unit set" def checkNotIn(self): assert 2 not in self.set, "Non-valueship for unit set" #------------------------------------------------------------------------------- class TestBasicOpsTuple(TestBasicOps): def setUp(self): self.case = "unit set (tuple)" self.values = [(0, "zero")] self.set = Set(self.values, 1) self.dup = Set(self.values, 1) self.length = 1 self.repr = "Set([(0, 'zero')])" def checkIn(self): assert (0, "zero") in self.set, "Valueship for tuple set" def checkNotIn(self): assert 9 not in self.set, "Non-valueship for tuple set" #------------------------------------------------------------------------------- class TestBasicOpsTriple(TestBasicOps): def setUp(self): self.case = "triple set" self.values = [0, "zero", operator.add] self.set = Set(self.values, 1) self.dup = Set(self.values, 1) self.length = 3 self.repr = None #=============================================================================== class TestBinaryOps(unittest.TestCase): def setUp(self): self.set = Set((2, 4, 6)) def checkUnionSubset(self): result = self.set | Set([2]) assert result == Set((2, 4, 6)), "Subset union" def checkUnionSuperset(self): result = self.set | Set([2, 4, 6, 8]) assert result == Set([2, 4, 6, 8]), "Superset union" def checkUnionOverlap(self): result = self.set | Set([3, 4, 5]) assert result == Set([2, 3, 4, 5, 6]), "Overlapping union" def checkUnionNonOverlap(self): result = self.set | Set([8]) assert result == Set([2, 4, 6, 8]), "Non-overlapping union" def checkIntersectionSubset(self): result = self.set & Set((2, 4)) assert result == Set((2, 4)), "Subset intersection" def checkIntersectionSuperset(self): result = self.set & Set([2, 4, 6, 8]) assert result == Set([2, 4, 6]), "Superset intersection" def checkIntersectionOverlap(self): result = self.set & Set([3, 4, 5]) assert result == Set([4]), "Overlapping intersection" def checkIntersectionNonOverlap(self): result = self.set & Set([8]) assert result == EmptySet, "Non-overlapping intersection" def checkSymDifferenceSubset(self): result = self.set ^ Set((2, 4)) assert result == Set([6]), "Subset symmetric difference" def checkSymDifferenceSuperset(self): result = self.set ^ Set((2, 4, 6, 8)) assert result == Set([8]), "Superset symmetric difference" def checkSymDifferenceOverlap(self): result = self.set ^ Set((3, 4, 5)) assert result == Set([2, 3, 5, 6]), "Overlapping symmetric difference" def checkSymDifferenceNonOverlap(self): result = self.set ^ Set([8]) assert result == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" #=============================================================================== class TestUpdateOps(unittest.TestCase): def setUp(self): self.set = Set((2, 4, 6)) def checkUnionSubset(self): self.set |= Set([2]) assert self.set == Set((2, 4, 6)), "Subset union" def checkUnionSuperset(self): self.set |= Set([2, 4, 6, 8]) assert self.set == Set([2, 4, 6, 8]), "Superset union" def checkUnionOverlap(self): self.set |= Set([3, 4, 5]) assert self.set == Set([2, 3, 4, 5, 6]), "Overlapping union" def checkUnionNonOverlap(self): self.set |= Set([8]) assert self.set == Set([2, 4, 6, 8]), "Non-overlapping union" def checkIntersectionSubset(self): self.set &= Set((2, 4)) assert self.set == Set((2, 4)), "Subset intersection" def checkIntersectionSuperset(self): self.set &= Set([2, 4, 6, 8]) assert self.set == Set([2, 4, 6]), "Superset intersection" def checkIntersectionOverlap(self): self.set &= Set([3, 4, 5]) assert self.set == Set([4]), "Overlapping intersection" def checkIntersectionNonOverlap(self): self.set &= Set([8]) assert self.set == EmptySet, "Non-overlapping intersection" def checkSymDifferenceSubset(self): self.set ^= Set((2, 4)) assert self.set == Set([6]), "Subset symmetric difference" def checkSymDifferenceSuperset(self): self.set ^= Set((2, 4, 6, 8)) assert self.set == Set([8]), "Superset symmetric difference" def checkSymDifferenceOverlap(self): self.set ^= Set((3, 4, 5)) assert self.set == Set([2, 3, 5, 6]), "Overlapping symmetric difference" def checkSymDifferenceNonOverlap(self): self.set ^= Set([8]) assert self.set == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" #=============================================================================== class TestMutate(unittest.TestCase): def setUp(self): self.values = ["a", "b", "c"] self.set = Set(self.values) def checkAddPresent(self): self.set.add("c") assert self.set == Set(("a", "b", "c")), "Adding present element" def checkAddAbsent(self): self.set.add("d") assert self.set == Set(("a", "b", "c", "d")), "Adding missing element" def checkAddUntilFull(self): tmp = Set() expectedLen = 0 for v in self.values: tmp.add(v) expectedLen += 1 assert len(tmp) == expectedLen, "Adding values one by one to temporary" assert tmp == self.set, "Adding values one by one" def checkRemovePresent(self): self.set.remove("b") assert self.set == Set(("a", "c")), "Removing present element" def checkRemoveAbsent(self): try: self.set.remove("d") assert 0, "Removing missing element" except LookupError: pass def checkRemoveUntilEmpty(self): expectedLen = len(self.set) for v in self.values: self.set.remove(v) expectedLen -= 1 assert len(self.set) == expectedLen, "Removing values one by one" def checkDiscardPresent(self): self.set.discard("c") assert self.set == Set(("a", "b")), "Discarding present element" def checkDiscardAbsent(self): self.set.discard("d") assert self.set == Set(("a", "b", "c")), "Discarding missing element" def checkClear(self): self.set.clear() assert len(self.set) == 0, "Clearing set" def checkPopitem(self): popped = {} while self.set: popped[self.set.popitem()] = None assert len(popped) == len(self.values), "Popping items" for v in self.values: assert v in popped, "Popping items" def checkUpdateEmptyTuple(self): self.set.update(()) assert self.set == Set(self.values), "Updating with empty tuple" def checkUpdateUnitTupleOverlap(self): self.set.update(("a",)) assert self.set == Set(self.values), "Updating with overlapping unit tuple" def checkUpdateUnitTupleNonOverlap(self): self.set.update(("a", "z")) assert self.set == Set(self.values + ["z"]), "Updating with non-overlapping unit tuple" #=============================================================================== class TestFreeze(unittest.TestCase): def setUp(self): self.values = [0, 1] self.set = Set(self.values) hash(self.set) def checkFreezeAfterHash(self): assert self.set.isFrozen(), "Set not frozen after hashing" def checkClearAfterFreeze(self): try: self.set.clear() assert 0, "Empty disregards freezing" except ValueError: pass def checkUnionAfterFreeze(self): try: self.set |= Set([2]) assert 0, "Union update disregards freezing" except ValueError: pass def checkIntersectionAfterFreeze(self): try: self.set &= Set([2]) assert 0, "Intersection update disregards freezing" except ValueError: pass def checkSymDifferenceAfterFreeze(self): try: self.set ^= Set([2]) assert 0, "Symmetric difference update disregards freezing" except ValueError: pass def checkDifferenceAfterFreeze(self): try: self.set -= Set([2]) assert 0, "Difference update disregards freezing" except ValueError: pass def checkAddAfterFreeze(self): try: self.set.add(4) assert 0, "Add disregards freezing" except ValueError: pass def checkUpdateAfterFreeze(self): try: self.set.update([4, 5]) assert 0, "Update disregards freezing" except ValueError: pass #=============================================================================== class TestSubsets(unittest.TestCase): def checkIsSubsetOf(self): result = self.left.isSubsetOf(self.right) if "<" in self.cases: assert result, "subset: " + self.name else: assert not result, "non-subset: " + self.name def checkContainsAllOf(self): result = self.left.containsAllOf(self.right) if ">" in self.cases: assert result, "contains all: " + self.name else: assert not result, "not contains all: " + self.name #------------------------------------------------------------------------------- class TestSubsetEqualEmpty(TestSubsets): def setUp(self): self.left = Set() self.right = Set() self.name = "both empty" self.cases = "<>" #------------------------------------------------------------------------------- class TestSubsetEqualNonEmpty(TestSubsets): def setUp(self): self.left = Set([1, 2]) self.right = Set([1, 2]) self.name = "equal pair" self.cases = "<>" #------------------------------------------------------------------------------- class TestSubsetEmptyNonEmpty(TestSubsets): def setUp(self): self.left = Set() self.right = Set([1, 2]) self.name = "one empty, one non-empty" self.cases = "<" #------------------------------------------------------------------------------- class TestSubsetPartial(TestSubsets): def setUp(self): self.left = Set([1]) self.right = Set([1, 2]) self.name = "one a non-empty subset of other" self.cases = "<" #------------------------------------------------------------------------------- class TestSubsetNonOverlap(TestSubsets): def setUp(self): self.left = Set([1]) self.right = Set([2]) self.name = "neither empty, neither contains" self.cases = "" #=============================================================================== class TestOnlySetsInBinaryOps(unittest.TestCase): def checkCmp(self): try: self.other < self.set assert 0, "Comparison with non-set on left" except ValueError: pass try: self.set >= self.other assert 0, "Comparison with non-set on right" except ValueError: pass def checkUnionUpdate(self): try: self.set |= self.other assert 0, "Union update with non-set" except ValueError: pass def checkUnion(self): try: self.other | self.set assert 0, "Union with non-set on left" except ValueError: pass try: self.set | self.other assert 0, "Union with non-set on right" except ValueError: pass def checkIntersectionUpdate(self): try: self.set &= self.other assert 0, "Intersection update with non-set" except ValueError: pass def checkIntersection(self): try: self.other & self.set assert 0, "Intersection with non-set on left" except ValueError: pass try: self.set & self.other assert 0, "Intersection with non-set on right" except ValueError: pass def checkSymDifferenceUpdate(self): try: self.set ^= self.other assert 0, "Symmetric difference update with non-set" except ValueError: pass def checkSymDifference(self): try: self.other ^ self.set assert 0, "Symmetric difference with non-set on left" except ValueError: pass try: self.set ^ self.other assert 0, "Symmetric difference with non-set on right" except ValueError: pass def checkDifferenceUpdate(self): try: self.set -= self.other assert 0, "Symmetric difference update with non-set" except ValueError: pass def checkDifference(self): try: self.other - self.set assert 0, "Symmetric difference with non-set on left" except ValueError: pass try: self.set - self.other assert 0, "Symmetric difference with non-set on right" except ValueError: pass #------------------------------------------------------------------------------- class TestOnlySetsNumeric(TestOnlySetsInBinaryOps): def setUp(self): self.set = Set((1, 2, 3)) self.other = 19 #------------------------------------------------------------------------------- class TestOnlySetsDict(TestOnlySetsInBinaryOps): def setUp(self): self.set = Set((1, 2, 3)) self.other = {1:2, 3:4} #------------------------------------------------------------------------------- class TestOnlySetsOperator(TestOnlySetsInBinaryOps): def setUp(self): self.set = Set((1, 2, 3)) self.other = operator.add #=============================================================================== class TestCopying(unittest.TestCase): def checkCopy(self): dup = self.set.copy() dup_list = list(dup); dup_list.sort() set_list = list(self.set); set_list.sort() assert len(dup_list) == len(set_list), "Unequal lengths after copy" for i in range(len(dup_list)): assert dup_list[i] is set_list[i], "Non-identical items after copy" def checkDeepCopy(self): dup = copy.deepcopy(self.set) dup_list = list(dup); dup_list.sort() set_list = list(self.set); set_list.sort() assert len(dup_list) == len(set_list), "Unequal lengths after deep copy" for i in range(len(dup_list)): assert dup_list[i] == set_list[i], "Unequal items after deep copy" #------------------------------------------------------------------------------- class TestCopyingEmpty(TestCopying): def setUp(self): self.set = Set() #------------------------------------------------------------------------------- class TestCopyingSingleton(TestCopying): def setUp(self): self.set = Set(["hello"]) #------------------------------------------------------------------------------- class TestCopyingTriple(TestCopying): def setUp(self): self.set = Set(["zero", 0, None]) #------------------------------------------------------------------------------- class TestCopyingTuple(TestCopying): def setUp(self): self.set = Set([(1, 2)]) #------------------------------------------------------------------------------- class TestCopyingNested(TestCopying): def setUp(self): self.set = Set([((1, 2), (3, 4))]) #=============================================================================== def makeAllTests(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestBasicOpsEmpty, 'check')) suite.addTest(unittest.makeSuite(TestBasicOpsSingleton, 'check')) suite.addTest(unittest.makeSuite(TestBasicOpsTuple, 'check')) suite.addTest(unittest.makeSuite(TestBasicOpsTriple, 'check')) suite.addTest(unittest.makeSuite(TestBinaryOps, 'check')) suite.addTest(unittest.makeSuite(TestUpdateOps, 'check')) suite.addTest(unittest.makeSuite(TestMutate, 'check')) suite.addTest(unittest.makeSuite(TestFreeze, 'check')) suite.addTest(unittest.makeSuite(TestSubsetEqualEmpty, 'check')) suite.addTest(unittest.makeSuite(TestSubsetEqualNonEmpty, 'check')) suite.addTest(unittest.makeSuite(TestSubsetEmptyNonEmpty, 'check')) suite.addTest(unittest.makeSuite(TestSubsetPartial, 'check')) suite.addTest(unittest.makeSuite(TestSubsetNonOverlap, 'check')) suite.addTest(unittest.makeSuite(TestOnlySetsNumeric, 'check')) suite.addTest(unittest.makeSuite(TestOnlySetsDict, 'check')) suite.addTest(unittest.makeSuite(TestOnlySetsOperator, 'check')) suite.addTest(unittest.makeSuite(TestCopyingEmpty, 'check')) suite.addTest(unittest.makeSuite(TestCopyingSingleton, 'check')) suite.addTest(unittest.makeSuite(TestCopyingTriple, 'check')) suite.addTest(unittest.makeSuite(TestCopyingTuple, 'check')) suite.addTest(unittest.makeSuite(TestCopyingNested, 'check')) return suite #------------------------------------------------------------------------------- if __name__ == "__main__": unittest.main(defaultTest="makeAllTests") From fdrake@users.sourceforge.net Tue May 22 18:02:04 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 10:02:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_time.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv10455 Modified Files: test_time.py Log Message: Convert time module tests to PyUnit. Index: test_time.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** test_time.py 2000/12/12 23:11:42 1.6 --- test_time.py 2001/05/22 17:02:02 1.7 *************** *** 1,39 **** import time ! time.altzone ! time.clock() ! t = time.time() ! time.asctime(time.gmtime(t)) ! if time.ctime(t) != time.asctime(time.localtime(t)): ! print 'time.ctime(t) != time.asctime(time.localtime(t))' ! ! time.daylight ! if long(time.mktime(time.localtime(t))) != long(t): ! print 'time.mktime(time.localtime(t)) != t' ! ! time.sleep(1.2) ! tt = time.gmtime(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.strftime(format, tt) ! except ValueError: ! print 'conversion specifier:', format, ' failed.' ! ! time.timezone ! time.tzname ! ! # expected errors ! try: ! time.asctime(0) ! except TypeError: ! pass ! ! try: ! time.mktime((999999, 999999, 999999, 999999, ! 999999, 999999, 999999, 999999, ! 999999)) ! except OverflowError: ! pass --- 1,51 ---- + import test_support import time + import unittest ! ! class TimeTestCase(unittest.TestCase): ! ! def setUp(self): ! self.t = time.time() ! ! def test_data_attributes(self): ! time.altzone ! time.daylight ! time.timezone ! time.tzname ! ! def test_clock(self): ! time.clock() ! ! def test_conversions(self): ! self.assert_(time.ctime(self.t) ! == time.asctime(time.localtime(self.t))) ! self.assert_(long(time.mktime(time.localtime(self.t))) ! == long(self.t)) ! ! def test_sleep(self): ! time.sleep(1.2) ! ! def test_strftime(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.strftime(format, tt) ! except ValueError: ! self.fail('conversion specifier: %r failed.' % format) ! ! def test_asctime(self): ! time.asctime(time.gmtime(self.t)) ! self.assertRaises(TypeError, time.asctime, 0) ! ! def test_mktime(self): ! self.assertRaises(OverflowError, ! time.mktime, (999999, 999999, 999999, 999999, ! 999999, 999999, 999999, 999999, ! 999999)) ! ! ! test_support.run_unittest(TimeTestCase) From gvanrossum@users.sourceforge.net Tue May 22 18:21:20 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 22 May 2001 10:21:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include object.h,2.79.2.7,2.79.2.8 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv14976 Modified Files: Tag: descr-branch object.h Log Message: Whoops. Forgot to check this in when getting rid of turtle and dynamic-type: - Remove PyDynamicType_Type & PyTurtle_Type. - Added Py_TPFLAGS_HEAPTYPE, a flag set for type objects allocated on the heap. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.79.2.7 retrieving revision 2.79.2.8 diff -C2 -r2.79.2.7 -r2.79.2.8 *** object.h 2001/05/11 19:58:18 2.79.2.7 --- object.h 2001/05/22 17:21:18 2.79.2.8 *************** *** 285,291 **** ((ob)->ob_type == (tp) || _PyObject_TypeCheck(ob, tp)) ! extern DL_IMPORT(PyTypeObject) PyType_Type; /* The type of most type objects */ ! extern DL_IMPORT(PyTypeObject) PyDynamicType_Type; /* For dynamic types */ ! extern DL_IMPORT(PyTypeObject) PyTurtle_Type; /* The type of the above two */ #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type) --- 285,289 ---- ((ob)->ob_type == (tp) || _PyObject_TypeCheck(ob, tp)) ! extern DL_IMPORT(PyTypeObject) PyType_Type; /* Metatype */ #define PyType_Check(op) PyObject_TypeCheck(op, &PyType_Type) *************** *** 386,389 **** --- 384,390 ---- /* Experimental stuff for healing the type/class split */ #define Py_TPFLAGS_HAVE_CLASS (1L<<8) + + /* Set if the type object is dynamically allocated */ + #define Py_TPFLAGS_HEAPTYPE (1L<<9) #define Py_TPFLAGS_DEFAULT ( \ From tim_one@users.sourceforge.net Tue May 22 19:28:27 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 22 May 2001 11:28:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test regrtest.py,1.34,1.35 test_threaded_import.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv28920/python/dist/src/Lib/test Modified Files: regrtest.py test_threaded_import.py Log Message: Implementing an idea from Guido on the checkins list: When regrtest.py finds an attribute "test_main" in a test it imports, regrtest runs the test's test_main after the import. test_threaded_import needs this else the cross-thread import lock prevents it from making progress. Other tests can use this hack too, but I doubt it will ever be popular. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** regrtest.py 2001/05/21 21:08:12 1.34 --- regrtest.py 2001/05/22 18:28:25 1.35 *************** *** 245,249 **** sys.stdout = cfp print test # Output file starts with test name ! __import__(test, globals(), locals(), []) if cfp and not (generate or verbose): cfp.close() --- 245,256 ---- 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 ! # that way (like test_threaded_import), explicitly invoke ! # their test_main() function (if it exists). ! indirect_test = getattr(the_module, "test_main", None) ! if indirect_test is not None: ! indirect_test() if cfp and not (generate or verbose): cfp.close() Index: test_threaded_import.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_threaded_import.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_threaded_import.py 2001/05/22 09:34:27 1.1 --- test_threaded_import.py 2001/05/22 18:28:25 1.2 *************** *** 7,10 **** --- 7,11 ---- import thread + from test_support import verbose critical_section = thread.allocate_lock() *************** *** 21,52 **** critical_section.release() ! # Tricky, tricky, tricky. ! # When regrtest imports this module, the thread running regrtest grabs the ! # import lock and won't let go of it until this module returns. All other ! # threads attempting an import hang for the duration. So we have to spawn ! # a thread to run the test and return to regrtest.py right away, else the ! # test can't make progress. ! # ! # One miserable consequence: This test can't wait to make sure all the ! # threads complete! ! # ! # Another: If this test fails, the output may show up while running ! # some other test. ! # ! # Another: If you run this test directly, the OS will probably kill ! # all the threads right away, because the program exits immediately ! # after spawning a thread to run the real test. ! # ! # Another: If this test ever does fail and you attempt to run it by ! # itself via regrtest, the same applies: regrtest will get out so fast ! # the OS will kill all the threads here. ! def run_the_test(): global N, done done.acquire() ! for N in [1, 2, 3, 4, 20, 4, 3, 2]: for i in range(N): thread.start_new_thread(task, ()) done.acquire() ! thread.start_new_thread(run_the_test, ()) --- 22,46 ---- critical_section.release() ! # Tricky: When regrtest imports this module, the thread running regrtest ! # grabs the import lock and won't let go of it until this module returns. ! # All other threads attempting an import hang for the duration. Since ! # this test spawns threads that do little *but* import, we can't do that ! # successfully until after this module finishes importing and regrtest ! # regains control. To make this work, a special case was added to ! # regrtest to invoke a module's "test_main" function (if any) after ! # importing it. ! def test_main(): # magic name! see above global N, done done.acquire() ! for N in (20, 50) * 3: ! if verbose: ! print "Trying", N, "threads ...", for i in range(N): thread.start_new_thread(task, ()) done.acquire() + if verbose: + print "OK." ! if __name__ == "__main__": ! test_main() From fdrake@users.sourceforge.net Tue May 22 20:36:52 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 12:36:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib rfc822.py,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv16471 Modified Files: rfc822.py Log Message: Per discussion with Barry, make the default value for both get() and setdefault() the empty string. In setdefault(), use + to join the value to create the entry for the headers attribute so that TypeError is raised if the value is of the wrong type. Index: rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rfc822.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -r1.55 -r1.56 *** rfc822.py 2001/05/22 14:58:10 1.55 --- rfc822.py 2001/05/22 19:36:50 1.56 *************** *** 422,426 **** del self.headers[i] ! def get(self, name, default=None): name = name.lower() if self.dict.has_key(name): --- 422,426 ---- del self.headers[i] ! def get(self, name, default=""): name = name.lower() if self.dict.has_key(name): *************** *** 429,443 **** return default ! def setdefault(self, name, default=''): lowername = name.lower() if self.dict.has_key(lowername): return self.dict[lowername] else: ! default = default or "" ! self.dict[lowername] = default ! text = "%s: %s" % (name, default) lines = text.split("\n") for line in lines: self.headers.append(line + "\n") return default --- 429,442 ---- return default ! def setdefault(self, name, default=""): lowername = name.lower() if self.dict.has_key(lowername): return self.dict[lowername] else: ! text = name + ": " + default lines = text.split("\n") for line in lines: self.headers.append(line + "\n") + self.dict[lowername] = default return default From fdrake@users.sourceforge.net Tue May 22 20:38:33 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 12:38:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_rfc822.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv16916/test Modified Files: test_rfc822.py Log Message: Re-write the rfc822 tests to use PyUnit. Update to reflect using "" as the default value for the second parameter to the get() method. Index: test_rfc822.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_rfc822.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** test_rfc822.py 2001/05/22 15:02:19 1.10 --- test_rfc822.py 2001/05/22 19:38:31 1.11 *************** *** 1,144 **** ! from test_support import verbose, verify ! import rfc822, sys try: from cStringIO import StringIO except ImportError: from StringIO import StringIO - def test(msg, results): - fp = StringIO() - fp.write(msg) - fp.seek(0) - m = rfc822.Message(fp) - i = 0 - - for n, a in m.getaddrlist('to') + m.getaddrlist('cc'): - if verbose: - print 'name:', repr(n), 'addr:', repr(a) - try: - mn, ma = results[i][0], results[i][1] - except IndexError: - print 'extra parsed address:', repr(n), repr(a) - continue - i = i + 1 - if mn == n and ma == a: - if verbose: - print ' [matched]' - else: - if verbose: - print ' [no match]' - print 'not found:', repr(n), repr(a) - - out = m.getdate('date') - if out: - if verbose: - print 'Date:', m.getheader('date') - if out == (1999, 1, 13, 23, 57, 35, 0, 0, 0): - if verbose: - print ' [matched]' - else: - if verbose: - print ' [no match]' - print 'Date conversion failed:', out - - # Note: all test cases must have the same date (in various formats), - # or no date! - - test('''Date: Wed, 13 Jan 1999 23:57:35 -0500 - From: Guido van Rossum - To: "Guido van - \t : Rossum" - Subject: test2 - - test2 - ''', [('Guido van\n\t : Rossum', 'guido@python.org')]) - - test('''From: Barry - Date: 13-Jan-1999 23:57:35 EST - - test''', [('Guido: the Barbarian', 'guido@python.org'), - ('Guido: the Madman', 'guido@python.org') - ]) - - test('''To: "The monster with - the very long name: Guido" - Date: Wed, 13 Jan 1999 23:57:35 -0500 - - test''', [('The monster with\n the very long name: Guido', - 'guido@python.org')]) - - test('''To: "Amit J. Patel" - CC: Mike Fletcher , - "'string-sig@python.org'" - Cc: fooz@bat.com, bart@toof.com - Cc: goit@lip.com - Date: Wed, 13 Jan 1999 23:57:35 -0500 - - test''', [('Amit J. Patel', 'amitp@Theory.Stanford.EDU'), - ('Mike Fletcher', 'mfletch@vrtelecom.com'), - ("'string-sig@python.org'", 'string-sig@python.org'), - ('', 'fooz@bat.com'), - ('', 'bart@toof.com'), - ('', 'goit@lip.com'), - ]) - - # This one is just twisted. I don't know what the proper result should be, - # but it shouldn't be to infloop, which is what used to happen! - test('''To: <[smtp:dd47@mail.xxx.edu]_at_hmhq@hdq-mdm1-imgout.companay.com> - Date: Wed, 13 Jan 1999 23:57:35 -0500 - - test''', [('', ''), - ('', 'dd47@mail.xxx.edu'), - ('', '_at_hmhq@hdq-mdm1-imgout.companay.com') - ]) - - # This exercises the old commas-in-a-full-name bug, which should be doing the - # right thing in recent versions of the module. - test('''To: "last, first" - - test''', [('last, first', 'userid@foo.net'), - ]) - - test('''To: (Comment stuff) "Quoted name"@somewhere.com - - test''', [('Comment stuff', '"Quoted name"@somewhere.com'), - ]) - - test('''To: : - Cc: goit@lip.com - Date: Wed, 13 Jan 1999 23:57:35 -0500 - - test''', [('', 'goit@lip.com')]) - - - test('''To: guido@[132.151.1.21] - - foo''', [('', 'guido@[132.151.1.21]')]) - - - msg = rfc822.Message(StringIO('''To: "last, first" - - test - ''')) - verify(msg.get("to") == '"last, first" ') - verify(msg.get("TO") == '"last, first" ') - verify(msg.get("No-Such-Header") is None) - verify(msg.get("No-Such-Header", "No-Such-Value") == "No-Such-Value") - - verify(not msg.has_key("New-Header")) - verify(msg.setdefault("New-Header", "New-Value") == "New-Value") - verify(msg.setdefault("New-Header", "Different-Value") == "New-Value") - verify(msg["new-header"] == "New-Value") ! verify(msg.setdefault("Another-Header") == "") ! verify(msg["another-header"] == "") --- 1,168 ---- ! import rfc822 ! import sys ! import test_support ! import unittest ! try: from cStringIO import StringIO except ImportError: from StringIO import StringIO + + + class MessageTestCase(unittest.TestCase): + def create_message(self, msg): + return rfc822.Message(StringIO(msg)) + + def test_get(self): + msg = self.create_message( + 'To: "last, first" \n\ntest\n') + self.assert_(msg.get("to") == '"last, first" ') + self.assert_(msg.get("TO") == '"last, first" ') + self.assert_(msg.get("No-Such-Header") == "") + self.assert_(msg.get("No-Such-Header", "No-Such-Value") + == "No-Such-Value") + + def test_setdefault(self): + msg = self.create_message( + 'To: "last, first" \n\ntest\n') + self.assert_(not msg.has_key("New-Header")) + self.assert_(msg.setdefault("New-Header", "New-Value") == "New-Value") + self.assert_(msg.setdefault("New-Header", "Different-Value") + == "New-Value") + self.assert_(msg["new-header"] == "New-Value") + + self.assert_(msg.setdefault("Another-Header") == "") + self.assert_(msg["another-header"] == "") + + def check(self, msg, results): + """Check addresses and the date.""" + m = self.create_message(msg) + i = 0 + for n, a in m.getaddrlist('to') + m.getaddrlist('cc'): + try: + mn, ma = results[i][0], results[i][1] + except IndexError: + print 'extra parsed address:', repr(n), repr(a) + continue + i = i + 1 + if mn == n and ma == a: + pass + else: + print 'not found:', repr(n), repr(a) + + out = m.getdate('date') + if out: + self.assertEqual(out, + (1999, 1, 13, 23, 57, 35, 0, 0, 0), + "date conversion failed") + + + # Note: all test cases must have the same date (in various formats), + # or no date! + + def test_basic(self): + self.check( + 'Date: Wed, 13 Jan 1999 23:57:35 -0500\n' + 'From: Guido van Rossum \n' + 'To: "Guido van\n' + '\t : Rossum" \n' + 'Subject: test2\n' + '\n' + 'test2\n', + [('Guido van\n\t : Rossum', 'guido@python.org')]) + + self.check( + 'From: Barry \n' + 'Date: 13-Jan-1999 23:57:35 EST\n' + '\n' + 'test', + [('Guido: the Barbarian', 'guido@python.org'), + ('Guido: the Madman', 'guido@python.org') + ]) + + self.check( + 'To: "The monster with\n' + ' the very long name: Guido" \n' + 'Date: Wed, 13 Jan 1999 23:57:35 -0500\n' + '\n' + 'test', + [('The monster with\n the very long name: Guido', + 'guido@python.org')]) + + self.check( + 'To: "Amit J. Patel" \n' + 'CC: Mike Fletcher ,\n' + ' "\'string-sig@python.org\'" \n' + 'Cc: fooz@bat.com, bart@toof.com\n' + 'Cc: goit@lip.com\n' + 'Date: Wed, 13 Jan 1999 23:57:35 -0500\n' + '\n' + 'test', + [('Amit J. Patel', 'amitp@Theory.Stanford.EDU'), + ('Mike Fletcher', 'mfletch@vrtelecom.com'), + ("'string-sig@python.org'", 'string-sig@python.org'), + ('', 'fooz@bat.com'), + ('', 'bart@toof.com'), + ('', 'goit@lip.com'), + ]) + + def test_twisted(self): + # This one is just twisted. I don't know what the proper + # result should be, but it shouldn't be to infloop, which is + # what used to happen! + self.check( + 'To: <[smtp:dd47@mail.xxx.edu]_at_hmhq@hdq-mdm1-imgout.companay.com>\n' + 'Date: Wed, 13 Jan 1999 23:57:35 -0500\n' + '\n' + 'test', + [('', ''), + ('', 'dd47@mail.xxx.edu'), + ('', '_at_hmhq@hdq-mdm1-imgout.companay.com'), + ]) + + def test_commas_in_full_name(self): + # This exercises the old commas-in-a-full-name bug, which + # should be doing the right thing in recent versions of the + # module. + self.check( + 'To: "last, first" \n' + '\n' + 'test', + [('last, first', 'userid@foo.net')]) + + def test_quoted_name(self): + self.check( + 'To: (Comment stuff) "Quoted name"@somewhere.com\n' + '\n' + 'test', + [('Comment stuff', '"Quoted name"@somewhere.com')]) + + def test_bogus_to_header(self): + self.check( + 'To: :\n' + 'Cc: goit@lip.com\n' + 'Date: Wed, 13 Jan 1999 23:57:35 -0500\n' + '\n' + 'test', + [('', 'goit@lip.com')]) + + def test_addr_ipquad(self): + self.check( + 'To: guido@[132.151.1.21]\n' + '\n' + 'foo', + [('', 'guido@[132.151.1.21]')]) ! test_support.run_unittest(MessageTestCase) From gvanrossum@users.sourceforge.net Tue May 22 20:53:17 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 22 May 2001 12:53:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects typeobject.c,2.16.8.24,2.16.8.25 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv20067/Objects Modified Files: Tag: descr-branch typeobject.c Log Message: You can now override __getattr__ and __setattr__. Yay! Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.16.8.24 retrieving revision 2.16.8.25 diff -C2 -r2.16.8.24 -r2.16.8.25 *** typeobject.c 2001/05/22 04:21:08 2.16.8.24 --- typeobject.c 2001/05/22 19:53:15 2.16.8.25 *************** *** 968,971 **** --- 968,1017 ---- }; + static struct wrapperbase tab_getattr[] = { + {"__getattr__", (wrapperfunc)wrap_binaryfunc, + "x.__getattr__('name') <==> x.name"}, + {0} + }; + + static PyObject * + wrap_setattr(PyObject *self, PyObject *args, void *wrapped) + { + setattrofunc func = (setattrofunc)wrapped; + int res; + PyObject *name, *value; + + if (!PyArg_ParseTuple(args, "OO", &name, &value)) + return NULL; + res = (*func)(self, name, value); + if (res < 0) + return NULL; + Py_INCREF(Py_None); + return Py_None; + } + + static PyObject * + wrap_delattr(PyObject *self, PyObject *args, void *wrapped) + { + setattrofunc func = (setattrofunc)wrapped; + int res; + PyObject *name; + + if (!PyArg_ParseTuple(args, "O", &name)) + return NULL; + res = (*func)(self, name, NULL); + if (res < 0) + return NULL; + Py_INCREF(Py_None); + return Py_None; + } + + static struct wrapperbase tab_setattr[] = { + {"__setattr__", (wrapperfunc)wrap_setattr, + "x.__setattr__('name', value) <==> x.name = value"}, + {"__delattr__", (wrapperfunc)wrap_delattr, + "x.__delattr__('name') <==> del x.name"}, + {0} + }; + static PyObject * wrap_hashfunc(PyObject *self, PyObject *args, void *wrapped) *************** *** 1185,1189 **** } ! /* Not yet supported: __getattr__, __setattr__ */ ADD(type->tp_compare, tab_cmp); ADD(type->tp_repr, tab_repr); --- 1231,1236 ---- } ! ADD(type->tp_getattro, tab_getattr); ! ADD(type->tp_setattro, tab_setattr); ADD(type->tp_compare, tab_cmp); ADD(type->tp_repr, tab_repr); *************** *** 1384,1387 **** --- 1431,1473 ---- SLOT0(tp_str, str); + static PyObject * + slot_tp_getattro(PyObject *self, PyObject *name) + { + PyTypeObject *tp = self->ob_type; + PyObject *dict = NULL; + PyObject *getattr; + + if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) + dict = tp->tp_dict; + if (dict == NULL) { + PyErr_Format(PyExc_SystemError, + "'%.100s' type object has no __dict__???", + tp->tp_name); + return NULL; + } + getattr = PyDict_GetItemString(dict, "__getattr__"); + if (getattr == NULL) { + PyErr_SetString(PyExc_AttributeError, "__getattr__"); + return NULL; + } + return PyObject_CallFunction(getattr, "OO", self, name); + } + + static int + slot_tp_setattro(PyObject *self, PyObject *name, PyObject *value) + { + PyObject *res; + + if (value == NULL) + res = PyObject_CallMethod(self, "__delattr__", "O", name); + else + res = PyObject_CallMethod(self, "__setattr__", + "OO", name, value); + if (res == NULL) + return -1; + Py_DECREF(res); + return 0; + } + /* Map rich comparison operators to their __xx__ namesakes */ static char *name_op[] = { *************** *** 1530,1533 **** --- 1616,1621 ---- TPSLOT(call, tp_call); TPSLOT(str, tp_str); + TPSLOT(getattr, tp_getattro); + TPSLOT(setattr, tp_setattro); TPSLOT(lt, tp_richcompare); TPSLOT(le, tp_richcompare); From gvanrossum@users.sourceforge.net Tue May 22 21:04:05 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 22 May 2001 13:04:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.1.2.7,1.1.2.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv22160 Modified Files: Tag: descr-branch test_descr.py Log Message: Add a test that overrides __getattr__, __setattr__ and __delattr__. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/Attic/test_descr.py,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -r1.1.2.7 -r1.1.2.8 *** test_descr.py 2001/05/10 21:47:06 1.1.2.7 --- test_descr.py 2001/05/22 20:04:03 1.1.2.8 *************** *** 309,312 **** --- 309,338 ---- verify(a[i][j] == i*j) + import sys + MT = type(sys) + + def pymods(): + if verbose: print "Testing Python subclass of module..." + log = [] + class MM(MT): + def __getattr__(self, name): + log.append(("getattr", name)) + return MT.__getattr__(self, name) + def __setattr__(self, name, value): + log.append(("setattr", name, value)) + MT.__setattr__(self, name, value) + def __delattr__(self, name): + log.append(("delattr", name)) + MT.__delattr__(self, name) + a = MM() + a.foo = 12 + x = a.foo + del a.foo + verify(log == [('getattr', '__setattr__'), + ("setattr", "foo", 12), + ("getattr", "foo"), + ('getattr', '__delattr__'), + ("delattr", "foo")]) + def all(): lists() *************** *** 318,321 **** --- 344,348 ---- spamdicts() pydicts() + pymods() all() From fdrake@users.sourceforge.net Tue May 22 21:20:51 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 13:20:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_dospath.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25739 Modified Files: test_dospath.py Log Message: Convert dospath test suite to PyUnit, adding a couple more cases for isabs() (no false results were checked) and splitdrive(). Index: test_dospath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dospath.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_dospath.py 2001/02/09 11:44:24 1.3 --- test_dospath.py 2001/05/22 20:20:49 1.4 *************** *** 1,47 **** import dospath ! import os - errors = 0 ! def tester(fn, wantResult): ! fn = fn.replace("\\", "\\\\") ! gotResult = eval(fn) ! if wantResult != gotResult: ! print "error!" ! print "evaluated: " + str(fn) ! print "should be: " + str(wantResult) ! print " returned: " + str(gotResult) ! print "" ! global errors ! errors = errors + 1 ! ! tester('dospath.splitdrive("c:\\foo\\bar")', ('c:', '\\foo\\bar')) ! tester('dospath.splitdrive("c:/foo/bar")', ('c:', '/foo/bar')) ! ! tester('dospath.split("c:\\foo\\bar")', ('c:\\foo', 'bar')) ! tester('dospath.split("\\\\conky\\mountpoint\\foo\\bar")', ('\\\\conky\\mountpoint\\foo', 'bar')) ! ! tester('dospath.split("c:\\")', ('c:\\', '')) ! tester('dospath.split("\\\\conky\\mountpoint\\")', ('\\\\conky\\mountpoint', '')) ! ! tester('dospath.split("c:/")', ('c:/', '')) ! tester('dospath.split("//conky/mountpoint/")', ('//conky/mountpoint', '')) ! ! tester('dospath.isabs("c:\\")', 1) ! tester('dospath.isabs("\\\\conky\\mountpoint\\")', 1) ! tester('dospath.isabs("\\foo")', 1) ! tester('dospath.isabs("\\foo\\bar")', 1) ! ! tester('dospath.abspath("C:\\")', "C:\\") ! ! tester('dospath.commonprefix(["/home/swenson/spam", "/home/swen/spam"])', ! "/home/swen") ! tester('dospath.commonprefix(["\\home\\swen\\spam", "\\home\\swen\\eggs"])', ! "\\home\\swen\\") ! tester('dospath.commonprefix(["/home/swen/spam", "/home/swen/spam"])', ! "/home/swen/spam") ! ! if errors: ! print str(errors) + " errors." ! else: ! print "No errors. Thank your lucky stars." --- 1,56 ---- import dospath ! import test_support ! import unittest ! class DOSPathTestCase(unittest.TestCase): ! ! def test_abspath(self): ! self.assert_(dospath.abspath("C:\\") == "C:\\") ! ! def test_isabs(self): ! isabs = dospath.isabs ! self.assert_(isabs("c:\\")) ! self.assert_(isabs("\\\\conky\\mountpoint\\")) ! self.assert_(isabs("\\foo")) ! self.assert_(isabs("\\foo\\bar")) ! self.failIf(isabs("foo")) ! self.failIf(isabs("foo\\")) ! self.failIf(isabs("foo\\bar")) ! self.failIf(isabs("c:foo")) ! self.failIf(isabs("c:foo\\")) ! self.failIf(isabs("c:foo\\bar")) ! ! def test_commonprefix(self): ! commonprefix = dospath.commonprefix ! self.assert_(commonprefix(["/home/swenson/spam", "/home/swen/spam"]) ! == "/home/swen") ! self.assert_(commonprefix(["\\home\\swen\\spam", "\\home\\swen\\eggs"]) ! == "\\home\\swen\\") ! self.assert_(commonprefix(["/home/swen/spam", "/home/swen/spam"]) ! == "/home/swen/spam") ! ! def test_split(self): ! split = dospath.split ! self.assertEquals(split("c:\\foo\\bar"), ! ('c:\\foo', 'bar')) ! self.assertEquals(split("\\\\conky\\mountpoint\\foo\\bar"), ! ('\\\\conky\\mountpoint\\foo', 'bar')) ! ! self.assertEquals(split("c:\\"), ('c:\\', '')) ! self.assertEquals(split("\\\\conky\\mountpoint\\"), ! ('\\\\conky\\mountpoint', '')) ! ! self.assertEquals(split("c:/"), ('c:/', '')) ! self.assertEquals(split("//conky/mountpoint/"), ! ('//conky/mountpoint', '')) ! ! def test_splitdrive(self): ! splitdrive = dospath.splitdrive ! self.assertEquals(splitdrive("c:\\foo\\bar"), ('c:', '\\foo\\bar')) ! self.assertEquals(splitdrive("c:/foo/bar"), ('c:', '/foo/bar')) ! self.assertEquals(splitdrive("foo\\bar"), ('', 'foo\\bar')) ! self.assertEquals(splitdrive("c:"), ('c:', '')) ! ! ! test_support.run_unittest(DOSPathTestCase) From fdrake@users.sourceforge.net Tue May 22 21:22:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 13:22:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_xmllib.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25992 Modified Files: test_xmllib.py Log Message: Simple conversion to PyUnit -- this test really needs more work! Index: test_xmllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmllib.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** test_xmllib.py 2001/01/17 21:51:36 1.4 --- test_xmllib.py 2001/05/22 20:22:06 1.5 *************** *** 3,12 **** ''' - from test_support import verbose - testdoc = """\ --- 3,11 ---- ''' testdoc = """\ + *************** *** 15,25 **** """ import xmllib ! if verbose: ! parser = xmllib.TestXMLParser() ! else: ! parser = xmllib.XMLParser() ! ! for c in testdoc: ! parser.feed(c) ! parser.close() --- 14,30 ---- """ + import test_support + import unittest import xmllib ! ! ! class XMLParserTestCase(unittest.TestCase): ! ! def test_simple(self): ! parser = xmllib.XMLParser() ! for c in testdoc: ! parser.feed(c) ! parser.close() ! ! ! test_support.run_unittest(XMLParserTestCase) From fdrake@users.sourceforge.net Tue May 22 21:25:07 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 13:25:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_fnmatch.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv26553 Modified Files: test_fnmatch.py Log Message: Remove unused import. Index: test_fnmatch.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_fnmatch.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_fnmatch.py 2001/03/21 18:29:24 1.1 --- test_fnmatch.py 2001/05/22 20:25:05 1.2 *************** *** 1,5 **** """Test cases for the fnmatch module.""" - import re import test_support import unittest --- 1,4 ---- From fdrake@users.sourceforge.net Tue May 22 21:38:46 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 13:38:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_copy_reg.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv30348 Modified Files: test_copy_reg.py Log Message: Convert copy_reg test to PyUnit. Index: test_copy_reg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_copy_reg.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_copy_reg.py 2000/10/11 22:17:35 1.1 --- test_copy_reg.py 2001/05/22 20:38:44 1.2 *************** *** 1,35 **** import copy_reg class C: pass ! try: ! copy_reg.pickle(C, None, None) ! except TypeError, e: ! print "Caught expected TypeError:" ! print e ! else: ! print "Failed to catch expected TypeError when registering a class type." ! ! ! print ! try: ! copy_reg.pickle(type(1), "not a callable") ! except TypeError, e: ! print "Caught expected TypeError:" ! print e ! else: ! print "Failed to catch TypeError " \ ! "when registering a non-callable reduction function." ! ! ! print ! try: ! copy_reg.pickle(type(1), int, "not a callable") ! except TypeError, e: ! print "Caught expected TypeError:" ! print e ! else: ! print "Failed to catch TypeError " \ ! "when registering a non-callable constructor." --- 1,25 ---- import copy_reg + import test_support + import unittest + class C: pass + + class CopyRegTestCase(unittest.TestCase): + + def test_class(self): + self.assertRaises(TypeError, copy_reg.pickle, + C, None, None) + + def test_noncallable_reduce(self): + self.assertRaises(TypeError, copy_reg.pickle, + type(1), "not a callable") + + def test_noncallable_constructor(self): + self.assertRaises(TypeError, copy_reg.pickle, + type(1), int, "not a callable") + ! test_support.run_unittest(CopyRegTestCase) From tim_one@users.sourceforge.net Tue May 22 21:40:25 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 22 May 2001 13:40:25 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.90,2.91 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv30669/python/dist/src/Objects Modified Files: dictobject.c Log Message: SF patch #425242: Patch which "inlines" small dictionaries. The idea is Marc-Andre Lemburg's, the implementation is Tim's. Add a new ma_smalltable member to dictobjects, an embedded vector of MINSIZE (8) dictentry structs. Short course is that this lets us avoid additional malloc(s) for dicts with no more than 5 entries. The changes are widespread but mostly small. Long course: WRT speed, all scalar operations (getitem, setitem, delitem) on non-empty dicts benefit from no longer needing NULL-pointer checks (ma_table is never NULL anymore). Bulk operations (copy, update, resize, clearing slots during dealloc) benefit in some cases from now looping on the ma_fill count rather than on ma_size, but that was an unexpected benefit: the original reason to loop on ma_fill was to let bulk operations on empty dicts end quickly (since the NULL-pointer checks went away, empty dicts aren't special-cased any more). Special considerations: For dicts that remain empty, this change is a lose on two counts: the dict object contains 8 new dictentry slots now that weren't needed before, and dict object creation also spends time memset'ing these doomed-to-be-unsused slots to NULLs. For dicts with one or two entries that never get larger than 2, it's a mix: a malloc()/free() pair is no longer needed, and the 2-entry case gets to use 8 slots (instead of 4) thus decreasing the chance of collision. Against that, dict object creation spends time memset'ing 4 slots that aren't strictly needed in this case. For dicts with 3 through 5 entries that never get larger than 5, it's a pure win: the dict is created with all the space they need, and they never need to resize. Before they suffered two malloc()/free() calls, plus 1 dict resize, to get enough space. In addition, the 8-slot table they ended with consumed more memory overall, because of the hidden overhead due to the additional malloc. For dicts with 6 or more entries, the ma_smalltable member is wasted space, but then these are large(r) dicts so 8 slots more or less doesn't make much difference. They still benefit all the time from removing ubiquitous dynamic null-pointer checks, and get a small benefit (but relatively smaller the larger the dict) from not having to do two mallocs, two frees, and a resize on the way *to* getting their sixth entry. All in all it appears a small but definite general win, with larger benefits in specific cases. It's especially nice that it allowed to get rid of several branches, gotos and labels, and overall made the code smaller. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.90 retrieving revision 2.91 diff -C2 -r2.90 -r2.91 *** dictobject.c 2001/05/19 07:04:38 2.90 --- dictobject.c 2001/05/22 20:40:22 2.91 *************** *** 6,14 **** /* ! * MINSIZE is the minimum size of a dictionary. */ - #define MINSIZE 4 - /* define this out if you don't want conversion statistics on exit */ #undef SHOW_CONVERSION_COUNTS --- 6,16 ---- /* ! * MINSIZE is the minimum size of a dictionary. This many slots are ! * allocated directly in the dict object (in the ma_smalltable member). ! * This must be a power of 2, and the first entry in the polys[] vector must ! * match. */ + #define MINSIZE 8 /* define this out if you don't want conversion statistics on exit */ #undef SHOW_CONVERSION_COUNTS *************** *** 17,24 **** Table of irreducible polynomials to efficiently cycle through GF(2^n)-{0}, 2<=n<=30. A table size is always a power of 2. */ static long polys[] = { ! 4 + 3, ! 8 + 3, 16 + 3, 32 + 5, --- 19,40 ---- Table of irreducible polynomials to efficiently cycle through GF(2^n)-{0}, 2<=n<=30. A table size is always a power of 2. + For a table size of 2**i, the polys entry is 2**i + j for some j in 1 thru + 2**i-1 inclusive. The polys[] entries here happen to add in the smallest j + values "that work". Work means this: given any integer k in 1 thru 2**i-1 + inclusive, a poly works if & only if repeating this code: + print k + k <<= 1 + if k >= 2**i: + k ^= poly + prints every integer in 1 thru 2**i-1 inclusive exactly once before printing + k a second time. Theory can be used to find such polys efficiently, but the + operational defn. of "works" is sufficient to find them in reasonable time + via brute force program (hint: any poly that has an even number of 1 bits + cannot work; ditto any poly with low bit 0; exploit those). */ + static long polys[] = { ! /* 4 + 3, */ /* first active entry if MINSIZE == 4 */ ! 8 + 3, /* first active entry if MINSIZE == 8 */ 16 + 3, 32 + 5, *************** *** 47,51 **** 268435456 + 9, 536870912 + 5, ! 1073741824 + 83, }; --- 63,68 ---- 268435456 + 9, 536870912 + 5, ! 1073741824 + 83 ! /* 2147483648 + 9 -- if we ever boost this to unsigned long */ }; *************** *** 101,106 **** --- 118,129 ---- int ma_size; /* total # slots in ma_table */ int ma_poly; /* appopriate entry from polys vector */ + /* ma_table points to ma_smalltable for small tables, else to + * additional malloc'ed memory. ma_table is never NULL! This rule + * saves repeated runtime null-tests in the workhorse getitem and + * setitem calls. + */ dictentry *ma_table; dictentry *(*ma_lookup)(dictobject *mp, PyObject *key, long hash); + dictentry ma_smalltable[MINSIZE]; }; *************** *** 122,125 **** --- 145,158 ---- #endif + /* Set dictobject* mp to empty but w/ MINSIZE slots, using ma_smalltable. */ + #define empty_to_minsize(mp) do { \ + memset((mp)->ma_smalltable, 0, sizeof((mp)->ma_smalltable)); \ + (mp)->ma_table = (mp)->ma_smalltable; \ + (mp)->ma_size = MINSIZE; \ + (mp)->ma_used = (mp)->ma_fill = 0; \ + (mp)->ma_poly = polys[0]; \ + assert(MINSIZE < (mp)->ma_poly && (mp)->ma_poly < MINSIZE*2); \ + } while(0) + PyObject * PyDict_New(void) *************** *** 137,145 **** if (mp == NULL) return NULL; ! mp->ma_size = 0; ! mp->ma_poly = 0; ! mp->ma_table = NULL; ! mp->ma_fill = 0; ! mp->ma_used = 0; mp->ma_lookup = lookdict_string; #ifdef SHOW_CONVERSION_COUNTS --- 170,174 ---- if (mp == NULL) return NULL; ! empty_to_minsize(mp); mp->ma_lookup = lookdict_string; #ifdef SHOW_CONVERSION_COUNTS *************** *** 321,325 **** && compare(ep->me_key, key) == 0)) return ep; ! else if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; /* Cycle through GF(2^n)-{0} */ --- 350,354 ---- && compare(ep->me_key, key) == 0)) return ep; ! if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; /* Cycle through GF(2^n)-{0} */ *************** *** 375,408 **** assert(minused >= 0); ! for (i = 0, newsize = MINSIZE; ; i++, newsize <<= 1) { ! if (i >= sizeof(polys)/sizeof(polys[0])) { ! /* Ran out of polynomials */ ! PyErr_NoMemory(); ! return -1; ! } if (newsize > minused) { newpoly = polys[i]; break; } } ! newtable = PyMem_NEW(dictentry, newsize); ! if (newtable == NULL) { PyErr_NoMemory(); return -1; } ! memset(newtable, '\0', sizeof(dictentry) * newsize); mp->ma_size = newsize; mp->ma_poly = newpoly; - mp->ma_table = newtable; - mp->ma_fill = 0; mp->ma_used = 0; /* Copy the data over; this is refcount-neutral for active entries; dummy entries aren't copied over, of course */ ! for (i = 0, ep = oldtable; i < oldsize; i++, ep++) { ! if (ep->me_value != NULL) /* active entry */ insertdict(mp, ep->me_key, ep->me_hash, ep->me_value); ! else if (ep->me_key != NULL) { /* dummy entry */ assert(ep->me_key == dummy); Py_DECREF(ep->me_key); --- 404,454 ---- assert(minused >= 0); ! assert(oldtable != NULL); ! newpoly = 0; ! newsize = MINSIZE; ! for (i = 0; i < sizeof(polys)/sizeof(polys[0]); ++i) { if (newsize > minused) { newpoly = polys[i]; break; } + newsize <<= 1; + if (newsize < 0) /* overflow */ + break; } ! if (newpoly == 0) { ! /* Ran out of polynomials or newsize overflowed. */ PyErr_NoMemory(); return -1; + } + if (newsize == MINSIZE) { + newtable = mp->ma_smalltable; + if (newtable == oldtable) + return 0; + } + else { + newtable = PyMem_NEW(dictentry, newsize); + if (newtable == NULL) { + PyErr_NoMemory(); + return -1; + } } ! assert(newtable != oldtable); ! mp->ma_table = newtable; mp->ma_size = newsize; + memset(newtable, 0, sizeof(dictentry) * newsize); mp->ma_poly = newpoly; mp->ma_used = 0; + i = mp->ma_fill; + mp->ma_fill = 0; /* Copy the data over; this is refcount-neutral for active entries; dummy entries aren't copied over, of course */ ! for (ep = oldtable; i > 0; ep++) { ! if (ep->me_value != NULL) { /* active entry */ ! --i; insertdict(mp, ep->me_key, ep->me_hash, ep->me_value); ! } else if (ep->me_key != NULL) { /* dummy entry */ + --i; assert(ep->me_key == dummy); Py_DECREF(ep->me_key); *************** *** 411,415 **** } ! if (oldtable != NULL) PyMem_DEL(oldtable); return 0; --- 457,461 ---- } ! if (oldtable != mp->ma_smalltable) PyMem_DEL(oldtable); return 0; *************** *** 424,429 **** return NULL; } - if (mp->ma_table == NULL) - return NULL; #ifdef CACHE_HASH if (!PyString_Check(key) || --- 470,473 ---- *************** *** 480,493 **** return -1; } ! if (mp->ma_fill >= mp->ma_size) { ! /* No room for a new key. ! * This only happens when the dict is empty. ! * Let dictresize() create a minimal dict. ! */ ! assert(mp->ma_used == 0); ! if (dictresize(mp, 0) != 0) ! return -1; ! assert(mp->ma_fill < mp->ma_size); ! } n_used = mp->ma_used; Py_INCREF(value); --- 524,528 ---- return -1; } ! assert(mp->ma_fill < mp->ma_size); n_used = mp->ma_used; Py_INCREF(value); *************** *** 529,537 **** } mp = (dictobject *)op; - if (((dictobject *)op)->ma_table == NULL) - goto empty; ep = (mp->ma_lookup)(mp, key, hash); if (ep->me_value == NULL) { - empty: PyErr_SetObject(PyExc_KeyError, key); return -1; --- 564,569 ---- *************** *** 551,571 **** PyDict_Clear(PyObject *op) { - int i, n; - register dictentry *table; dictobject *mp; if (!PyDict_Check(op)) return; mp = (dictobject *)op; ! table = mp->ma_table; ! if (table == NULL) ! return; n = mp->ma_size; ! mp->ma_size = mp->ma_used = mp->ma_fill = 0; ! mp->ma_table = NULL; ! for (i = 0; i < n; i++) { ! Py_XDECREF(table[i].me_key); ! Py_XDECREF(table[i].me_value); } ! PyMem_DEL(table); } --- 583,650 ---- PyDict_Clear(PyObject *op) { dictobject *mp; + dictentry *ep, *table; + int table_is_malloced; + int fill; + dictentry small_copy[MINSIZE]; + #ifdef Py_DEBUG + int i, n; + #endif + if (!PyDict_Check(op)) return; mp = (dictobject *)op; ! #ifdef Py_DEBUG n = mp->ma_size; ! i = 0; ! #endif ! ! table = mp->ma_table; ! assert(table != NULL); ! table_is_malloced = table != mp->ma_smalltable; ! ! /* This is delicate. During the process of clearing the dict, ! * decrefs can cause the dict to mutate. To avoid fatal confusion ! * (voice of experience), we have to make the dict empty before ! * clearing the slots, and never refer to anything via mp->xxx while ! * clearing. ! */ ! fill = mp->ma_fill; ! if (table_is_malloced) ! empty_to_minsize(mp); ! ! else if (fill > 0) { ! /* It's a small table with something that needs to be cleared. ! * Afraid the only safe way is to copy the dict entries into ! * another small table first. ! */ ! memcpy(small_copy, table, sizeof(small_copy)); ! table = small_copy; ! empty_to_minsize(mp); ! } ! /* else it's a small table that's already empty */ ! ! /* Now we can finally clear things. If C had refcounts, we could ! * assert that the refcount on table is 1 now, i.e. that this function ! * has unique access to it, so decref side-effects can't alter it. ! */ ! for (ep = table; fill > 0; ++ep) { ! #ifdef Py_DEBUG ! assert(i < n); ! ++i; ! #endif ! if (ep->me_key) { ! --fill; ! Py_DECREF(ep->me_key); ! Py_XDECREF(ep->me_value); ! } ! #ifdef Py_DEBUG ! else ! assert(ep->me_value == NULL); ! #endif } ! ! if (table_is_malloced) ! PyMem_DEL(table); } *************** *** 603,619 **** dict_dealloc(register dictobject *mp) { - register int i; register dictentry *ep; Py_TRASHCAN_SAFE_BEGIN(mp) PyObject_GC_Fini(mp); ! for (i = 0, ep = mp->ma_table; i < mp->ma_size; i++, ep++) { ! if (ep->me_key != NULL) { Py_DECREF(ep->me_key); } - if (ep->me_value != NULL) { - Py_DECREF(ep->me_value); - } } ! if (mp->ma_table != NULL) PyMem_DEL(mp->ma_table); mp = (dictobject *) PyObject_AS_GC(mp); --- 682,697 ---- dict_dealloc(register dictobject *mp) { register dictentry *ep; + int fill = mp->ma_fill; Py_TRASHCAN_SAFE_BEGIN(mp) PyObject_GC_Fini(mp); ! for (ep = mp->ma_table; fill > 0; ep++) { ! if (ep->me_key) { ! --fill; Py_DECREF(ep->me_key); + Py_XDECREF(ep->me_value); } } ! if (mp->ma_table != mp->ma_smalltable) PyMem_DEL(mp->ma_table); mp = (dictobject *) PyObject_AS_GC(mp); *************** *** 706,713 **** PyObject *v; long hash; ! if (mp->ma_table == NULL) { ! PyErr_SetObject(PyExc_KeyError, key); ! return NULL; ! } #ifdef CACHE_HASH if (!PyString_Check(key) || --- 784,788 ---- PyObject *v; long hash; ! assert(mp->ma_table != NULL); #ifdef CACHE_HASH if (!PyString_Check(key) || *************** *** 1169,1174 **** return NULL; } ! ok = (mp->ma_size != 0 ! && (mp->ma_lookup)(mp, key, hash)->me_value != NULL); return PyInt_FromLong(ok); } --- 1244,1248 ---- return NULL; } ! ok = (mp->ma_lookup)(mp, key, hash)->me_value != NULL; return PyInt_FromLong(ok); } *************** *** 1184,1189 **** if (!PyArg_ParseTuple(args, "O|O:get", &key, &failobj)) return NULL; - if (mp->ma_table == NULL) - goto finally; #ifdef CACHE_HASH --- 1258,1261 ---- *************** *** 1198,1202 **** val = (mp->ma_lookup)(mp, key, hash)->me_value; - finally: if (val == NULL) val = failobj; --- 1270,1273 ---- *************** *** 1216,1221 **** if (!PyArg_ParseTuple(args, "O|O:setdefault", &key, &failobj)) return NULL; - if (mp->ma_table == NULL) - goto finally; #ifdef CACHE_HASH --- 1287,1290 ---- *************** *** 1229,1234 **** } val = (mp->ma_lookup)(mp, key, hash)->me_value; - - finally: if (val == NULL) { val = failobj; --- 1298,1301 ---- *************** *** 1284,1293 **** if (ep->me_value == NULL) { i = (int)ep->me_hash; ! /* The hash field may be uninitialized trash, or it ! * may be a real hash value, or it may be a legit ! * search finger, or it may be a once-legit search ! * finger that's out of bounds now because it ! * wrapped around or the table shrunk -- simply ! * make sure it's in bounds now. */ if (i >= mp->ma_size || i < 1) --- 1351,1358 ---- if (ep->me_value == NULL) { i = (int)ep->me_hash; ! /* The hash field may be a real hash value, or it may be a ! * legit search finger, or it may be a once-legit search ! * finger that's out of bounds now because it wrapped around ! * or the table shrunk -- simply make sure it's in bounds now. */ if (i >= mp->ma_size || i < 1) *************** *** 1481,1486 **** return -1; } ! return (mp->ma_size != 0 ! && (mp->ma_lookup)(mp, key, hash)->me_value != NULL); } --- 1546,1550 ---- return -1; } ! return (mp->ma_lookup)(mp, key, hash)->me_value != NULL; } From fdrake@users.sourceforge.net Tue May 22 22:01:16 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 14:01:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_binhex.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv2802 Modified Files: test_binhex.py Log Message: Convert binhex regression test to PyUnit. We could use a better test for this. Index: test_binhex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_binhex.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** test_binhex.py 2001/01/17 21:51:36 1.10 --- test_binhex.py 2001/05/22 21:01:14 1.11 *************** *** 3,47 **** Uses the mechanism of the python binhex module ! Roger E. Masse """ import binhex import tempfile ! from test_support import verbose, TestSkipped - def test(): ! try: ! fname1 = tempfile.mktemp() ! fname2 = tempfile.mktemp() ! f = open(fname1, 'w') ! except: ! raise TestSkipped, "Cannot test binhex without a temp file" ! ! start = 'Jack is my hero' ! f.write(start) ! f.close() ! ! binhex.binhex(fname1, fname2) ! if verbose: ! print 'binhex' ! ! binhex.hexbin(fname2, fname1) ! if verbose: ! print 'hexbin' ! ! f = open(fname1, 'r') ! finish = f.readline() ! f.close() # on Windows an open file cannot be unlinked ! ! if start != finish: ! print 'Error: binhex != hexbin' ! elif verbose: ! print 'binhex == hexbin' ! ! try: ! import os ! os.unlink(fname1) ! os.unlink(fname2) ! except: ! pass ! test() --- 3,45 ---- Uses the mechanism of the python binhex module ! Based on an original test by Roger E. Masse. """ import binhex + import os import tempfile ! import test_support ! import unittest ! class BinHexTestCase(unittest.TestCase): ! ! def setUp(self): ! self.fname1 = tempfile.mktemp() ! self.fname2 = tempfile.mktemp() ! ! def tearDown(self): ! try: os.unlink(self.fname1) ! except OSError: pass ! ! try: os.unlink(self.fname2) ! except OSError: pass ! ! DATA = 'Jack is my hero' ! ! def test_binhex(self): ! f = open(self.fname1, 'w') ! f.write(self.DATA) ! f.close() ! ! binhex.binhex(self.fname1, self.fname2) ! ! binhex.hexbin(self.fname2, self.fname1) ! ! f = open(self.fname1, 'r') ! finish = f.readline() ! f.close() ! ! self.assertEqual(self.DATA, finish) ! ! ! test_support.run_unittest(BinHexTestCase) From fdrake@users.sourceforge.net Tue May 22 22:43:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 14:43:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_sha,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv11993/output Removed Files: test_sha Log Message: Move the sha tests to PyUnit. --- test_sha DELETED --- From fdrake@users.sourceforge.net Tue May 22 22:43:19 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 14:43:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_sha.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11993 Modified Files: test_sha.py Log Message: Move the sha tests to PyUnit. Index: test_sha.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sha.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_sha.py 1999/03/24 19:04:29 1.1 --- test_sha.py 2001/05/22 21:43:17 1.2 *************** *** 1,28 **** # Testing sha module (NIST's Secure Hash Algorithm) - import sha - # use the three examples from Federal Information Processing Standards # Publication 180-1, Secure Hash Standard, 1995 April 17 # http://www.itl.nist.gov/div897/pubs/fip180-1.htm ! s = [''] * 3 ! d = [''] * 3 ! s[0] = 'abc' ! d[0] = 'a9993e364706816aba3e25717850c26c9cd0d89d' - s[1] = 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq' - d[1] = '84983e441c3bd26ebaae4aa1f95129e5e54670f1' ! s[2] = 'a' * 1000000 ! d[2] = '34aa973cd4c4daa4f61eeb2bdbad27316534016f' ! ! for i in range(3): ! test = sha.new(s[i]).hexdigest() ! if test == d[i]: ! print "test %d ok" % i ! else: ! print "test %d failed" % i ! print "expected", d[i] ! print "computed", test --- 1,30 ---- # Testing sha module (NIST's Secure Hash Algorithm) # use the three examples from Federal Information Processing Standards # Publication 180-1, Secure Hash Standard, 1995 April 17 # http://www.itl.nist.gov/div897/pubs/fip180-1.htm + + import sha + import test_support + import unittest + + + class SHATestCase(unittest.TestCase): + def check(self, data, digest): + computed = sha.new(data).hexdigest() + self.assert_(computed == digest) + + def test_case_1(self): + self.check("abc", + "a9993e364706816aba3e25717850c26c9cd0d89d") ! def test_case_2(self): ! self.check("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", ! "84983e441c3bd26ebaae4aa1f95129e5e54670f1") ! def test_case_3(self): ! self.check("a" * 1000000, ! "34aa973cd4c4daa4f61eeb2bdbad27316534016f") ! test_support.run_unittest(SHATestCase) From jackjansen@users.sourceforge.net Tue May 22 22:48:42 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:48:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules Nav.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory usw-pr-cvs1:/tmp/cvs-serv12942/Modules Modified Files: Nav.c Log Message: Fixed changed UPP routines names. The module now compiles and loads. Index: Nav.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/Nav.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** Nav.c 2001/01/19 23:46:28 1.12 --- Nav.c 2001/05/22 21:48:40 1.13 *************** *** 33,37 **** --- 33,41 ---- #include "macglue.h" #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif static PyObject *ErrorObject; *************** *** 966,972 **** /* Set UPPs */ ! my_eventProcUPP = NewNavEventProc(my_eventProc); ! my_previewProcUPP = NewNavPreviewProc(my_previewProc); ! my_filterProcUPP = NewNavObjectFilterProc(my_filterProc); } --- 970,976 ---- /* Set UPPs */ ! my_eventProcUPP = NewNavEventUPP(my_eventProc); ! my_previewProcUPP = NewNavPreviewUPP(my_previewProc); ! my_filterProcUPP = NewNavObjectFilterUPP(my_filterProc); } From jackjansen@users.sourceforge.net Tue May 22 22:50:57 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:50:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/ae AEmodule.c,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ae In directory usw-pr-cvs1:/tmp/cvs-serv13651/Python/Mac/Modules/ae Modified Files: AEmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: AEmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/AEmodule.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** AEmodule.c 2001/05/17 21:54:14 1.25 --- AEmodule.c 2001/05/22 21:50:54 1.26 *************** *** 9,14 **** --- 9,18 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include #include + #else + #include + #endif #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 50,55 **** } AEDescObject; ! PyObject *AEDesc_New(itself) ! AEDesc *itself; { AEDescObject *it; --- 54,58 ---- } AEDescObject; ! PyObject *AEDesc_New(AEDesc *itself) { AEDescObject *it; *************** *** 59,65 **** return (PyObject *)it; } ! AEDesc_Convert(v, p_itself) ! PyObject *v; ! AEDesc *p_itself; { if (!AEDesc_Check(v)) --- 62,66 ---- return (PyObject *)it; } ! AEDesc_Convert(PyObject *v, AEDesc *p_itself) { if (!AEDesc_Check(v)) *************** *** 72,77 **** } ! static void AEDesc_dealloc(self) ! AEDescObject *self; { AEDisposeDesc(&self->ob_itself); --- 73,77 ---- } ! static void AEDesc_dealloc(AEDescObject *self) { AEDisposeDesc(&self->ob_itself); *************** *** 79,85 **** } ! static PyObject *AEDesc_AECoerceDesc(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 79,83 ---- } ! static PyObject *AEDesc_AECoerceDesc(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 99,105 **** } ! static PyObject *AEDesc_AEDuplicateDesc(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 97,101 ---- } ! static PyObject *AEDesc_AEDuplicateDesc(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 116,122 **** } ! static PyObject *AEDesc_AECountItems(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 112,116 ---- } ! static PyObject *AEDesc_AECountItems(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 133,139 **** } ! static PyObject *AEDesc_AEPutPtr(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 127,131 ---- } ! static PyObject *AEDesc_AEPutPtr(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 161,167 **** } ! static PyObject *AEDesc_AEPutDesc(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 153,157 ---- } ! static PyObject *AEDesc_AEPutDesc(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 182,188 **** } ! static PyObject *AEDesc_AEGetNthPtr(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 172,176 ---- } ! static PyObject *AEDesc_AEGetNthPtr(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 222,228 **** } ! static PyObject *AEDesc_AEGetNthDesc(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 210,214 ---- } ! static PyObject *AEDesc_AEGetNthDesc(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 248,254 **** } ! static PyObject *AEDesc_AESizeOfNthItem(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 234,238 ---- } ! static PyObject *AEDesc_AESizeOfNthItem(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 271,277 **** } ! static PyObject *AEDesc_AEDeleteItem(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 255,259 ---- } ! static PyObject *AEDesc_AEDeleteItem(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 289,295 **** } ! static PyObject *AEDesc_AEPutParamPtr(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 271,275 ---- } ! static PyObject *AEDesc_AEPutParamPtr(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 317,323 **** } ! static PyObject *AEDesc_AEPutParamDesc(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 297,301 ---- } ! static PyObject *AEDesc_AEPutParamDesc(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 338,344 **** } ! static PyObject *AEDesc_AEGetParamPtr(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 316,320 ---- } ! static PyObject *AEDesc_AEGetParamPtr(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 375,381 **** } ! static PyObject *AEDesc_AEGetParamDesc(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 351,355 ---- } ! static PyObject *AEDesc_AEGetParamDesc(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 398,404 **** } ! static PyObject *AEDesc_AESizeOfParam(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 372,376 ---- } ! static PyObject *AEDesc_AESizeOfParam(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 421,427 **** } ! static PyObject *AEDesc_AEDeleteParam(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 393,397 ---- } ! static PyObject *AEDesc_AEDeleteParam(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 439,445 **** } ! static PyObject *AEDesc_AEGetAttributePtr(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 409,413 ---- } ! static PyObject *AEDesc_AEGetAttributePtr(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 476,482 **** } ! static PyObject *AEDesc_AEGetAttributeDesc(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 444,448 ---- } ! static PyObject *AEDesc_AEGetAttributeDesc(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 499,505 **** } ! static PyObject *AEDesc_AESizeOfAttribute(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 465,469 ---- } ! static PyObject *AEDesc_AESizeOfAttribute(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 522,528 **** } ! static PyObject *AEDesc_AEPutAttributePtr(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 486,490 ---- } ! static PyObject *AEDesc_AEPutAttributePtr(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 550,556 **** } ! static PyObject *AEDesc_AEPutAttributeDesc(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 512,516 ---- } ! static PyObject *AEDesc_AEPutAttributeDesc(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 573,579 **** #if TARGET_API_MAC_CARBON ! static PyObject *AEDesc_AEGetDescDataSize(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 533,537 ---- #if TARGET_API_MAC_CARBON ! static PyObject *AEDesc_AEGetDescDataSize(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 588,594 **** #endif ! static PyObject *AEDesc_AESend(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 546,550 ---- #endif ! static PyObject *AEDesc_AESend(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 616,622 **** } ! static PyObject *AEDesc_AEResetTimer(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 572,576 ---- } ! static PyObject *AEDesc_AEResetTimer(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 631,637 **** } ! static PyObject *AEDesc_AESuspendTheCurrentEvent(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 585,589 ---- } ! static PyObject *AEDesc_AESuspendTheCurrentEvent(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 646,652 **** } ! static PyObject *AEDesc_AEResumeTheCurrentEvent(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 598,602 ---- } ! static PyObject *AEDesc_AEResumeTheCurrentEvent(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 669,675 **** } ! static PyObject *AEDesc_AEGetTheCurrentEvent(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 619,623 ---- } ! static PyObject *AEDesc_AEGetTheCurrentEvent(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 684,690 **** } ! static PyObject *AEDesc_AESetTheCurrentEvent(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 632,636 ---- } ! static PyObject *AEDesc_AESetTheCurrentEvent(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 699,705 **** } ! static PyObject *AEDesc_AEResolve(_self, _args) ! AEDescObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 645,649 ---- } ! static PyObject *AEDesc_AEResolve(AEDescObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 784,790 **** PyMethodChain AEDesc_chain = { AEDesc_methods, NULL }; ! static PyObject *AEDesc_getattr(self, name) ! AEDescObject *self; ! char *name; { --- 728,732 ---- PyMethodChain AEDesc_chain = { AEDesc_methods, NULL }; ! static PyObject *AEDesc_getattr(AEDescObject *self, char *name) { *************** *** 853,859 **** ! static PyObject *AE_AECoercePtr(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 795,799 ---- ! static PyObject *AE_AECoercePtr(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 882,888 **** } ! static PyObject *AE_AECreateDesc(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 822,826 ---- } ! static PyObject *AE_AECreateDesc(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 908,914 **** } ! static PyObject *AE_AECreateList(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 846,850 ---- } ! static PyObject *AE_AECreateList(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 934,940 **** } ! static PyObject *AE_AECreateAppleEvent(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 870,874 ---- } ! static PyObject *AE_AECreateAppleEvent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 967,973 **** #if TARGET_API_MAC_CARBON ! static PyObject *AE_AEReplaceDescData(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 901,905 ---- #if TARGET_API_MAC_CARBON ! static PyObject *AE_AEReplaceDescData(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 994,1000 **** #endif ! static PyObject *AE_AEProcessAppleEvent(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 926,930 ---- #endif ! static PyObject *AE_AEProcessAppleEvent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1011,1017 **** } ! static PyObject *AE_AEGetInteractionAllowed(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 941,945 ---- } ! static PyObject *AE_AEGetInteractionAllowed(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1027,1033 **** } ! static PyObject *AE_AESetInteractionAllowed(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 955,959 ---- } ! static PyObject *AE_AESetInteractionAllowed(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1044,1050 **** } ! static PyObject *AE_AEInteractWithUser(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 970,974 ---- } ! static PyObject *AE_AEInteractWithUser(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1063,1069 **** } ! static PyObject *AE_AEInstallEventHandler(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 987,991 ---- } ! static PyObject *AE_AEInstallEventHandler(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1089,1095 **** } ! static PyObject *AE_AERemoveEventHandler(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1011,1015 ---- } ! static PyObject *AE_AERemoveEventHandler(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1111,1117 **** } ! static PyObject *AE_AEGetEventHandler(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1031,1035 ---- } ! static PyObject *AE_AEGetEventHandler(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1136,1142 **** } ! static PyObject *AE_AEInstallSpecialHandler(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1054,1058 ---- } ! static PyObject *AE_AEInstallSpecialHandler(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1155,1161 **** } ! static PyObject *AE_AERemoveSpecialHandler(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1071,1075 ---- } ! static PyObject *AE_AERemoveSpecialHandler(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1174,1180 **** } ! static PyObject *AE_AEManagerInfo(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1088,1092 ---- } ! static PyObject *AE_AEManagerInfo(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1193,1199 **** } ! static PyObject *AE_AEObjectInit(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1105,1109 ---- } ! static PyObject *AE_AEObjectInit(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1208,1214 **** } ! static PyObject *AE_AEDisposeToken(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1118,1122 ---- } ! static PyObject *AE_AEDisposeToken(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1224,1230 **** } ! static PyObject *AE_AECallObjectAccessor(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1132,1136 ---- } ! static PyObject *AE_AECallObjectAccessor(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1331,1335 **** ! void initAE() { PyObject *m; --- 1237,1241 ---- ! void initAE(void) { PyObject *m; *************** *** 1338,1345 **** ! upp_AEIdleProc = NewAEIdleProc(AEIdleProc); ! upp_GenericEventHandler = NewAEEventHandlerProc(GenericEventHandler); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc_Convert); --- 1244,1251 ---- ! upp_AEIdleProc = NewAEIdleUPP(AEIdleProc); ! upp_GenericEventHandler = NewAEEventHandlerUPP(GenericEventHandler); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc *, AEDesc_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc, AEDesc_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:51:12 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:51:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/app Appmodule.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/app In directory usw-pr-cvs1:/tmp/cvs-serv13741/Python/Mac/Modules/app Modified Files: Appmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Appmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/Appmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** Appmodule.c 2000/12/10 23:43:28 1.6 --- Appmodule.c 2001/05/22 21:51:10 1.7 *************** *** 9,19 **** #include "pymactoolbox.h" #include static PyObject *App_Error; ! static PyObject *App_RegisterAppearanceClient(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 9,22 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif + static PyObject *App_Error; ! static PyObject *App_RegisterAppearanceClient(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 28,34 **** } ! static PyObject *App_UnregisterAppearanceClient(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 31,35 ---- } ! static PyObject *App_UnregisterAppearanceClient(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 43,49 **** } ! static PyObject *App_SetThemePen(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 44,48 ---- } ! static PyObject *App_SetThemePen(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 66,72 **** } ! static PyObject *App_SetThemeBackground(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 65,69 ---- } ! static PyObject *App_SetThemeBackground(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 89,95 **** } ! static PyObject *App_SetThemeTextColor(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 86,90 ---- } ! static PyObject *App_SetThemeTextColor(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 112,118 **** } ! static PyObject *App_SetThemeWindowBackground(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 107,111 ---- } ! static PyObject *App_SetThemeWindowBackground(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 135,141 **** } ! static PyObject *App_DrawThemeWindowHeader(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 128,132 ---- } ! static PyObject *App_DrawThemeWindowHeader(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 155,161 **** } ! static PyObject *App_DrawThemeWindowListViewHeader(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 146,150 ---- } ! static PyObject *App_DrawThemeWindowListViewHeader(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 175,181 **** } ! static PyObject *App_DrawThemePlacard(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 164,168 ---- } ! static PyObject *App_DrawThemePlacard(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 195,201 **** } ! static PyObject *App_DrawThemeEditTextFrame(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 182,186 ---- } ! static PyObject *App_DrawThemeEditTextFrame(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 215,221 **** } ! static PyObject *App_DrawThemeListBoxFrame(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 200,204 ---- } ! static PyObject *App_DrawThemeListBoxFrame(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 235,241 **** } ! static PyObject *App_DrawThemeFocusRect(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 218,222 ---- } ! static PyObject *App_DrawThemeFocusRect(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 255,261 **** } ! static PyObject *App_DrawThemePrimaryGroup(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 236,240 ---- } ! static PyObject *App_DrawThemePrimaryGroup(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 275,281 **** } ! static PyObject *App_DrawThemeSecondaryGroup(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 254,258 ---- } ! static PyObject *App_DrawThemeSecondaryGroup(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 295,301 **** } ! static PyObject *App_DrawThemeSeparator(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 272,276 ---- } ! static PyObject *App_DrawThemeSeparator(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 315,321 **** } ! static PyObject *App_DrawThemeModelessDialogFrame(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 290,294 ---- } ! static PyObject *App_DrawThemeModelessDialogFrame(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 335,341 **** } ! static PyObject *App_DrawThemeGenericWell(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 308,312 ---- } ! static PyObject *App_DrawThemeGenericWell(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 358,364 **** } ! static PyObject *App_DrawThemeFocusRegion(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 329,333 ---- } ! static PyObject *App_DrawThemeFocusRegion(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 376,382 **** } ! static PyObject *App_IsThemeInColor(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 345,349 ---- } ! static PyObject *App_IsThemeInColor(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 395,401 **** } ! static PyObject *App_GetThemeAccentColors(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 362,366 ---- } ! static PyObject *App_GetThemeAccentColors(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 411,417 **** } ! static PyObject *App_DrawThemeMenuBarBackground(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 376,380 ---- } ! static PyObject *App_DrawThemeMenuBarBackground(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 434,440 **** } ! static PyObject *App_GetThemeMenuBarHeight(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 397,401 ---- } ! static PyObject *App_GetThemeMenuBarHeight(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 450,456 **** } ! static PyObject *App_DrawThemeMenuBackground(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 411,415 ---- } ! static PyObject *App_DrawThemeMenuBackground(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 470,476 **** } ! static PyObject *App_GetThemeMenuBackgroundRegion(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 429,433 ---- } ! static PyObject *App_GetThemeMenuBackgroundRegion(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 491,497 **** } ! static PyObject *App_DrawThemeMenuSeparator(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 448,452 ---- } ! static PyObject *App_DrawThemeMenuSeparator(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 508,514 **** } ! static PyObject *App_GetThemeMenuSeparatorHeight(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 463,467 ---- } ! static PyObject *App_GetThemeMenuSeparatorHeight(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 524,530 **** } ! static PyObject *App_GetThemeMenuItemExtra(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 477,481 ---- } ! static PyObject *App_GetThemeMenuItemExtra(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 546,552 **** } ! static PyObject *App_GetThemeMenuTitleExtra(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 497,501 ---- } ! static PyObject *App_GetThemeMenuTitleExtra(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 565,571 **** } ! static PyObject *App_DrawThemeTabPane(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 514,518 ---- } ! static PyObject *App_DrawThemeTabPane(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 585,591 **** } ! static PyObject *App_GetThemeTabRegion(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 532,536 ---- } ! static PyObject *App_GetThemeTabRegion(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 609,615 **** } ! static PyObject *App_SetThemeCursor(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 554,558 ---- } ! static PyObject *App_SetThemeCursor(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 626,632 **** } ! static PyObject *App_SetAnimatedThemeCursor(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 569,573 ---- } ! static PyObject *App_SetAnimatedThemeCursor(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 646,652 **** } ! static PyObject *App_GetThemeScrollBarThumbStyle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 587,591 ---- } ! static PyObject *App_GetThemeScrollBarThumbStyle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 662,668 **** } ! static PyObject *App_GetThemeScrollBarArrowStyle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 601,605 ---- } ! static PyObject *App_GetThemeScrollBarArrowStyle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 678,684 **** } ! static PyObject *App_GetThemeCheckBoxStyle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 615,619 ---- } ! static PyObject *App_GetThemeCheckBoxStyle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 694,700 **** } ! static PyObject *App_UseThemeFont(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 629,633 ---- } ! static PyObject *App_UseThemeFont(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 714,720 **** } ! static PyObject *App_DrawThemeScrollBarArrows(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 647,651 ---- } ! static PyObject *App_DrawThemeScrollBarArrows(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 742,748 **** } ! static PyObject *App_GetThemeScrollBarTrackRect(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 673,677 ---- } ! static PyObject *App_GetThemeScrollBarTrackRect(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 770,776 **** } ! static PyObject *App_HitTestThemeScrollBarArrows(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 699,703 ---- } ! static PyObject *App_HitTestThemeScrollBarArrows(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 804,810 **** } ! static PyObject *App_DrawThemeScrollBarDelimiters(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 731,735 ---- } ! static PyObject *App_DrawThemeScrollBarDelimiters(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 830,836 **** } ! static PyObject *App_PlayThemeSound(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 755,759 ---- } ! static PyObject *App_PlayThemeSound(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 847,853 **** } ! static PyObject *App_BeginThemeDragSound(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 770,774 ---- } ! static PyObject *App_BeginThemeDragSound(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 864,870 **** } ! static PyObject *App_EndThemeDragSound(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 785,789 ---- } ! static PyObject *App_EndThemeDragSound(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 879,885 **** } ! static PyObject *App_DrawThemeTickMark(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 798,802 ---- } ! static PyObject *App_DrawThemeTickMark(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 899,905 **** } ! static PyObject *App_DrawThemeStandaloneGrowBox(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 816,820 ---- } ! static PyObject *App_DrawThemeStandaloneGrowBox(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 925,931 **** } ! static PyObject *App_DrawThemeStandaloneNoGrowBox(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 840,844 ---- } ! static PyObject *App_DrawThemeStandaloneNoGrowBox(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 951,957 **** } ! static PyObject *App_GetThemeStandaloneGrowBoxBounds(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 864,868 ---- } ! static PyObject *App_GetThemeStandaloneGrowBoxBounds(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 976,982 **** } ! static PyObject *App_NormalizeThemeDrawingState(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 887,891 ---- } ! static PyObject *App_NormalizeThemeDrawingState(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 991,997 **** } ! static PyObject *App_ApplyThemeBackground(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 900,904 ---- } ! static PyObject *App_ApplyThemeBackground(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1020,1026 **** } ! static PyObject *App_SetThemeTextColorForWindow(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 927,931 ---- } ! static PyObject *App_SetThemeTextColorForWindow(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1046,1052 **** } ! static PyObject *App_IsValidAppearanceFileType(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 951,955 ---- } ! static PyObject *App_IsValidAppearanceFileType(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1062,1068 **** } ! static PyObject *App_GetThemeBrushAsColor(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 965,969 ---- } ! static PyObject *App_GetThemeBrushAsColor(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1087,1093 **** } ! static PyObject *App_GetThemeTextColor(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 988,992 ---- } ! static PyObject *App_GetThemeTextColor(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1114,1120 **** #if TARGET_API_MAC_CARBON ! static PyObject *App_GetThemeMetric(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1013,1017 ---- #if TARGET_API_MAC_CARBON ! static PyObject *App_GetThemeMetric(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1252,1256 **** ! void initApp() { PyObject *m; --- 1149,1153 ---- ! void initApp(void) { PyObject *m; From jackjansen@users.sourceforge.net Tue May 22 22:51:02 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:51:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/ae aesupport.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ae In directory usw-pr-cvs1:/tmp/cvs-serv13684/Python/Mac/Modules/ae Modified Files: aesupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: aesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ae/aesupport.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** aesupport.py 2001/05/17 21:54:18 1.19 --- aesupport.py 2001/05/22 21:51:00 1.20 *************** *** 83,88 **** --- 83,92 ---- includestuff = includestuff + """ + #ifdef WITHOUT_FRAMEWORKS #include #include + #else + #include + #endif #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 145,152 **** initstuff = initstuff + """ ! upp_AEIdleProc = NewAEIdleProc(AEIdleProc); ! upp_GenericEventHandler = NewAEEventHandlerProc(GenericEventHandler); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc_Convert); """ --- 149,156 ---- initstuff = initstuff + """ ! upp_AEIdleProc = NewAEIdleUPP(AEIdleProc); ! upp_GenericEventHandler = NewAEEventHandlerUPP(GenericEventHandler); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(AEDesc *, AEDesc_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(AEDesc, AEDesc_Convert); """ From jackjansen@users.sourceforge.net Tue May 22 22:51:16 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:51:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/app appsupport.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/app In directory usw-pr-cvs1:/tmp/cvs-serv13759/Python/Mac/Modules/app Modified Files: appsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: appsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/app/appsupport.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** appsupport.py 2000/12/10 23:43:29 1.6 --- appsupport.py 2001/05/22 21:51:14 1.7 *************** *** 70,74 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ """ --- 70,79 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif ! """ From jackjansen@users.sourceforge.net Tue May 22 22:51:31 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:51:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/cm Cmmodule.c,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cm In directory usw-pr-cvs1:/tmp/cvs-serv13790/Python/Mac/Modules/cm Modified Files: Cmmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Cmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/Cmmodule.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** Cmmodule.c 2001/05/17 21:54:29 1.13 --- Cmmodule.c 2001/05/22 21:51:29 1.14 *************** *** 9,13 **** --- 9,18 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif + #ifdef USE_TOOLBOX_OBJECT_GLUE extern PyObject *_CmpObj_New(Component); *************** *** 26,31 **** */ static PyObject * ! CmpDesc_New(itself) ! ComponentDescription *itself; { --- 31,35 ---- */ static PyObject * ! CmpDesc_New(ComponentDescription *itself) { *************** *** 38,44 **** static int ! CmpDesc_Convert(v, p_itself) ! PyObject *v; ! ComponentDescription *p_itself; { return PyArg_ParseTuple(v, "O&O&O&ll", --- 42,46 ---- static int ! CmpDesc_Convert(PyObject *v, ComponentDescription *p_itself) { return PyArg_ParseTuple(v, "O&O&O&ll", *************** *** 63,68 **** } ComponentInstanceObject; ! PyObject *CmpInstObj_New(itself) ! ComponentInstance itself; { ComponentInstanceObject *it; --- 65,69 ---- } ComponentInstanceObject; ! PyObject *CmpInstObj_New(ComponentInstance itself) { ComponentInstanceObject *it; *************** *** 76,82 **** return (PyObject *)it; } ! CmpInstObj_Convert(v, p_itself) ! PyObject *v; ! ComponentInstance *p_itself; { if (!CmpInstObj_Check(v)) --- 77,81 ---- return (PyObject *)it; } ! CmpInstObj_Convert(PyObject *v, ComponentInstance *p_itself) { if (!CmpInstObj_Check(v)) *************** *** 89,94 **** } ! static void CmpInstObj_dealloc(self) ! ComponentInstanceObject *self; { /* Cleanup of self->ob_itself goes here */ --- 88,92 ---- } ! static void CmpInstObj_dealloc(ComponentInstanceObject *self) { /* Cleanup of self->ob_itself goes here */ *************** *** 96,102 **** } ! static PyObject *CmpInstObj_CloseComponent(_self, _args) ! ComponentInstanceObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 94,98 ---- } ! static PyObject *CmpInstObj_CloseComponent(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 111,117 **** } ! static PyObject *CmpInstObj_GetComponentInstanceError(_self, _args) ! ComponentInstanceObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 107,111 ---- } ! static PyObject *CmpInstObj_GetComponentInstanceError(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 126,132 **** } ! static PyObject *CmpInstObj_SetComponentInstanceError(_self, _args) ! ComponentInstanceObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 120,124 ---- } ! static PyObject *CmpInstObj_SetComponentInstanceError(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 142,148 **** } ! static PyObject *CmpInstObj_GetComponentInstanceStorage(_self, _args) ! ComponentInstanceObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 134,138 ---- } ! static PyObject *CmpInstObj_GetComponentInstanceStorage(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 156,162 **** } ! static PyObject *CmpInstObj_SetComponentInstanceStorage(_self, _args) ! ComponentInstanceObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 146,150 ---- } ! static PyObject *CmpInstObj_SetComponentInstanceStorage(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 174,180 **** #if !TARGET_API_MAC_CARBON ! static PyObject *CmpInstObj_GetComponentInstanceA5(_self, _args) ! ComponentInstanceObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 162,166 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *CmpInstObj_GetComponentInstanceA5(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 191,197 **** #if !TARGET_API_MAC_CARBON ! static PyObject *CmpInstObj_SetComponentInstanceA5(_self, _args) ! ComponentInstanceObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 177,181 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *CmpInstObj_SetComponentInstanceA5(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 208,214 **** #endif ! static PyObject *CmpInstObj_ComponentFunctionImplemented(_self, _args) ! ComponentInstanceObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 192,196 ---- #endif ! static PyObject *CmpInstObj_ComponentFunctionImplemented(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 225,231 **** } ! static PyObject *CmpInstObj_GetComponentVersion(_self, _args) ! ComponentInstanceObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 207,211 ---- } ! static PyObject *CmpInstObj_GetComponentVersion(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 239,245 **** } ! static PyObject *CmpInstObj_ComponentSetTarget(_self, _args) ! ComponentInstanceObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 219,223 ---- } ! static PyObject *CmpInstObj_ComponentSetTarget(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 288,294 **** PyMethodChain CmpInstObj_chain = { CmpInstObj_methods, NULL }; ! static PyObject *CmpInstObj_getattr(self, name) ! ComponentInstanceObject *self; ! char *name; { return Py_FindMethodInChain(&CmpInstObj_chain, (PyObject *)self, name); --- 266,270 ---- PyMethodChain CmpInstObj_chain = { CmpInstObj_methods, NULL }; ! static PyObject *CmpInstObj_getattr(ComponentInstanceObject *self, char *name) { return Py_FindMethodInChain(&CmpInstObj_chain, (PyObject *)self, name); *************** *** 336,341 **** } ComponentObject; ! PyObject *CmpObj_New(itself) ! Component itself; { ComponentObject *it; --- 312,316 ---- } ComponentObject; ! PyObject *CmpObj_New(Component itself) { ComponentObject *it; *************** *** 350,356 **** return (PyObject *)it; } ! CmpObj_Convert(v, p_itself) ! PyObject *v; ! Component *p_itself; { if ( v == Py_None ) { --- 325,329 ---- return (PyObject *)it; } ! CmpObj_Convert(PyObject *v, Component *p_itself) { if ( v == Py_None ) { *************** *** 367,372 **** } ! static void CmpObj_dealloc(self) ! ComponentObject *self; { /* Cleanup of self->ob_itself goes here */ --- 340,344 ---- } ! static void CmpObj_dealloc(ComponentObject *self) { /* Cleanup of self->ob_itself goes here */ *************** *** 374,380 **** } ! static PyObject *CmpObj_UnregisterComponent(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 346,350 ---- } ! static PyObject *CmpObj_UnregisterComponent(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 389,395 **** } ! static PyObject *CmpObj_GetComponentInfo(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 359,363 ---- } ! static PyObject *CmpObj_GetComponentInfo(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 415,421 **** } ! static PyObject *CmpObj_OpenComponent(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 383,387 ---- } ! static PyObject *CmpObj_OpenComponent(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 429,435 **** } ! static PyObject *CmpObj_GetComponentRefcon(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 395,399 ---- } ! static PyObject *CmpObj_GetComponentRefcon(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 443,449 **** } ! static PyObject *CmpObj_SetComponentRefcon(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 407,411 ---- } ! static PyObject *CmpObj_SetComponentRefcon(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 459,465 **** } ! static PyObject *CmpObj_OpenComponentResFile(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 421,425 ---- } ! static PyObject *CmpObj_OpenComponentResFile(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 473,479 **** } ! static PyObject *CmpObj_GetComponentResource(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 433,437 ---- } ! static PyObject *CmpObj_GetComponentResource(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 496,502 **** } ! static PyObject *CmpObj_GetComponentIndString(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 454,458 ---- } ! static PyObject *CmpObj_GetComponentIndString(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 520,526 **** } ! static PyObject *CmpObj_ResolveComponentAlias(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 476,480 ---- } ! static PyObject *CmpObj_ResolveComponentAlias(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 534,540 **** } ! static PyObject *CmpObj_CountComponentInstances(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 488,492 ---- } ! static PyObject *CmpObj_CountComponentInstances(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 548,554 **** } ! static PyObject *CmpObj_SetDefaultComponent(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 500,504 ---- } ! static PyObject *CmpObj_SetDefaultComponent(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 566,572 **** } ! static PyObject *CmpObj_CaptureComponent(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 516,520 ---- } ! static PyObject *CmpObj_CaptureComponent(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 583,589 **** } ! static PyObject *CmpObj_UncaptureComponent(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 531,535 ---- } ! static PyObject *CmpObj_UncaptureComponent(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 598,604 **** } ! static PyObject *CmpObj_GetComponentIconSuite(_self, _args) ! ComponentObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 544,548 ---- } ! static PyObject *CmpObj_GetComponentIconSuite(ComponentObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 649,655 **** PyMethodChain CmpObj_chain = { CmpObj_methods, NULL }; ! static PyObject *CmpObj_getattr(self, name) ! ComponentObject *self; ! char *name; { return Py_FindMethodInChain(&CmpObj_chain, (PyObject *)self, name); --- 593,597 ---- PyMethodChain CmpObj_chain = { CmpObj_methods, NULL }; ! static PyObject *CmpObj_getattr(ComponentObject *self, char *name) { return Py_FindMethodInChain(&CmpObj_chain, (PyObject *)self, name); *************** *** 686,692 **** ! static PyObject *Cm_RegisterComponentResource(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 628,632 ---- ! static PyObject *Cm_RegisterComponentResource(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 705,711 **** } ! static PyObject *Cm_FindNextComponent(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 645,649 ---- } ! static PyObject *Cm_FindNextComponent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 724,730 **** } ! static PyObject *Cm_CountComponents(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 662,666 ---- } ! static PyObject *Cm_CountComponents(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 740,746 **** } ! static PyObject *Cm_GetComponentListModSeed(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 676,680 ---- } ! static PyObject *Cm_GetComponentListModSeed(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 754,760 **** } ! static PyObject *Cm_CloseComponentResFile(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 688,692 ---- } ! static PyObject *Cm_CloseComponentResFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 771,777 **** } ! static PyObject *Cm_OpenDefaultComponent(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 703,707 ---- } ! static PyObject *Cm_OpenDefaultComponent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 790,796 **** } ! static PyObject *Cm_RegisterComponentResourceFile(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 720,724 ---- } ! static PyObject *Cm_RegisterComponentResourceFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 830,834 **** ! void initCm() { PyObject *m; --- 758,762 ---- ! void initCm(void) { PyObject *m; *************** *** 837,844 **** ! PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpInstObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpInstObj_Convert); --- 765,772 ---- ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Component, CmpObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Component, CmpObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(ComponentInstance, CmpInstObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ComponentInstance, CmpInstObj_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:51:35 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:51:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/cm cmsupport.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cm In directory usw-pr-cvs1:/tmp/cvs-serv13840/Python/Mac/Modules/cm Modified Files: cmsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: cmsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cm/cmsupport.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** cmsupport.py 2001/05/17 21:54:35 1.3 --- cmsupport.py 2001/05/22 21:51:33 1.4 *************** *** 22,26 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ #ifdef USE_TOOLBOX_OBJECT_GLUE extern PyObject *_CmpObj_New(Component); --- 22,31 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif ! #ifdef USE_TOOLBOX_OBJECT_GLUE extern PyObject *_CmpObj_New(Component); *************** *** 39,44 **** */ static PyObject * ! CmpDesc_New(itself) ! ComponentDescription *itself; { --- 44,48 ---- */ static PyObject * ! CmpDesc_New(ComponentDescription *itself) { *************** *** 51,57 **** static int ! CmpDesc_Convert(v, p_itself) ! PyObject *v; ! ComponentDescription *p_itself; { return PyArg_ParseTuple(v, "O&O&O&ll", --- 55,59 ---- static int ! CmpDesc_Convert(PyObject *v, ComponentDescription *p_itself) { return PyArg_ParseTuple(v, "O&O&O&ll", *************** *** 65,72 **** initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(CmpInstObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CmpInstObj_Convert); """ --- 67,74 ---- initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Component, CmpObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Component, CmpObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(ComponentInstance, CmpInstObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ComponentInstance, CmpInstObj_Convert); """ From jackjansen@users.sourceforge.net Tue May 22 22:51:46 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:51:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/ctl Ctlmodule.c,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory usw-pr-cvs1:/tmp/cvs-serv13873/Python/Mac/Modules/ctl Modified Files: Ctlmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Ctlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/Ctlmodule.c,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -r1.43 -r1.44 *** Ctlmodule.c 2001/05/17 21:54:45 1.43 --- Ctlmodule.c 2001/05/22 21:51:44 1.44 *************** *** 9,15 **** #include "pymactoolbox.h" #include - #ifndef kControlCheckBoxUncheckedValue #include #endif --- 9,17 ---- #include "pymactoolbox.h" [...1938 lines suppressed...] ! mydrawproc_upp = NewControlUserPaneDrawProc(mydrawproc); ! myidleproc_upp = NewControlUserPaneIdleProc(myidleproc); ! myhittestproc_upp = NewControlUserPaneHitTestProc(myhittestproc); ! mytrackingproc_upp = NewControlUserPaneTrackingProc(mytrackingproc); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(CtlObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CtlObj_Convert); --- 2682,2692 ---- ! mytracker_upp = NewControlActionUPP(mytracker); ! mydrawproc_upp = NewControlUserPaneDrawUPP(mydrawproc); ! myidleproc_upp = NewControlUserPaneIdleUPP(myidleproc); ! myhittestproc_upp = NewControlUserPaneHitTestUPP(myhittestproc); ! mytrackingproc_upp = NewControlUserPaneTrackingUPP(mytrackingproc); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:51:51 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:51:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/ctl ctlsupport.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory usw-pr-cvs1:/tmp/cvs-serv13913/Python/Mac/Modules/ctl Modified Files: ctlsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: ctlsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlsupport.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -r1.38 -r1.39 *** ctlsupport.py 2001/05/17 21:54:55 1.38 --- ctlsupport.py 2001/05/22 21:51:49 1.39 *************** *** 50,56 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ ! #ifndef kControlCheckBoxUncheckedValue #include #endif --- 50,58 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include #include + #else + #include #endif *************** *** 78,83 **** #if 0 /* Not needed */ static PyObject * ! ControlFontStyle_New(itself) ! ControlFontStyleRec *itself; { --- 80,84 ---- #if 0 /* Not needed */ static PyObject * ! ControlFontStyle_New(ControlFontStyleRec *itself) { *************** *** 89,95 **** static int ! ControlFontStyle_Convert(v, itself) ! PyObject *v; ! ControlFontStyleRec *itself; { return PyArg_ParseTuple(v, "hhhhhhO&O&", &itself->flags, --- 90,94 ---- static int ! ControlFontStyle_Convert(PyObject *v, ControlFontStyleRec *itself) { return PyArg_ParseTuple(v, "hhhhhhO&O&", &itself->flags, *************** *** 103,108 **** */ static PyObject * ! PyControlID_New(itself) ! ControlID *itself; { --- 102,106 ---- */ static PyObject * ! PyControlID_New(ControlID *itself) { *************** *** 111,117 **** static int ! PyControlID_Convert(v, itself) ! PyObject *v; ! ControlID *itself; { return PyArg_ParseTuple(v, "O&l", PyMac_GetOSType, &itself->signature, &itself->id); --- 109,113 ---- static int ! PyControlID_Convert(PyObject *v, ControlID *itself) { return PyArg_ParseTuple(v, "O&l", PyMac_GetOSType, &itself->signature, &itself->id); *************** *** 134,139 **** finalstuff = finalstuff + """ static PyObject * ! CtlObj_NewUnmanaged(itself) ! ControlHandle itself; { ControlObject *it; --- 130,134 ---- finalstuff = finalstuff + """ static PyObject * ! CtlObj_NewUnmanaged(ControlHandle itself) { ControlObject *it; *************** *** 167,172 **** static int ! settrackfunc(obj) ! PyObject *obj; { if (tracker) { --- 162,166 ---- static int ! settrackfunc(PyObject *obj) { if (tracker) { *************** *** 179,183 **** static void ! clrtrackfunc() { Py_XDECREF(tracker); --- 173,177 ---- static void ! clrtrackfunc(void) { Py_XDECREF(tracker); *************** *** 202,210 **** static int ! setcallback(myself, which, callback, uppp) ! PyObject *myself; ! OSType which; ! PyObject *callback; ! UniversalProcPtr *uppp; { ControlObject *self = (ControlObject *)myself; --- 196,200 ---- static int ! setcallback(PyObject *myself, OSType which, PyObject *callback, UniversalProcPtr *uppp) { ControlObject *self = (ControlObject *)myself; *************** *** 236,243 **** static PyObject * ! callcallback(self, which, arglist) ! ControlObject *self; ! OSType which; ! PyObject *arglist; { char keybuf[9]; --- 226,230 ---- static PyObject * ! callcallback(ControlObject *self, OSType which, PyObject *arglist) { char keybuf[9]; *************** *** 320,330 **** initstuff = initstuff + """ ! mytracker_upp = NewControlActionProc(mytracker); ! mydrawproc_upp = NewControlUserPaneDrawProc(mydrawproc); ! myidleproc_upp = NewControlUserPaneIdleProc(myidleproc); ! myhittestproc_upp = NewControlUserPaneHitTestProc(myhittestproc); ! mytrackingproc_upp = NewControlUserPaneTrackingProc(mytrackingproc); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(CtlObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CtlObj_Convert); """ --- 307,317 ---- initstuff = initstuff + """ ! mytracker_upp = NewControlActionUPP(mytracker); ! mydrawproc_upp = NewControlUserPaneDrawUPP(mydrawproc); ! myidleproc_upp = NewControlUserPaneIdleUPP(myidleproc); ! myhittestproc_upp = NewControlUserPaneHitTestUPP(myhittestproc); ! mytrackingproc_upp = NewControlUserPaneTrackingUPP(mytrackingproc); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(ControlHandle, CtlObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ControlHandle, CtlObj_Convert); """ From jackjansen@users.sourceforge.net Tue May 22 22:51:56 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:51:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/dlg Dlgmodule.c,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/dlg In directory usw-pr-cvs1:/tmp/cvs-serv13942/Python/Mac/Modules/dlg Modified Files: Dlgmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Dlgmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/dlg/Dlgmodule.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** Dlgmodule.c 2001/05/17 21:55:02 1.25 --- Dlgmodule.c 2001/05/22 21:51:54 1.26 *************** *** 9,13 **** --- 9,18 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif + #ifdef USE_TOOLBOX_OBJECT_GLUE [...1008 lines suppressed...] ! void initDlg(void) { PyObject *m; *************** *** 1527,1533 **** ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_WhichDialog); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DlgObj_Convert); --- 1406,1412 ---- ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_WhichDialog); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DialogPtr, DlgObj_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:52:10 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/drag dragsupport.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory usw-pr-cvs1:/tmp/cvs-serv14045/Python/Mac/Modules/drag Modified Files: dragsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: dragsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/dragsupport.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** dragsupport.py 2001/05/17 21:55:37 1.5 --- dragsupport.py 2001/05/22 21:52:08 1.6 *************** *** 45,49 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ /* Callback glue routines */ --- 45,53 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif /* Callback glue routines */ *************** *** 163,177 **** initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DragObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragObj_Convert); """ variablestuff = """ ! dragglue_TrackingHandlerUPP = NewDragTrackingHandlerProc(dragglue_TrackingHandler); ! dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerProc(dragglue_ReceiveHandler); ! dragglue_SendDataUPP = NewDragSendDataProc(dragglue_SendData); #if 0 ! dragglue_InputUPP = NewDragInputProc(dragglue_Input); ! dragglue_DrawingUPP = NewDragDrawingProc(dragglue_Drawing); #endif """ --- 167,181 ---- initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DragRef, DragObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragRef, DragObj_Convert); """ variablestuff = """ ! dragglue_TrackingHandlerUPP = NewDragTrackingHandlerUPP(dragglue_TrackingHandler); ! dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerUPP(dragglue_ReceiveHandler); ! dragglue_SendDataUPP = NewDragSendDataUPP(dragglue_SendData); #if 0 ! dragglue_InputUPP = NewDragInputUPP(dragglue_Input); ! dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing); #endif """ From jackjansen@users.sourceforge.net Tue May 22 22:52:19 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/evt evtsupport.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/evt In directory usw-pr-cvs1:/tmp/cvs-serv14102/Python/Mac/Modules/evt Modified Files: evtsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: evtsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/evt/evtsupport.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** evtsupport.py 2000/07/24 19:59:17 1.11 --- evtsupport.py 2001/05/22 21:52:17 1.12 *************** *** 36,40 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ """ --- 36,45 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif ! """ From jackjansen@users.sourceforge.net Tue May 22 22:52:29 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/fm fmsupport.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/fm In directory usw-pr-cvs1:/tmp/cvs-serv14144/Python/Mac/Modules/fm Modified Files: fmsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: fmsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/fm/fmsupport.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** fmsupport.py 2000/07/14 22:16:40 1.2 --- fmsupport.py 2001/05/22 21:52:26 1.3 *************** *** 20,31 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ /* ** Parse/generate ComponentDescriptor records */ static PyObject * ! FMRec_New(itself) ! FMetricRec *itself; { --- 20,35 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif + /* ** Parse/generate ComponentDescriptor records */ static PyObject * ! FMRec_New(FMetricRec *itself) { *************** *** 41,47 **** /* Not needed... */ static int ! FMRec_Convert(v, p_itself) ! PyObject *v; ! FMetricRec *p_itself; { return PyArg_ParseTuple(v, "O&O&O&O&O&", --- 45,49 ---- /* Not needed... */ static int ! FMRec_Convert(PyObject *v, FMetricRec *p_itself) { return PyArg_ParseTuple(v, "O&O&O&O&O&", From jackjansen@users.sourceforge.net Tue May 22 22:52:33 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:33 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/help Helpmodule.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/help In directory usw-pr-cvs1:/tmp/cvs-serv14176/Python/Mac/Modules/help Modified Files: Helpmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Helpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/Helpmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Helpmodule.c 2000/12/10 23:43:42 1.7 --- Helpmodule.c 2001/05/22 21:52:31 1.8 *************** *** 13,19 **** static PyObject *Help_Error; ! static PyObject *Help_HMGetHelpMenuHandle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 13,17 ---- static PyObject *Help_Error; ! static PyObject *Help_HMGetHelpMenuHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 29,35 **** } ! static PyObject *Help_HMRemoveBalloon(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 27,31 ---- } ! static PyObject *Help_HMRemoveBalloon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 44,50 **** } ! static PyObject *Help_HMIsBalloon(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 40,44 ---- } ! static PyObject *Help_HMIsBalloon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 58,64 **** } ! static PyObject *Help_HMGetBalloons(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 52,56 ---- } ! static PyObject *Help_HMGetBalloons(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 72,78 **** } ! static PyObject *Help_HMSetBalloons(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 64,68 ---- } ! static PyObject *Help_HMSetBalloons(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 89,95 **** } ! static PyObject *Help_HMSetFont(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 79,83 ---- } ! static PyObject *Help_HMSetFont(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 106,112 **** } ! static PyObject *Help_HMSetFontSize(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 94,98 ---- } ! static PyObject *Help_HMSetFontSize(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 123,129 **** } ! static PyObject *Help_HMGetFont(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 109,113 ---- } ! static PyObject *Help_HMGetFont(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 139,145 **** } ! static PyObject *Help_HMGetFontSize(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 123,127 ---- } ! static PyObject *Help_HMGetFontSize(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 155,161 **** } ! static PyObject *Help_HMSetDialogResID(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 137,141 ---- } ! static PyObject *Help_HMSetDialogResID(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 172,178 **** } ! static PyObject *Help_HMSetMenuResID(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 152,156 ---- } ! static PyObject *Help_HMSetMenuResID(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 192,198 **** } ! static PyObject *Help_HMScanTemplateItems(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 170,174 ---- } ! static PyObject *Help_HMScanTemplateItems(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 215,221 **** } ! static PyObject *Help_HMGetDialogResID(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 191,195 ---- } ! static PyObject *Help_HMGetDialogResID(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 231,237 **** } ! static PyObject *Help_HMGetMenuResID(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 205,209 ---- } ! static PyObject *Help_HMGetMenuResID(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 250,256 **** } ! static PyObject *Help_HMGetBalloonWindow(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 222,226 ---- } ! static PyObject *Help_HMGetBalloonWindow(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 303,307 **** ! void initHelp() { PyObject *m; --- 273,277 ---- ! void initHelp(void) { PyObject *m; From jackjansen@users.sourceforge.net Tue May 22 22:52:40 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/icn Icnmodule.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/icn In directory usw-pr-cvs1:/tmp/cvs-serv14202/Python/Mac/Modules/icn Modified Files: Icnmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Icnmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/Icnmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Icnmodule.c 2000/12/10 23:43:42 1.7 --- Icnmodule.c 2001/05/22 21:52:38 1.8 *************** *** 9,19 **** #include "pymactoolbox.h" #include static PyObject *Icn_Error; ! static PyObject *Icn_GetCIcon(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 9,22 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif + static PyObject *Icn_Error; ! static PyObject *Icn_GetCIcon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 29,35 **** } ! static PyObject *Icn_PlotCIcon(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 32,36 ---- } ! static PyObject *Icn_PlotCIcon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 47,53 **** } ! static PyObject *Icn_DisposeCIcon(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 48,52 ---- } ! static PyObject *Icn_DisposeCIcon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 62,68 **** } ! static PyObject *Icn_GetIcon(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 61,65 ---- } ! static PyObject *Icn_GetIcon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 78,84 **** } ! static PyObject *Icn_PlotIcon(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 75,79 ---- } ! static PyObject *Icn_PlotIcon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 96,102 **** } ! static PyObject *Icn_PlotIconID(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 91,95 ---- } ! static PyObject *Icn_PlotIconID(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 122,128 **** } ! static PyObject *Icn_NewIconSuite(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 115,119 ---- } ! static PyObject *Icn_NewIconSuite(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 138,144 **** } ! static PyObject *Icn_AddIconToSuite(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 129,133 ---- } ! static PyObject *Icn_AddIconToSuite(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 161,167 **** } ! static PyObject *Icn_GetIconFromSuite(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 150,154 ---- } ! static PyObject *Icn_GetIconFromSuite(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 183,189 **** } ! static PyObject *Icn_GetIconSuite(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 170,174 ---- } ! static PyObject *Icn_GetIconSuite(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 205,211 **** } ! static PyObject *Icn_DisposeIconSuite(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 190,194 ---- } ! static PyObject *Icn_DisposeIconSuite(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 225,231 **** } ! static PyObject *Icn_PlotIconSuite(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 208,212 ---- } ! static PyObject *Icn_PlotIconSuite(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 251,257 **** } ! static PyObject *Icn_LoadIconCache(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 232,236 ---- } ! static PyObject *Icn_LoadIconCache(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 277,283 **** } ! static PyObject *Icn_GetLabel(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 256,260 ---- } ! static PyObject *Icn_GetLabel(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 299,305 **** } ! static PyObject *Icn_PtInIconID(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 276,280 ---- } ! static PyObject *Icn_PtInIconID(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 324,330 **** } ! static PyObject *Icn_PtInIconSuite(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 299,303 ---- } ! static PyObject *Icn_PtInIconSuite(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 349,355 **** } ! static PyObject *Icn_RectInIconID(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 322,326 ---- } ! static PyObject *Icn_RectInIconID(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 374,380 **** } ! static PyObject *Icn_RectInIconSuite(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 345,349 ---- } ! static PyObject *Icn_RectInIconSuite(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 399,405 **** } ! static PyObject *Icn_IconIDToRgn(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 368,372 ---- } ! static PyObject *Icn_IconIDToRgn(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 425,431 **** } ! static PyObject *Icn_IconSuiteToRgn(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 392,396 ---- } ! static PyObject *Icn_IconSuiteToRgn(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 451,457 **** } ! static PyObject *Icn_SetSuiteLabel(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 416,420 ---- } ! static PyObject *Icn_SetSuiteLabel(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 471,477 **** } ! static PyObject *Icn_GetSuiteLabel(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 434,438 ---- } ! static PyObject *Icn_GetSuiteLabel(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 487,493 **** } ! static PyObject *Icn_PlotIconHandle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 448,452 ---- } ! static PyObject *Icn_PlotIconHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 513,519 **** } ! static PyObject *Icn_PlotSICNHandle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 472,476 ---- } ! static PyObject *Icn_PlotSICNHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 539,545 **** } ! static PyObject *Icn_PlotCIconHandle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 496,500 ---- } ! static PyObject *Icn_PlotCIconHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 567,573 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Icn_IconServicesTerminate(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 522,526 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Icn_IconServicesTerminate(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 581,587 **** #endif ! static PyObject *Icn_IconRefToIconFamily(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 534,538 ---- #endif ! static PyObject *Icn_IconRefToIconFamily(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 603,609 **** } ! static PyObject *Icn_IconFamilyToIconSuite(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 554,558 ---- } ! static PyObject *Icn_IconFamilyToIconSuite(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 625,631 **** } ! static PyObject *Icn_IconSuiteToIconFamily(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 574,578 ---- } ! static PyObject *Icn_IconSuiteToIconFamily(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 647,653 **** } ! static PyObject *Icn_SetIconFamilyData(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 594,598 ---- } ! static PyObject *Icn_SetIconFamilyData(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 670,676 **** } ! static PyObject *Icn_GetIconFamilyData(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 615,619 ---- } ! static PyObject *Icn_GetIconFamilyData(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 693,699 **** } ! static PyObject *Icn_GetIconRefOwners(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 636,640 ---- } ! static PyObject *Icn_GetIconRefOwners(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 712,718 **** } ! static PyObject *Icn_AcquireIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 653,657 ---- } ! static PyObject *Icn_AcquireIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 729,735 **** } ! static PyObject *Icn_ReleaseIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 668,672 ---- } ! static PyObject *Icn_ReleaseIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 746,752 **** } ! static PyObject *Icn_GetIconRefFromFile(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 683,687 ---- } ! static PyObject *Icn_GetIconRefFromFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 768,774 **** } ! static PyObject *Icn_GetIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 703,707 ---- } ! static PyObject *Icn_GetIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 793,799 **** } ! static PyObject *Icn_GetIconRefFromFolder(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 726,730 ---- } ! static PyObject *Icn_GetIconRefFromFolder(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 824,830 **** } ! static PyObject *Icn_RegisterIconRefFromIconFamily(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 755,759 ---- } ! static PyObject *Icn_RegisterIconRefFromIconFamily(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 849,855 **** } ! static PyObject *Icn_RegisterIconRefFromResource(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 778,782 ---- } ! static PyObject *Icn_RegisterIconRefFromResource(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 877,883 **** } ! static PyObject *Icn_UnregisterIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 804,808 ---- } ! static PyObject *Icn_UnregisterIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 897,903 **** } ! static PyObject *Icn_UpdateIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 822,826 ---- } ! static PyObject *Icn_UpdateIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 914,920 **** } ! static PyObject *Icn_OverrideIconRefFromResource(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 837,841 ---- } ! static PyObject *Icn_OverrideIconRefFromResource(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 937,943 **** } ! static PyObject *Icn_OverrideIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 858,862 ---- } ! static PyObject *Icn_OverrideIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 957,963 **** } ! static PyObject *Icn_RemoveIconRefOverride(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 876,880 ---- } ! static PyObject *Icn_RemoveIconRefOverride(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 974,980 **** } ! static PyObject *Icn_CompositeIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 891,895 ---- } ! static PyObject *Icn_CompositeIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 996,1002 **** } ! static PyObject *Icn_IsIconRefComposite(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 911,915 ---- } ! static PyObject *Icn_IsIconRefComposite(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1018,1024 **** } ! static PyObject *Icn_IsValidIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 931,935 ---- } ! static PyObject *Icn_IsValidIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1034,1040 **** } ! static PyObject *Icn_PlotIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 945,949 ---- } ! static PyObject *Icn_PlotIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1063,1069 **** } ! static PyObject *Icn_PtInIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 972,976 ---- } ! static PyObject *Icn_PtInIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1091,1097 **** } ! static PyObject *Icn_RectInIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 998,1002 ---- } ! static PyObject *Icn_RectInIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1119,1125 **** } ! static PyObject *Icn_IconRefToRgn(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1024,1028 ---- } ! static PyObject *Icn_IconRefToRgn(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1148,1154 **** } ! static PyObject *Icn_GetIconSizesFromIconRef(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1051,1055 ---- } ! static PyObject *Icn_GetIconSizesFromIconRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1173,1179 **** } ! static PyObject *Icn_FlushIconRefs(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1074,1078 ---- } ! static PyObject *Icn_FlushIconRefs(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1193,1199 **** } ! static PyObject *Icn_FlushIconRefsByVolume(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1092,1096 ---- } ! static PyObject *Icn_FlushIconRefsByVolume(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1210,1216 **** } ! static PyObject *Icn_SetCustomIconsEnabled(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1107,1111 ---- } ! static PyObject *Icn_SetCustomIconsEnabled(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1230,1236 **** } ! static PyObject *Icn_GetCustomIconsEnabled(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1125,1129 ---- } ! static PyObject *Icn_GetCustomIconsEnabled(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1249,1255 **** } ! static PyObject *Icn_IsIconRefMaskEmpty(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1142,1146 ---- } ! static PyObject *Icn_IsIconRefMaskEmpty(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1267,1273 **** #if TARGET_API_MAC_CARBON ! static PyObject *Icn_GetIconRefVariant(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1158,1162 ---- #if TARGET_API_MAC_CARBON ! static PyObject *Icn_GetIconRefVariant(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1292,1298 **** #if TARGET_API_MAC_CARBON ! static PyObject *Icn_RegisterIconRefFromIconFile(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1181,1185 ---- #if TARGET_API_MAC_CARBON ! static PyObject *Icn_RegisterIconRefFromIconFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1320,1326 **** #if TARGET_API_MAC_CARBON ! static PyObject *Icn_ReadIconFile(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1207,1211 ---- #if TARGET_API_MAC_CARBON ! static PyObject *Icn_ReadIconFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1342,1348 **** #if TARGET_API_MAC_CARBON ! static PyObject *Icn_WriteIconFile(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1227,1231 ---- #if TARGET_API_MAC_CARBON ! static PyObject *Icn_WriteIconFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1507,1511 **** ! void initIcn() { PyObject *m; --- 1390,1394 ---- ! void initIcn(void) { PyObject *m; From jackjansen@users.sourceforge.net Tue May 22 22:52:44 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/icn icnsupport.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/icn In directory usw-pr-cvs1:/tmp/cvs-serv14231/Python/Mac/Modules/icn Modified Files: icnsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: icnsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/icnsupport.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** icnsupport.py 2000/07/14 22:16:40 1.4 --- icnsupport.py 2001/05/22 21:52:42 1.5 *************** *** 47,51 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ """ --- 47,56 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif ! """ From jackjansen@users.sourceforge.net Tue May 22 22:53:10 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:53:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/menu Menumodule.c,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory usw-pr-cvs1:/tmp/cvs-serv14316/Python/Mac/Modules/menu Modified Files: Menumodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Menumodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/Menumodule.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** Menumodule.c 2001/05/17 21:56:18 1.26 --- Menumodule.c 2001/05/22 21:53:08 1.27 *************** *** 9,14 **** --- 9,19 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include /* Defines OpenDeskAcc in universal headers */ #include + #else + #include + #endif + [...1943 lines suppressed...] ! void initMenu(void) { PyObject *m; *************** *** 2790,2795 **** ! PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuObj_Convert); --- 2539,2544 ---- ! PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:53:15 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:53:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/menu menusupport.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory usw-pr-cvs1:/tmp/cvs-serv14389/Python/Mac/Modules/menu Modified Files: menusupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: menusupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/menusupport.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** menusupport.py 2001/05/17 21:56:22 1.10 --- menusupport.py 2001/05/22 21:53:13 1.11 *************** *** 37,42 **** includestuff = includestuff + """ #include /* Defines OpenDeskAcc in universal headers */ ! #include <%s>""" % MACHEADERFILE + """ #ifdef USE_TOOLBOX_OBJECT_GLUE --- 37,47 ---- includestuff = includestuff + """ + #ifdef WITHOUT_FRAMEWORKS #include /* Defines OpenDeskAcc in universal headers */ ! #include ! #else ! #include ! #endif ! #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 64,69 **** initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuObj_Convert); """ --- 69,74 ---- initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(MenuHandle, MenuObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MenuHandle, MenuObj_Convert); """ From jackjansen@users.sourceforge.net Tue May 22 22:52:00 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/dlg dlgsupport.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/dlg In directory usw-pr-cvs1:/tmp/cvs-serv13961/Python/Mac/Modules/dlg Modified Files: dlgsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: dlgsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/dlg/dlgsupport.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** dlgsupport.py 2001/05/17 21:55:08 1.23 --- dlgsupport.py 2001/05/22 21:51:58 1.24 *************** *** 32,36 **** --- 32,41 ---- includestuff = includestuff + """ + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif + #ifdef USE_TOOLBOX_OBJECT_GLUE extern PyObject *_DlgObj_New(DialogRef); *************** *** 151,156 **** #if 0 WindowPtr ! DlgObj_ConvertToWindow(self) ! PyObject *self; { if ( DlgObj_Check(self) ) --- 156,160 ---- #if 0 WindowPtr ! DlgObj_ConvertToWindow(PyObject *self) { if ( DlgObj_Check(self) ) *************** *** 162,167 **** PyObject * ! DlgObj_WhichDialog(d) ! DialogPtr d; { PyObject *it; --- 166,170 ---- PyObject * ! DlgObj_WhichDialog(DialogPtr d) { PyObject *it; *************** *** 192,198 **** initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DlgObj_WhichDialog); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DlgObj_Convert); """ --- 195,201 ---- initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DialogPtr, DlgObj_WhichDialog); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DialogPtr, DlgObj_Convert); """ *************** *** 220,227 **** def outputCompare(self): Output() ! Output("static int %s_compare(self, other)", self.prefix) ! IndentLevel() ! Output("%s *self, *other;", self.objecttype) ! DedentLevel() OutLbrace() Output("if ( self->ob_itself > other->ob_itself ) return 1;") --- 223,227 ---- def outputCompare(self): Output() ! Output("static int %s_compare(%s *self, %s *other)", self.prefix, self.objecttype, self.objecttype) OutLbrace() Output("if ( self->ob_itself > other->ob_itself ) return 1;") *************** *** 232,239 **** def outputHash(self): Output() ! Output("static int %s_hash(self)", self.prefix) ! IndentLevel() ! Output("%s *self;", self.objecttype) ! DedentLevel() OutLbrace() Output("return (int)self->ob_itself;") --- 232,236 ---- def outputHash(self): Output() ! Output("static int %s_hash(%s *self)", self.prefix, self.objecttype) OutLbrace() Output("return (int)self->ob_itself;") *************** *** 294,298 **** } else { Py_INCREF(new); ! _res = Py_BuildValue("O&", ResObj_New, (Handle)NewUserItemProc(Dlg_UnivUserItemProc)); } --- 291,295 ---- } else { Py_INCREF(new); ! _res = Py_BuildValue("O&", ResObj_New, (Handle)NewUserItemUPP(Dlg_UnivUserItemProc)); } From jackjansen@users.sourceforge.net Tue May 22 22:52:06 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:06 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/drag Dragmodule.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory usw-pr-cvs1:/tmp/cvs-serv14014/Python/Mac/Modules/drag Modified Files: Dragmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Dragmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/Dragmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Dragmodule.c 2001/05/17 21:55:17 1.7 --- Dragmodule.c 2001/05/22 21:52:04 1.8 *************** *** 9,13 **** --- 9,17 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif /* Callback glue routines */ *************** *** 42,47 **** } DragObjObject; ! PyObject *DragObj_New(itself) ! DragRef itself; { DragObjObject *it; --- 46,50 ---- } DragObjObject; ! PyObject *DragObj_New(DragRef itself) { DragObjObject *it; *************** *** 56,62 **** return (PyObject *)it; } ! DragObj_Convert(v, p_itself) ! PyObject *v; ! DragRef *p_itself; { if (!DragObj_Check(v)) --- 59,63 ---- return (PyObject *)it; } ! DragObj_Convert(PyObject *v, DragRef *p_itself) { if (!DragObj_Check(v)) *************** *** 69,74 **** } ! static void DragObj_dealloc(self) ! DragObjObject *self; { Py_XDECREF(self->sendproc); --- 70,74 ---- } ! static void DragObj_dealloc(DragObjObject *self) { Py_XDECREF(self->sendproc); *************** *** 76,82 **** } ! static PyObject *DragObj_DisposeDrag(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 76,80 ---- } ! static PyObject *DragObj_DisposeDrag(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 91,97 **** } ! static PyObject *DragObj_AddDragItemFlavor(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 89,93 ---- } ! static PyObject *DragObj_AddDragItemFlavor(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 122,128 **** } ! static PyObject *DragObj_SetDragItemFlavorData(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 118,122 ---- } ! static PyObject *DragObj_SetDragItemFlavorData(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 153,159 **** } ! static PyObject *DragObj_SetDragImage(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 147,151 ---- } ! static PyObject *DragObj_SetDragImage(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 180,186 **** } ! static PyObject *DragObj_ChangeDragBehaviors(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 172,176 ---- } ! static PyObject *DragObj_ChangeDragBehaviors(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 201,207 **** } ! static PyObject *DragObj_TrackDrag(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 191,195 ---- } ! static PyObject *DragObj_TrackDrag(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 222,228 **** } ! static PyObject *DragObj_CountDragItems(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 210,214 ---- } ! static PyObject *DragObj_CountDragItems(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 239,245 **** } ! static PyObject *DragObj_GetDragItemReferenceNumber(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 225,229 ---- } ! static PyObject *DragObj_GetDragItemReferenceNumber(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 259,265 **** } ! static PyObject *DragObj_CountDragItemFlavors(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 243,247 ---- } ! static PyObject *DragObj_CountDragItemFlavors(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 279,285 **** } ! static PyObject *DragObj_GetFlavorType(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 261,265 ---- } ! static PyObject *DragObj_GetFlavorType(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 302,308 **** } ! static PyObject *DragObj_GetFlavorFlags(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 282,286 ---- } ! static PyObject *DragObj_GetFlavorFlags(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 325,331 **** } ! static PyObject *DragObj_GetFlavorDataSize(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 303,307 ---- } ! static PyObject *DragObj_GetFlavorDataSize(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 348,354 **** } ! static PyObject *DragObj_GetFlavorData(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 324,328 ---- } ! static PyObject *DragObj_GetFlavorData(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 385,391 **** } ! static PyObject *DragObj_GetDragItemBounds(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 359,363 ---- } ! static PyObject *DragObj_GetDragItemBounds(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 405,411 **** } ! static PyObject *DragObj_SetDragItemBounds(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 377,381 ---- } ! static PyObject *DragObj_SetDragItemBounds(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 426,432 **** } ! static PyObject *DragObj_GetDropLocation(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 396,400 ---- } ! static PyObject *DragObj_GetDropLocation(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 443,449 **** } ! static PyObject *DragObj_SetDropLocation(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 411,415 ---- } ! static PyObject *DragObj_SetDropLocation(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 461,467 **** } ! static PyObject *DragObj_GetDragAttributes(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 427,431 ---- } ! static PyObject *DragObj_GetDragAttributes(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 478,484 **** } ! static PyObject *DragObj_GetDragMouse(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 442,446 ---- } ! static PyObject *DragObj_GetDragMouse(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 498,504 **** } ! static PyObject *DragObj_SetDragMouse(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 460,464 ---- } ! static PyObject *DragObj_SetDragMouse(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 516,522 **** } ! static PyObject *DragObj_GetDragOrigin(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 476,480 ---- } ! static PyObject *DragObj_GetDragOrigin(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 533,539 **** } ! static PyObject *DragObj_GetDragModifiers(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 491,495 ---- } ! static PyObject *DragObj_GetDragModifiers(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 556,562 **** } ! static PyObject *DragObj_ShowDragHilite(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 512,516 ---- } ! static PyObject *DragObj_ShowDragHilite(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 577,583 **** } ! static PyObject *DragObj_HideDragHilite(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 531,535 ---- } ! static PyObject *DragObj_HideDragHilite(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 592,598 **** } ! static PyObject *DragObj_DragPreScroll(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 544,548 ---- } ! static PyObject *DragObj_DragPreScroll(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 613,619 **** } ! static PyObject *DragObj_DragPostScroll(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 563,567 ---- } ! static PyObject *DragObj_DragPostScroll(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 628,634 **** } ! static PyObject *DragObj_UpdateDragHilite(_self, _args) ! DragObjObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 576,580 ---- } ! static PyObject *DragObj_UpdateDragHilite(DragObjObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 706,712 **** PyMethodChain DragObj_chain = { DragObj_methods, NULL }; ! static PyObject *DragObj_getattr(self, name) ! DragObjObject *self; ! char *name; { return Py_FindMethodInChain(&DragObj_chain, (PyObject *)self, name); --- 652,656 ---- PyMethodChain DragObj_chain = { DragObj_methods, NULL }; ! static PyObject *DragObj_getattr(DragObjObject *self, char *name) { return Py_FindMethodInChain(&DragObj_chain, (PyObject *)self, name); *************** *** 743,749 **** ! static PyObject *Drag_NewDrag(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 687,691 ---- ! static PyObject *Drag_NewDrag(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 759,765 **** } ! static PyObject *Drag_GetDragHiliteColor(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 701,705 ---- } ! static PyObject *Drag_GetDragHiliteColor(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 778,784 **** } ! static PyObject *Drag_WaitMouseMoved(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 718,722 ---- } ! static PyObject *Drag_WaitMouseMoved(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 794,800 **** } ! static PyObject *Drag_ZoomRects(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 732,736 ---- } ! static PyObject *Drag_ZoomRects(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 820,826 **** } ! static PyObject *Drag_ZoomRegion(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 756,760 ---- } ! static PyObject *Drag_ZoomRegion(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 846,852 **** } ! static PyObject *Drag_InstallTrackingHandler(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 780,784 ---- } ! static PyObject *Drag_InstallTrackingHandler(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 866,872 **** } ! static PyObject *Drag_InstallReceiveHandler(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 798,802 ---- } ! static PyObject *Drag_InstallReceiveHandler(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 886,892 **** } ! static PyObject *Drag_RemoveTrackingHandler(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 816,820 ---- } ! static PyObject *Drag_RemoveTrackingHandler(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 904,910 **** } ! static PyObject *Drag_RemoveReceiveHandler(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 832,836 ---- } ! static PyObject *Drag_RemoveReceiveHandler(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1042,1046 **** ! void initDrag() { PyObject *m; --- 968,972 ---- ! void initDrag(void) { PyObject *m; *************** *** 1049,1054 **** ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DragObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragObj_Convert); --- 975,980 ---- ! PyMac_INIT_TOOLBOX_OBJECT_NEW(DragRef, DragObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(DragRef, DragObj_Convert); *************** *** 1064,1073 **** Py_FatalError("can't initialize DragObjType"); ! dragglue_TrackingHandlerUPP = NewDragTrackingHandlerProc(dragglue_TrackingHandler); ! dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerProc(dragglue_ReceiveHandler); ! dragglue_SendDataUPP = NewDragSendDataProc(dragglue_SendData); #if 0 ! dragglue_InputUPP = NewDragInputProc(dragglue_Input); ! dragglue_DrawingUPP = NewDragDrawingProc(dragglue_Drawing); #endif --- 990,999 ---- Py_FatalError("can't initialize DragObjType"); ! dragglue_TrackingHandlerUPP = NewDragTrackingHandlerUPP(dragglue_TrackingHandler); ! dragglue_ReceiveHandlerUPP = NewDragReceiveHandlerUPP(dragglue_ReceiveHandler); ! dragglue_SendDataUPP = NewDragSendDataUPP(dragglue_SendData); #if 0 ! dragglue_InputUPP = NewDragInputUPP(dragglue_Input); ! dragglue_DrawingUPP = NewDragDrawingUPP(dragglue_Drawing); #endif From jackjansen@users.sourceforge.net Tue May 22 22:52:15 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:15 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/evt Evtmodule.c,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/evt In directory usw-pr-cvs1:/tmp/cvs-serv14080/Python/Mac/Modules/evt Modified Files: Evtmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Evtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/evt/Evtmodule.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** Evtmodule.c 2000/12/10 23:43:39 1.18 --- Evtmodule.c 2001/05/22 21:52:13 1.19 *************** *** 9,19 **** #include "pymactoolbox.h" #include static PyObject *Evt_Error; ! static PyObject *Evt_GetMouse(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 9,22 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif + static PyObject *Evt_Error; ! static PyObject *Evt_GetMouse(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 27,33 **** } ! static PyObject *Evt_Button(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 30,34 ---- } ! static PyObject *Evt_Button(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 41,47 **** } ! static PyObject *Evt_StillDown(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 42,46 ---- } ! static PyObject *Evt_StillDown(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 55,61 **** } ! static PyObject *Evt_WaitMouseUp(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 54,58 ---- } ! static PyObject *Evt_WaitMouseUp(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 69,75 **** } ! static PyObject *Evt_TickCount(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 66,70 ---- } ! static PyObject *Evt_TickCount(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 83,89 **** } ! static PyObject *Evt_GetCaretTime(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 78,82 ---- } ! static PyObject *Evt_GetCaretTime(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 97,103 **** } ! static PyObject *Evt_GetKeys(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 90,94 ---- } ! static PyObject *Evt_GetKeys(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 112,118 **** } ! static PyObject *Evt_GetDblTime(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 103,107 ---- } ! static PyObject *Evt_GetDblTime(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 126,132 **** } ! static PyObject *Evt_SetEventMask(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 115,119 ---- } ! static PyObject *Evt_SetEventMask(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 141,147 **** } ! static PyObject *Evt_GetNextEvent(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 128,132 ---- } ! static PyObject *Evt_GetNextEvent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 160,166 **** } ! static PyObject *Evt_EventAvail(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 145,149 ---- } ! static PyObject *Evt_EventAvail(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 179,185 **** } ! static PyObject *Evt_PostEvent(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 162,166 ---- } ! static PyObject *Evt_PostEvent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 201,207 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Evt_OSEventAvail(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 182,186 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Evt_OSEventAvail(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 223,229 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Evt_GetOSEvent(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 202,206 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Evt_GetOSEvent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 243,249 **** #endif ! static PyObject *Evt_FlushEvents(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 220,224 ---- #endif ! static PyObject *Evt_FlushEvents(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 263,269 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Evt_SystemClick(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 238,242 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Evt_SystemClick(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 284,290 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Evt_SystemTask(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 257,261 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Evt_SystemTask(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 300,306 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Evt_SystemEvent(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 271,275 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Evt_SystemEvent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 319,325 **** #if TARGET_API_MAC_CARBON ! static PyObject *Evt_GetGlobalMouse(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 288,292 ---- #if TARGET_API_MAC_CARBON ! static PyObject *Evt_GetGlobalMouse(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 336,342 **** #if TARGET_API_MAC_CARBON ! static PyObject *Evt_GetCurrentKeyModifiers(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 303,307 ---- #if TARGET_API_MAC_CARBON ! static PyObject *Evt_GetCurrentKeyModifiers(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 353,359 **** #if TARGET_API_MAC_CARBON ! static PyObject *Evt_CheckEventQueueForUserCancel(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 318,322 ---- #if TARGET_API_MAC_CARBON ! static PyObject *Evt_CheckEventQueueForUserCancel(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 368,374 **** #endif ! static PyObject *Evt_WaitNextEvent(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 331,335 ---- #endif ! static PyObject *Evt_WaitNextEvent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 471,475 **** ! void initEvt() { PyObject *m; --- 432,436 ---- ! void initEvt(void) { PyObject *m; From jackjansen@users.sourceforge.net Tue May 22 22:52:24 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/fm Fmmodule.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/fm In directory usw-pr-cvs1:/tmp/cvs-serv14119/Python/Mac/Modules/fm Modified Files: Fmmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Fmmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/fm/Fmmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Fmmodule.c 2000/12/10 23:43:41 1.7 --- Fmmodule.c 2001/05/22 21:52:22 1.8 *************** *** 9,13 **** --- 9,18 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif + /* *************** *** 15,20 **** */ static PyObject * ! FMRec_New(itself) ! FMetricRec *itself; { --- 20,24 ---- */ static PyObject * ! FMRec_New(FMetricRec *itself) { *************** *** 30,36 **** /* Not needed... */ static int ! FMRec_Convert(v, p_itself) ! PyObject *v; ! FMetricRec *p_itself; { return PyArg_ParseTuple(v, "O&O&O&O&O&", --- 34,38 ---- /* Not needed... */ static int ! FMRec_Convert(PyObject *v, FMetricRec *p_itself) { return PyArg_ParseTuple(v, "O&O&O&O&O&", *************** *** 48,54 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Fm_InitFonts(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 50,54 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Fm_InitFonts(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 62,68 **** #endif ! static PyObject *Fm_GetFontName(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 62,66 ---- #endif ! static PyObject *Fm_GetFontName(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 79,85 **** } ! static PyObject *Fm_GetFNum(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 77,81 ---- } ! static PyObject *Fm_GetFNum(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 96,102 **** } ! static PyObject *Fm_RealFont(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 92,96 ---- } ! static PyObject *Fm_RealFont(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 117,123 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Fm_SetFontLock(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 111,115 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Fm_SetFontLock(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 133,139 **** #endif ! static PyObject *Fm_SetFScaleDisable(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 125,129 ---- #endif ! static PyObject *Fm_SetFScaleDisable(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 148,154 **** } ! static PyObject *Fm_FontMetrics(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 138,142 ---- } ! static PyObject *Fm_FontMetrics(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 162,168 **** } ! static PyObject *Fm_SetFractEnable(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 150,154 ---- } ! static PyObject *Fm_SetFractEnable(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 177,183 **** } ! static PyObject *Fm_GetDefFontSize(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 163,167 ---- } ! static PyObject *Fm_GetDefFontSize(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 191,197 **** } ! static PyObject *Fm_IsOutline(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 175,179 ---- } ! static PyObject *Fm_IsOutline(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 210,216 **** } ! static PyObject *Fm_SetOutlinePreferred(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 192,196 ---- } ! static PyObject *Fm_SetOutlinePreferred(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 225,231 **** } ! static PyObject *Fm_GetOutlinePreferred(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 205,209 ---- } ! static PyObject *Fm_GetOutlinePreferred(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 239,245 **** } ! static PyObject *Fm_SetPreserveGlyph(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 217,221 ---- } ! static PyObject *Fm_SetPreserveGlyph(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 254,260 **** } ! static PyObject *Fm_GetPreserveGlyph(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 230,234 ---- } ! static PyObject *Fm_GetPreserveGlyph(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 270,276 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Fm_FlushFonts(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 244,248 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Fm_FlushFonts(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 286,292 **** #endif ! static PyObject *Fm_GetSysFont(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 258,262 ---- #endif ! static PyObject *Fm_GetSysFont(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 300,306 **** } ! static PyObject *Fm_GetAppFont(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 270,274 ---- } ! static PyObject *Fm_GetAppFont(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 314,320 **** } ! static PyObject *Fm_SetAntiAliasedTextEnabled(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 282,286 ---- } ! static PyObject *Fm_SetAntiAliasedTextEnabled(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 334,340 **** } ! static PyObject *Fm_IsAntiAliasedTextEnabled(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 300,304 ---- } ! static PyObject *Fm_IsAntiAliasedTextEnabled(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 404,408 **** ! void initFm() { PyObject *m; --- 368,372 ---- ! void initFm(void) { PyObject *m; From jackjansen@users.sourceforge.net Tue May 22 22:52:51 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/list Listmodule.c,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/list In directory usw-pr-cvs1:/tmp/cvs-serv14271/Python/Mac/Modules/list Modified Files: Listmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Listmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/Listmodule.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** Listmodule.c 2001/05/17 21:56:02 1.14 --- Listmodule.c 2001/05/22 21:52:49 1.15 *************** *** 9,14 **** #include "pymactoolbox.h" #include ! #ifdef USE_TOOLBOX_OBJECT_GLUE --- 9,17 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include ! #else ! #include ! #endif #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 62,67 **** } ListObject; ! PyObject *ListObj_New(itself) ! ListHandle itself; { ListObject *it; --- 65,69 ---- } ListObject; ! PyObject *ListObj_New(ListHandle itself) { ListObject *it; *************** *** 76,82 **** return (PyObject *)it; } ! ListObj_Convert(v, p_itself) ! PyObject *v; ! ListHandle *p_itself; { if (!ListObj_Check(v)) --- 78,82 ---- return (PyObject *)it; } ! ListObj_Convert(PyObject *v, ListHandle *p_itself) { if (!ListObj_Check(v)) *************** *** 89,94 **** } ! static void ListObj_dealloc(self) ! ListObject *self; { if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself); --- 89,93 ---- } ! static void ListObj_dealloc(ListObject *self) { if (self->ob_must_be_disposed && self->ob_itself) LDispose(self->ob_itself); *************** *** 96,102 **** } ! static PyObject *ListObj_LAddColumn(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 95,99 ---- } ! static PyObject *ListObj_LAddColumn(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 116,122 **** } ! static PyObject *ListObj_LAddRow(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 113,117 ---- } ! static PyObject *ListObj_LAddRow(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 136,142 **** } ! static PyObject *ListObj_LDelColumn(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 131,135 ---- } ! static PyObject *ListObj_LDelColumn(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 155,161 **** } ! static PyObject *ListObj_LDelRow(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 148,152 ---- } ! static PyObject *ListObj_LDelRow(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 174,180 **** } ! static PyObject *ListObj_LGetSelect(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 165,169 ---- } ! static PyObject *ListObj_LGetSelect(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 195,201 **** } ! static PyObject *ListObj_LLastClick(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 184,188 ---- } ! static PyObject *ListObj_LLastClick(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 209,215 **** } ! static PyObject *ListObj_LNextCell(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 196,200 ---- } ! static PyObject *ListObj_LNextCell(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 233,239 **** } ! static PyObject *ListObj_LSize(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 218,222 ---- } ! static PyObject *ListObj_LSize(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 252,258 **** } ! static PyObject *ListObj_LSetDrawingMode(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 235,239 ---- } ! static PyObject *ListObj_LSetDrawingMode(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 268,274 **** } ! static PyObject *ListObj_LScroll(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 249,253 ---- } ! static PyObject *ListObj_LScroll(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 287,293 **** } ! static PyObject *ListObj_LAutoScroll(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 266,270 ---- } ! static PyObject *ListObj_LAutoScroll(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 300,306 **** } ! static PyObject *ListObj_LUpdate(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 277,281 ---- } ! static PyObject *ListObj_LUpdate(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 316,322 **** } ! static PyObject *ListObj_LActivate(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 291,295 ---- } ! static PyObject *ListObj_LActivate(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 332,338 **** } ! static PyObject *ListObj_LCellSize(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 305,309 ---- } ! static PyObject *ListObj_LCellSize(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 348,354 **** } ! static PyObject *ListObj_LClick(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 319,323 ---- } ! static PyObject *ListObj_LClick(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 368,374 **** } ! static PyObject *ListObj_LAddToCell(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 337,341 ---- } ! static PyObject *ListObj_LAddToCell(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 391,397 **** } ! static PyObject *ListObj_LClrCell(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 358,362 ---- } ! static PyObject *ListObj_LClrCell(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 407,413 **** } ! static PyObject *ListObj_LGetCell(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 372,376 ---- } ! static PyObject *ListObj_LGetCell(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 436,442 **** } ! static PyObject *ListObj_LRect(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 399,403 ---- } ! static PyObject *ListObj_LRect(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 454,460 **** } ! static PyObject *ListObj_LSetCell(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 415,419 ---- } ! static PyObject *ListObj_LSetCell(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 477,483 **** } ! static PyObject *ListObj_LSetSelect(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 436,440 ---- } ! static PyObject *ListObj_LSetSelect(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 496,502 **** } ! static PyObject *ListObj_LDraw(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 453,457 ---- } ! static PyObject *ListObj_LDraw(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 512,518 **** } ! static PyObject *ListObj_as_Resource(_self, _args) ! ListObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 467,471 ---- } ! static PyObject *ListObj_as_Resource(ListObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 578,584 **** PyMethodChain ListObj_chain = { ListObj_methods, NULL }; ! static PyObject *ListObj_getattr(self, name) ! ListObject *self; ! char *name; { { --- 531,535 ---- PyMethodChain ListObj_chain = { ListObj_methods, NULL }; ! static PyObject *ListObj_getattr(ListObject *self, char *name) { { *************** *** 593,600 **** static int ! ListObj_setattr(self, name, value) ! ListObject *self; ! char *name; ! PyObject *value; { long intval; --- 544,548 ---- static int ! ListObj_setattr(ListObject *self, char *name, PyObject *value) { long intval; *************** *** 644,650 **** ! static PyObject *List_LNew(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 592,596 ---- ! static PyObject *List_LNew(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 684,690 **** } ! static PyObject *List_GetListPort(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 630,634 ---- } ! static PyObject *List_GetListPort(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 700,706 **** } ! static PyObject *List_GetListVerticalScrollBar(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 644,648 ---- } ! static PyObject *List_GetListVerticalScrollBar(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 716,722 **** } ! static PyObject *List_GetListHorizontalScrollBar(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 658,662 ---- } ! static PyObject *List_GetListHorizontalScrollBar(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 732,738 **** } ! static PyObject *List_GetListActive(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 672,676 ---- } ! static PyObject *List_GetListActive(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 748,754 **** } ! static PyObject *List_GetListClickTime(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 686,690 ---- } ! static PyObject *List_GetListClickTime(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 764,770 **** } ! static PyObject *List_GetListRefCon(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 700,704 ---- } ! static PyObject *List_GetListRefCon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 780,786 **** } ! static PyObject *List_GetListDefinition(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 714,718 ---- } ! static PyObject *List_GetListDefinition(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 796,802 **** } ! static PyObject *List_GetListUserHandle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 728,732 ---- } ! static PyObject *List_GetListUserHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 812,818 **** } ! static PyObject *List_GetListDataHandle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 742,746 ---- } ! static PyObject *List_GetListDataHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 828,834 **** } ! static PyObject *List_GetListFlags(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 756,760 ---- } ! static PyObject *List_GetListFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 844,850 **** } ! static PyObject *List_GetListSelectionFlags(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 770,774 ---- } ! static PyObject *List_GetListSelectionFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 860,866 **** } ! static PyObject *List_SetListViewBounds(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 784,788 ---- } ! static PyObject *List_SetListViewBounds(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 878,884 **** } ! static PyObject *List_SetListPort(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 800,804 ---- } ! static PyObject *List_SetListPort(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 896,902 **** } ! static PyObject *List_SetListCellIndent(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 816,820 ---- } ! static PyObject *List_SetListCellIndent(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 914,920 **** } ! static PyObject *List_SetListClickTime(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 832,836 ---- } ! static PyObject *List_SetListClickTime(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 932,938 **** } ! static PyObject *List_SetListRefCon(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 848,852 ---- } ! static PyObject *List_SetListRefCon(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 950,956 **** } ! static PyObject *List_SetListUserHandle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 864,868 ---- } ! static PyObject *List_SetListUserHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 968,974 **** } ! static PyObject *List_SetListFlags(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 880,884 ---- } ! static PyObject *List_SetListFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 986,992 **** } ! static PyObject *List_SetListSelectionFlags(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 896,900 ---- } ! static PyObject *List_SetListSelectionFlags(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1004,1010 **** } ! static PyObject *List_as_List(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 912,916 ---- } ! static PyObject *List_as_List(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1069,1073 **** ! void initList() { PyObject *m; --- 975,979 ---- ! void initList(void) { PyObject *m; *************** *** 1076,1081 **** ! PyMac_INIT_TOOLBOX_OBJECT_NEW(ListObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListObj_Convert); --- 982,987 ---- ! PyMac_INIT_TOOLBOX_OBJECT_NEW(ListHandle, ListObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListHandle, ListObj_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:52:55 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:52:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/list listsupport.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/list In directory usw-pr-cvs1:/tmp/cvs-serv14292/Python/Mac/Modules/list Modified Files: listsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: listsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/list/listsupport.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** listsupport.py 2001/05/17 21:56:08 1.8 --- listsupport.py 2001/05/22 21:52:53 1.9 *************** *** 36,41 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ ! #ifdef USE_TOOLBOX_OBJECT_GLUE --- 36,44 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 77,82 **** initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(ListObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListObj_Convert); """ --- 80,85 ---- initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(ListHandle, ListObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ListHandle, ListObj_Convert); """ *************** *** 103,110 **** setattrCode = """ static int ! ListObj_setattr(self, name, value) ! ListObject *self; ! char *name; ! PyObject *value; { long intval; --- 106,110 ---- setattrCode = """ static int ! ListObj_setattr(ListObject *self, char *name, PyObject *value) { long intval; From jackjansen@users.sourceforge.net Tue May 22 22:53:44 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:53:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qd Qdmodule.c,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory usw-pr-cvs1:/tmp/cvs-serv14431/Python/Mac/Modules/qd Modified Files: Qdmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Qdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/Qdmodule.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -r1.38 -r1.39 *** Qdmodule.c 2001/05/17 21:56:43 1.38 --- Qdmodule.c 2001/05/22 21:53:41 1.39 *************** *** 9,13 **** --- 9,17 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif #ifdef USE_TOOLBOX_OBJECT_GLUE [...4418 lines suppressed...] ! PyMac_INIT_TOOLBOX_OBJECT_NEW(BMObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BMObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(QdRGB_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(QdRGB_Convert); --- 5646,5655 ---- ! PyMac_INIT_TOOLBOX_OBJECT_NEW(BitMapPtr, BMObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BitMapPtr, BMObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafPtr, GrafObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafPtr, GrafObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(RGBColorPtr, QdRGB_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(RGBColorPtr, QdRGB_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:53:56 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:53:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qdoffs Qdoffsmodule.c,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qdoffs In directory usw-pr-cvs1:/tmp/cvs-serv14519/Python/Mac/Modules/qdoffs Modified Files: Qdoffsmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Qdoffsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qdoffs/Qdoffsmodule.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Qdoffsmodule.c 2001/05/17 21:56:51 1.7 --- Qdoffsmodule.c 2001/05/22 21:53:54 1.8 *************** *** 9,13 **** --- 9,17 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 35,40 **** } GWorldObject; ! PyObject *GWorldObj_New(itself) ! GWorldPtr itself; { GWorldObject *it; --- 39,43 ---- } GWorldObject; ! PyObject *GWorldObj_New(GWorldPtr itself) { GWorldObject *it; *************** *** 45,51 **** return (PyObject *)it; } ! GWorldObj_Convert(v, p_itself) ! PyObject *v; ! GWorldPtr *p_itself; { if (!GWorldObj_Check(v)) --- 48,52 ---- return (PyObject *)it; } ! GWorldObj_Convert(PyObject *v, GWorldPtr *p_itself) { if (!GWorldObj_Check(v)) *************** *** 58,63 **** } ! static void GWorldObj_dealloc(self) ! GWorldObject *self; { DisposeGWorld(self->ob_itself); --- 59,63 ---- } ! static void GWorldObj_dealloc(GWorldObject *self) { DisposeGWorld(self->ob_itself); *************** *** 65,71 **** } ! static PyObject *GWorldObj_GetGWorldDevice(_self, _args) ! GWorldObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 65,69 ---- } ! static PyObject *GWorldObj_GetGWorldDevice(GWorldObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 79,85 **** } ! static PyObject *GWorldObj_GetGWorldPixMap(_self, _args) ! GWorldObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 77,81 ---- } ! static PyObject *GWorldObj_GetGWorldPixMap(GWorldObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 93,99 **** } ! static PyObject *GWorldObj_as_GrafPtr(_self, _args) ! GWorldObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 89,93 ---- } ! static PyObject *GWorldObj_as_GrafPtr(GWorldObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 119,125 **** PyMethodChain GWorldObj_chain = { GWorldObj_methods, NULL }; ! static PyObject *GWorldObj_getattr(self, name) ! GWorldObject *self; ! char *name; { return Py_FindMethodInChain(&GWorldObj_chain, (PyObject *)self, name); --- 113,117 ---- PyMethodChain GWorldObj_chain = { GWorldObj_methods, NULL }; ! static PyObject *GWorldObj_getattr(GWorldObject *self, char *name) { return Py_FindMethodInChain(&GWorldObj_chain, (PyObject *)self, name); *************** *** 156,162 **** ! static PyObject *Qdoffs_NewGWorld(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 148,152 ---- ! static PyObject *Qdoffs_NewGWorld(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 187,193 **** } ! static PyObject *Qdoffs_LockPixels(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 177,181 ---- } ! static PyObject *Qdoffs_LockPixels(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 203,209 **** } ! static PyObject *Qdoffs_UnlockPixels(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 191,195 ---- } ! static PyObject *Qdoffs_UnlockPixels(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 218,224 **** } ! static PyObject *Qdoffs_UpdateGWorld(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 204,208 ---- } ! static PyObject *Qdoffs_UpdateGWorld(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 249,255 **** } ! static PyObject *Qdoffs_GetGWorld(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 233,237 ---- } ! static PyObject *Qdoffs_GetGWorld(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 266,272 **** } ! static PyObject *Qdoffs_SetGWorld(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 248,252 ---- } ! static PyObject *Qdoffs_SetGWorld(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 284,290 **** } ! static PyObject *Qdoffs_CTabChanged(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 264,268 ---- } ! static PyObject *Qdoffs_CTabChanged(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 299,305 **** } ! static PyObject *Qdoffs_PixPatChanged(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 277,281 ---- } ! static PyObject *Qdoffs_PixPatChanged(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 314,320 **** } ! static PyObject *Qdoffs_PortChanged(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 290,294 ---- } ! static PyObject *Qdoffs_PortChanged(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 329,335 **** } ! static PyObject *Qdoffs_GDeviceChanged(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 303,307 ---- } ! static PyObject *Qdoffs_GDeviceChanged(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 344,350 **** } ! static PyObject *Qdoffs_AllowPurgePixels(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 316,320 ---- } ! static PyObject *Qdoffs_AllowPurgePixels(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 359,365 **** } ! static PyObject *Qdoffs_NoPurgePixels(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 329,333 ---- } ! static PyObject *Qdoffs_NoPurgePixels(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 374,380 **** } ! static PyObject *Qdoffs_GetPixelsState(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 342,346 ---- } ! static PyObject *Qdoffs_GetPixelsState(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 390,396 **** } ! static PyObject *Qdoffs_SetPixelsState(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 356,360 ---- } ! static PyObject *Qdoffs_SetPixelsState(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 408,414 **** } ! static PyObject *Qdoffs_GetPixRowBytes(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 372,376 ---- } ! static PyObject *Qdoffs_GetPixRowBytes(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 424,430 **** } ! static PyObject *Qdoffs_NewScreenBuffer(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 386,390 ---- } ! static PyObject *Qdoffs_NewScreenBuffer(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 449,455 **** } ! static PyObject *Qdoffs_DisposeScreenBuffer(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 409,413 ---- } ! static PyObject *Qdoffs_DisposeScreenBuffer(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 464,470 **** } ! static PyObject *Qdoffs_QDDone(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 422,426 ---- } ! static PyObject *Qdoffs_QDDone(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 480,486 **** } ! static PyObject *Qdoffs_OffscreenVersion(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 436,440 ---- } ! static PyObject *Qdoffs_OffscreenVersion(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 494,500 **** } ! static PyObject *Qdoffs_NewTempScreenBuffer(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 448,452 ---- } ! static PyObject *Qdoffs_NewTempScreenBuffer(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 519,525 **** } ! static PyObject *Qdoffs_PixMap32Bit(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 471,475 ---- } ! static PyObject *Qdoffs_PixMap32Bit(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 535,541 **** } ! static PyObject *Qdoffs_GetPixMapBytes(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 485,489 ---- } ! static PyObject *Qdoffs_GetPixMapBytes(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 552,558 **** } ! static PyObject *Qdoffs_PutPixMapBytes(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 500,504 ---- } ! static PyObject *Qdoffs_PutPixMapBytes(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 624,628 **** ! void initQdoffs() { PyObject *m; --- 570,574 ---- ! void initQdoffs(void) { PyObject *m; *************** *** 631,636 **** ! PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldObj_Convert); --- 577,582 ---- ! PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldPtr, GWorldObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldPtr, GWorldObj_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:54:14 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:54:14 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qd qdsupport.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory usw-pr-cvs1:/tmp/cvs-serv14643/Python/Mac/Modules/qd Modified Files: qdsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: qdsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/qdsupport.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** qdsupport.py 2001/05/17 21:57:02 1.30 --- qdsupport.py 2001/05/22 21:54:12 1.31 *************** *** 62,66 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ #ifdef USE_TOOLBOX_OBJECT_GLUE --- 62,70 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 154,159 **** ** Parse/generate RGB records */ ! PyObject *QdRGB_New(itself) ! RGBColorPtr itself; { --- 158,162 ---- ** Parse/generate RGB records */ ! PyObject *QdRGB_New(RGBColorPtr itself) { *************** *** 161,167 **** } ! QdRGB_Convert(v, p_itself) ! PyObject *v; ! RGBColorPtr p_itself; { long red, green, blue; --- 164,168 ---- } ! QdRGB_Convert(PyObject *v, RGBColorPtr p_itself) { long red, green, blue; *************** *** 179,184 **** */ static ! PyObject *QdFI_New(itself) ! FontInfo *itself; { --- 180,184 ---- */ static ! PyObject *QdFI_New(FontInfo *itself) { *************** *** 192,197 **** ** released when the object is released) */ ! PyObject *BMObj_NewCopied(itself) ! BitMapPtr itself; { BitMapObject *it; --- 192,196 ---- ** released when the object is released) */ ! PyObject *BMObj_NewCopied(BitMapPtr itself) { BitMapObject *it; *************** *** 219,228 **** initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(BMObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BMObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(QdRGB_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(QdRGB_Convert); """ --- 218,227 ---- initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(BitMapPtr, BMObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(BitMapPtr, BMObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(GrafPtr, GrafObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GrafPtr, GrafObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(RGBColorPtr, QdRGB_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(RGBColorPtr, QdRGB_Convert); """ From jackjansen@users.sourceforge.net Tue May 22 22:54:57 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:54:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/res Resmodule.c,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv14836/Python/Mac/Modules/res Modified Files: Resmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Resmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/Resmodule.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** Resmodule.c 2001/05/17 21:57:55 1.26 --- Resmodule.c 2001/05/22 21:54:54 1.27 *************** *** 9,14 **** --- 9,18 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include #include + #else + #include + #endif [...1142 lines suppressed...] PyObject *m; *************** *** 1690,1697 **** ! PyMac_INIT_TOOLBOX_OBJECT_NEW(ResObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ResObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(OptResObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(OptResObj_Convert); --- 1558,1565 ---- ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, ResObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, ResObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, OptResObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, OptResObj_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:55:10 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:55:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/res resscan.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv14945/Python/Mac/Modules/res Modified Files: resscan.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: resscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/resscan.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** resscan.py 2001/03/02 16:32:03 1.11 --- resscan.py 2001/05/22 21:55:08 1.12 *************** *** 50,54 **** def makegreylist(self): return [ ! ('#if !TARGET_API_MAC_CARBON', [ 'RGetResource', 'OpenResFile', --- 50,54 ---- def makegreylist(self): return [ ! ('#if TARGET_API_MAC_OS8', [ 'RGetResource', 'OpenResFile', From jackjansen@users.sourceforge.net Tue May 22 22:55:16 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:55:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/res ressupport.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/res In directory usw-pr-cvs1:/tmp/cvs-serv14972/Python/Mac/Modules/res Modified Files: ressupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: ressupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/ressupport.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** ressupport.py 2001/05/17 21:58:02 1.14 --- ressupport.py 2001/05/22 21:55:14 1.15 *************** *** 24,29 **** --- 24,33 ---- includestuff = includestuff + """ + #ifdef WITHOUT_FRAMEWORKS #include #include + #else + #include + #endif #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 49,54 **** /* Alternative version of ResObj_New, which returns None for null argument */ ! PyObject *OptResObj_New(itself) ! Handle itself; { if (itself == NULL) { --- 53,57 ---- /* Alternative version of ResObj_New, which returns None for null argument */ ! PyObject *OptResObj_New(Handle itself) { if (itself == NULL) { *************** *** 59,65 **** } ! OptResObj_Convert(v, p_itself) ! PyObject *v; ! Handle *p_itself; { PyObject *tmp; --- 62,66 ---- } ! OptResObj_Convert(PyObject *v, Handle *p_itself) { PyObject *tmp; *************** *** 87,94 **** initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(ResObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ResObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(OptResObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(OptResObj_Convert); """ --- 88,95 ---- initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, ResObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, ResObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Handle, OptResObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Handle, OptResObj_Convert); """ *************** *** 116,123 **** setattrCode = """ static int ! ResObj_setattr(self, name, value) ! ResourceObject *self; ! char *name; ! PyObject *value; { char *data; --- 117,121 ---- setattrCode = """ static int ! ResObj_setattr(ResourceObject *self, char *name, PyObject *value) { char *data; From jackjansen@users.sourceforge.net Tue May 22 22:55:23 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:55:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/scrap Scrapmodule.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/scrap In directory usw-pr-cvs1:/tmp/cvs-serv15010/Python/Mac/Modules/scrap Modified Files: Scrapmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Scrapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/scrap/Scrapmodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** Scrapmodule.c 2001/01/29 15:20:06 1.5 --- Scrapmodule.c 2001/05/22 21:55:21 1.6 *************** *** 9,13 **** --- 9,17 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif /* From jackjansen@users.sourceforge.net Tue May 22 22:55:28 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:55:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/scrap scrapsupport.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/scrap In directory usw-pr-cvs1:/tmp/cvs-serv15047/Python/Mac/Modules/scrap Modified Files: scrapsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: scrapsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/scrap/scrapsupport.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** scrapsupport.py 2001/01/24 16:04:01 1.2 --- scrapsupport.py 2001/05/22 21:55:26 1.3 *************** *** 23,27 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ /* --- 23,31 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif /* From jackjansen@users.sourceforge.net Tue May 22 22:55:37 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:55:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/snd Sndmodule.c,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/snd In directory usw-pr-cvs1:/tmp/cvs-serv15087/Python/Mac/Modules/snd Modified Files: Sndmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Sndmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/Sndmodule.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** Sndmodule.c 2001/01/12 23:39:59 1.24 --- Sndmodule.c 2001/05/22 21:55:35 1.25 *************** *** 9,15 **** #include "pymactoolbox.h" #include - #include /* for Set(Current)A5 */ /* Create a SndCommand object (an (int, int, int) tuple) */ --- 9,19 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include #include /* for Set(Current)A5 */ + #else + #include + #endif + /* Create a SndCommand object (an (int, int, int) tuple) */ *************** *** 59,64 **** } SndChannelObject; ! static PyObject *SndCh_New(itself) ! SndChannelPtr itself; { SndChannelObject *it; --- 63,67 ---- } SndChannelObject; ! static PyObject *SndCh_New(SndChannelPtr itself) { SndChannelObject *it; *************** *** 70,76 **** return (PyObject *)it; } ! static SndCh_Convert(v, p_itself) ! PyObject *v; ! SndChannelPtr *p_itself; { if (!SndCh_Check(v)) --- 73,77 ---- return (PyObject *)it; } ! static SndCh_Convert(PyObject *v, SndChannelPtr *p_itself) { if (!SndCh_Check(v)) *************** *** 83,88 **** } ! static void SndCh_dealloc(self) ! SndChannelObject *self; { SndDisposeChannel(self->ob_itself, 1); --- 84,88 ---- } ! static void SndCh_dealloc(SndChannelObject *self) { SndDisposeChannel(self->ob_itself, 1); *************** *** 91,97 **** } ! static PyObject *SndCh_SndDoCommand(_self, _args) ! SndChannelObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 91,95 ---- } ! static PyObject *SndCh_SndDoCommand(SndChannelObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 112,118 **** } ! static PyObject *SndCh_SndDoImmediate(_self, _args) ! SndChannelObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 110,114 ---- } ! static PyObject *SndCh_SndDoImmediate(SndChannelObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 130,136 **** } ! static PyObject *SndCh_SndPlay(_self, _args) ! SndChannelObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 126,130 ---- } ! static PyObject *SndCh_SndPlay(SndChannelObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 153,159 **** #if !TARGET_API_MAC_CARBON ! static PyObject *SndCh_SndStartFilePlay(_self, _args) ! SndChannelObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 147,151 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *SndCh_SndStartFilePlay(SndChannelObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 186,192 **** #if !TARGET_API_MAC_CARBON ! static PyObject *SndCh_SndPauseFilePlay(_self, _args) ! SndChannelObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 178,182 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *SndCh_SndPauseFilePlay(SndChannelObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 204,210 **** #if !TARGET_API_MAC_CARBON ! static PyObject *SndCh_SndStopFilePlay(_self, _args) ! SndChannelObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 194,198 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *SndCh_SndStopFilePlay(SndChannelObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 223,229 **** #endif ! static PyObject *SndCh_SndChannelStatus(_self, _args) ! SndChannelObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 211,215 ---- #endif ! static PyObject *SndCh_SndChannelStatus(SndChannelObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 244,250 **** } ! static PyObject *SndCh_SndGetInfo(_self, _args) ! SndChannelObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 230,234 ---- } ! static PyObject *SndCh_SndGetInfo(SndChannelObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 265,271 **** } ! static PyObject *SndCh_SndSetInfo(_self, _args) ! SndChannelObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 249,253 ---- } ! static PyObject *SndCh_SndSetInfo(SndChannelObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 319,325 **** static PyMethodChain SndCh_chain = { SndCh_methods, NULL }; ! static PyObject *SndCh_getattr(self, name) ! SndChannelObject *self; ! char *name; { return Py_FindMethodInChain(&SndCh_chain, (PyObject *)self, name); --- 301,305 ---- static PyMethodChain SndCh_chain = { SndCh_methods, NULL }; ! static PyObject *SndCh_getattr(SndChannelObject *self, char *name) { return Py_FindMethodInChain(&SndCh_chain, (PyObject *)self, name); *************** *** 385,391 **** return (PyObject *)it; } ! static SPBObj_Convert(v, p_itself) ! PyObject *v; ! SPBPtr *p_itself; { if (!SPBObj_Check(v)) --- 365,369 ---- return (PyObject *)it; } ! static SPBObj_Convert(PyObject *v, SPBPtr *p_itself) { if (!SPBObj_Check(v)) *************** *** 398,403 **** } ! static void SPBObj_dealloc(self) ! SPBObject *self; { /* Cleanup of self->ob_itself goes here */ --- 376,380 ---- } ! static void SPBObj_dealloc(SPBObject *self) { /* Cleanup of self->ob_itself goes here */ *************** *** 415,421 **** static PyMethodChain SPBObj_chain = { SPBObj_methods, NULL }; ! static PyObject *SPBObj_getattr(self, name) ! SPBObject *self; ! char *name; { --- 392,396 ---- static PyMethodChain SPBObj_chain = { SPBObj_methods, NULL }; ! static PyObject *SPBObj_getattr(SPBObject *self, char *name) { *************** *** 431,438 **** } ! static int SPBObj_setattr(self, name, value) ! SPBObject *self; ! char *name; ! PyObject *value; { --- 406,410 ---- } ! static int SPBObj_setattr(SPBObject *self, char *name, PyObject *value) { *************** *** 448,452 **** rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); else if (strcmp(name, "completionRoutine") == 0) { ! self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion); self->ob_completion = value; Py_INCREF(value); --- 420,424 ---- rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); else if (strcmp(name, "completionRoutine") == 0) { ! self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion); self->ob_completion = value; Py_INCREF(value); *************** *** 454,458 **** #if !TARGET_API_MAC_CARBON } else if (strcmp(name, "interruptRoutine") == 0) { ! self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt); self->ob_interrupt = value; Py_INCREF(value); --- 426,430 ---- #if !TARGET_API_MAC_CARBON } else if (strcmp(name, "interruptRoutine") == 0) { ! self->ob_spb.completionRoutine = NewSIInterruptUPP(SPB_interrupt); self->ob_interrupt = value; Py_INCREF(value); *************** *** 492,498 **** ! static PyObject *Snd_SPB(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 464,468 ---- ! static PyObject *Snd_SPB(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 500,506 **** } ! static PyObject *Snd_SysBeep(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 470,474 ---- } ! static PyObject *Snd_SysBeep(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 515,521 **** } ! static PyObject *Snd_SndNewChannel(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 483,487 ---- } ! static PyObject *Snd_SndNewChannel(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 538,542 **** synth, init, ! NewSndCallBackProc(SndCh_UserRoutine)); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", --- 504,508 ---- synth, init, ! NewSndCallBackUPP(SndCh_UserRoutine)); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", *************** *** 555,561 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_SndControl(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 521,525 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_SndControl(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 575,581 **** #endif ! static PyObject *Snd_SndSoundManagerVersion(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 539,543 ---- #endif ! static PyObject *Snd_SndSoundManagerVersion(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 589,595 **** } ! static PyObject *Snd_SndManagerStatus(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 551,555 ---- } ! static PyObject *Snd_SndManagerStatus(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 609,615 **** } ! static PyObject *Snd_SndGetSysBeepState(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 569,573 ---- } ! static PyObject *Snd_SndGetSysBeepState(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 623,629 **** } ! static PyObject *Snd_SndSetSysBeepState(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 581,585 ---- } ! static PyObject *Snd_SndSetSysBeepState(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 642,648 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_MACEVersion(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 598,602 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_MACEVersion(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 659,665 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_Comp3to1(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 613,617 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_Comp3to1(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 706,712 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_Exp1to3(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 658,662 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_Exp1to3(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 753,759 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_Comp6to1(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 703,707 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_Comp6to1(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 800,806 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_Exp1to6(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 748,752 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_Exp1to6(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 845,851 **** #endif ! static PyObject *Snd_GetSysBeepVolume(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 791,795 ---- #endif ! static PyObject *Snd_GetSysBeepVolume(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 861,867 **** } ! static PyObject *Snd_SetSysBeepVolume(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 805,809 ---- } ! static PyObject *Snd_SetSysBeepVolume(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 878,884 **** } ! static PyObject *Snd_GetDefaultOutputVolume(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 820,824 ---- } ! static PyObject *Snd_GetDefaultOutputVolume(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 894,900 **** } ! static PyObject *Snd_SetDefaultOutputVolume(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 834,838 ---- } ! static PyObject *Snd_SetDefaultOutputVolume(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 911,917 **** } ! static PyObject *Snd_GetSoundHeaderOffset(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 849,853 ---- } ! static PyObject *Snd_GetSoundHeaderOffset(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 930,936 **** } ! static PyObject *Snd_GetCompressionInfo(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 866,870 ---- } ! static PyObject *Snd_GetCompressionInfo(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 959,965 **** } ! static PyObject *Snd_SetSoundPreference(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 893,897 ---- } ! static PyObject *Snd_SetSoundPreference(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 981,987 **** } ! static PyObject *Snd_GetSoundPreference(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 913,917 ---- } ! static PyObject *Snd_GetSoundPreference(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1003,1009 **** } ! static PyObject *Snd_GetCompressionName(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 933,937 ---- } ! static PyObject *Snd_GetCompressionName(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1022,1028 **** } ! static PyObject *Snd_SPBVersion(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 950,954 ---- } ! static PyObject *Snd_SPBVersion(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1036,1042 **** } ! static PyObject *Snd_SPBSignInDevice(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 962,966 ---- } ! static PyObject *Snd_SPBSignInDevice(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1056,1062 **** } ! static PyObject *Snd_SPBSignOutDevice(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 980,984 ---- } ! static PyObject *Snd_SPBSignOutDevice(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1073,1079 **** } ! static PyObject *Snd_SPBGetIndexedDevice(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 995,999 ---- } ! static PyObject *Snd_SPBGetIndexedDevice(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1095,1101 **** } ! static PyObject *Snd_SPBOpenDevice(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1015,1019 ---- } ! static PyObject *Snd_SPBOpenDevice(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1117,1123 **** } ! static PyObject *Snd_SPBCloseDevice(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1035,1039 ---- } ! static PyObject *Snd_SPBCloseDevice(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1134,1140 **** } ! static PyObject *Snd_SPBRecord(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1050,1054 ---- } ! static PyObject *Snd_SPBRecord(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1156,1162 **** #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_SPBRecordToFile(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1070,1074 ---- #if !TARGET_API_MAC_CARBON ! static PyObject *Snd_SPBRecordToFile(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1180,1186 **** #endif ! static PyObject *Snd_SPBPauseRecording(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1092,1096 ---- #endif ! static PyObject *Snd_SPBPauseRecording(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1197,1203 **** } ! static PyObject *Snd_SPBResumeRecording(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1107,1111 ---- } ! static PyObject *Snd_SPBResumeRecording(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1214,1220 **** } ! static PyObject *Snd_SPBStopRecording(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1122,1126 ---- } ! static PyObject *Snd_SPBStopRecording(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1231,1237 **** } ! static PyObject *Snd_SPBGetRecordingStatus(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1137,1141 ---- } ! static PyObject *Snd_SPBGetRecordingStatus(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1265,1271 **** } ! static PyObject *Snd_SPBGetDeviceInfo(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1169,1173 ---- } ! static PyObject *Snd_SPBGetDeviceInfo(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1288,1294 **** } ! static PyObject *Snd_SPBSetDeviceInfo(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1190,1194 ---- } ! static PyObject *Snd_SPBSetDeviceInfo(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1311,1317 **** } ! static PyObject *Snd_SPBMillisecondsToBytes(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1211,1215 ---- } ! static PyObject *Snd_SPBMillisecondsToBytes(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1330,1336 **** } ! static PyObject *Snd_SPBBytesToMilliseconds(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 1228,1232 ---- } ! static PyObject *Snd_SPBBytesToMilliseconds(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1454,1459 **** /* Routine passed to Py_AddPendingCall -- call the Python callback */ static int ! SndCh_CallCallBack(arg) ! void *arg; { SndChannelObject *p = (SndChannelObject *)arg; --- 1350,1354 ---- /* Routine passed to Py_AddPendingCall -- call the Python callback */ static int ! SndCh_CallCallBack(void *arg) { SndChannelObject *p = (SndChannelObject *)arg; *************** *** 1485,1490 **** /* SPB callbacks - Schedule callbacks to Python */ static int ! SPB_CallCallBack(arg) ! void *arg; { SPBObject *p = (SPBObject *)arg; --- 1380,1384 ---- /* SPB callbacks - Schedule callbacks to Python */ static int ! SPB_CallCallBack(void *arg) { SPBObject *p = (SPBObject *)arg; *************** *** 1532,1536 **** ! void initSnd() { PyObject *m; --- 1426,1430 ---- ! void initSnd(void) { PyObject *m; From jackjansen@users.sourceforge.net Tue May 22 22:55:47 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:55:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/te TEmodule.c,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/te In directory usw-pr-cvs1:/tmp/cvs-serv15146/Python/Mac/Modules/te Modified Files: TEmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: TEmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/te/TEmodule.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** TEmodule.c 2001/05/17 21:58:12 1.13 --- TEmodule.c 2001/05/22 21:55:44 1.14 *************** *** 9,13 **** --- 9,17 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 26,31 **** */ static PyObject * ! TextStyle_New(itself) ! TextStylePtr itself; { --- 30,34 ---- */ static PyObject * ! TextStyle_New(TextStylePtr itself) { *************** *** 35,41 **** static int ! TextStyle_Convert(v, p_itself) ! PyObject *v; ! TextStylePtr p_itself; { long font, face, size; --- 38,42 ---- static int ! TextStyle_Convert(PyObject *v, TextStylePtr p_itself) { long font, face, size; *************** *** 62,67 **** } TEObject; ! PyObject *TEObj_New(itself) ! TEHandle itself; { TEObject *it; --- 63,67 ---- } TEObject; ! PyObject *TEObj_New(TEHandle itself) { TEObject *it; *************** *** 75,81 **** return (PyObject *)it; } ! TEObj_Convert(v, p_itself) ! PyObject *v; ! TEHandle *p_itself; { if (!TEObj_Check(v)) --- 75,79 ---- return (PyObject *)it; } ! TEObj_Convert(PyObject *v, TEHandle *p_itself) { if (!TEObj_Check(v)) *************** *** 88,93 **** } ! static void TEObj_dealloc(self) ! TEObject *self; { TEDispose(self->ob_itself); --- 86,90 ---- } ! static void TEObj_dealloc(TEObject *self) { TEDispose(self->ob_itself); *************** *** 95,101 **** } ! static PyObject *TEObj_TESetText(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 92,96 ---- } ! static PyObject *TEObj_TESetText(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 115,121 **** } ! static PyObject *TEObj_TEGetText(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 110,114 ---- } ! static PyObject *TEObj_TEGetText(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 129,135 **** } ! static PyObject *TEObj_TEIdle(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 122,126 ---- } ! static PyObject *TEObj_TEIdle(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 142,148 **** } ! static PyObject *TEObj_TESetSelect(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 133,137 ---- } ! static PyObject *TEObj_TESetSelect(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 161,167 **** } ! static PyObject *TEObj_TEActivate(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 150,154 ---- } ! static PyObject *TEObj_TEActivate(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 174,180 **** } ! static PyObject *TEObj_TEDeactivate(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 161,165 ---- } ! static PyObject *TEObj_TEDeactivate(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 187,193 **** } ! static PyObject *TEObj_TEKey(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 172,176 ---- } ! static PyObject *TEObj_TEKey(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 203,209 **** } ! static PyObject *TEObj_TECut(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 186,190 ---- } ! static PyObject *TEObj_TECut(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 216,222 **** } ! static PyObject *TEObj_TECopy(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 197,201 ---- } ! static PyObject *TEObj_TECopy(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 229,235 **** } ! static PyObject *TEObj_TEPaste(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 208,212 ---- } ! static PyObject *TEObj_TEPaste(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 242,248 **** } ! static PyObject *TEObj_TEDelete(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 219,223 ---- } ! static PyObject *TEObj_TEDelete(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 255,261 **** } ! static PyObject *TEObj_TEInsert(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 230,234 ---- } ! static PyObject *TEObj_TEInsert(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 275,281 **** } ! static PyObject *TEObj_TESetAlignment(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 248,252 ---- } ! static PyObject *TEObj_TESetAlignment(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 291,297 **** } ! static PyObject *TEObj_TEUpdate(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 262,266 ---- } ! static PyObject *TEObj_TEUpdate(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 307,313 **** } ! static PyObject *TEObj_TEScroll(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 276,280 ---- } ! static PyObject *TEObj_TEScroll(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 326,332 **** } ! static PyObject *TEObj_TESelView(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 293,297 ---- } ! static PyObject *TEObj_TESelView(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 339,345 **** } ! static PyObject *TEObj_TEPinScroll(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 304,308 ---- } ! static PyObject *TEObj_TEPinScroll(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 358,364 **** } ! static PyObject *TEObj_TEAutoView(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 321,325 ---- } ! static PyObject *TEObj_TEAutoView(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 374,380 **** } ! static PyObject *TEObj_TECalText(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 335,339 ---- } ! static PyObject *TEObj_TECalText(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 387,393 **** } ! static PyObject *TEObj_TEGetOffset(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 346,350 ---- } ! static PyObject *TEObj_TEGetOffset(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 404,410 **** } ! static PyObject *TEObj_TEGetPoint(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 361,365 ---- } ! static PyObject *TEObj_TEGetPoint(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 421,427 **** } ! static PyObject *TEObj_TEClick(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 376,380 ---- } ! static PyObject *TEObj_TEClick(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 440,446 **** } ! static PyObject *TEObj_TESetStyleHandle(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 393,397 ---- } ! static PyObject *TEObj_TESetStyleHandle(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 456,462 **** } ! static PyObject *TEObj_TEGetStyleHandle(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 407,411 ---- } ! static PyObject *TEObj_TEGetStyleHandle(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 470,476 **** } ! static PyObject *TEObj_TEGetStyle(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 419,423 ---- } ! static PyObject *TEObj_TEGetStyle(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 494,500 **** } ! static PyObject *TEObj_TEStylePaste(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 441,445 ---- } ! static PyObject *TEObj_TEStylePaste(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 507,513 **** } ! static PyObject *TEObj_TESetStyle(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 452,456 ---- } ! static PyObject *TEObj_TESetStyle(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 529,535 **** } ! static PyObject *TEObj_TEReplaceStyle(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 472,476 ---- } ! static PyObject *TEObj_TEReplaceStyle(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 554,560 **** } ! static PyObject *TEObj_TEGetStyleScrapHandle(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 495,499 ---- } ! static PyObject *TEObj_TEGetStyleScrapHandle(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 568,574 **** } ! static PyObject *TEObj_TEStyleInsert(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 507,511 ---- } ! static PyObject *TEObj_TEStyleInsert(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 591,597 **** } ! static PyObject *TEObj_TEGetHeight(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 528,532 ---- } ! static PyObject *TEObj_TEGetHeight(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 611,617 **** } ! static PyObject *TEObj_TEContinuousStyle(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 546,550 ---- } ! static PyObject *TEObj_TEContinuousStyle(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 633,639 **** } ! static PyObject *TEObj_TEUseStyleScrap(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 566,570 ---- } ! static PyObject *TEObj_TEUseStyleScrap(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 658,664 **** } ! static PyObject *TEObj_TENumStyles(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 589,593 ---- } ! static PyObject *TEObj_TENumStyles(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 678,684 **** } ! static PyObject *TEObj_TEFeatureFlag(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 607,611 ---- } ! static PyObject *TEObj_TEFeatureFlag(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 698,704 **** } ! static PyObject *TEObj_TEGetHiliteRgn(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 625,629 ---- } ! static PyObject *TEObj_TEGetHiliteRgn(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 716,722 **** } ! static PyObject *TEObj_as_Resource(_self, _args) ! TEObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 641,645 ---- } ! static PyObject *TEObj_as_Resource(TEObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 810,816 **** PyMethodChain TEObj_chain = { TEObj_methods, NULL }; ! static PyObject *TEObj_getattr(self, name) ! TEObject *self; ! char *name; { --- 733,737 ---- PyMethodChain TEObj_chain = { TEObj_methods, NULL }; ! static PyObject *TEObj_getattr(TEObject *self, char *name) { *************** *** 885,891 **** ! static PyObject *TE_TEScrapHandle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 806,810 ---- ! static PyObject *TE_TEScrapHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 899,905 **** } ! static PyObject *TE_TEGetScrapLength(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 818,822 ---- } ! static PyObject *TE_TEGetScrapLength(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 913,919 **** } ! static PyObject *TE_TENew(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 830,834 ---- } ! static PyObject *TE_TENew(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 932,938 **** } ! static PyObject *TE_TETextBox(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 847,851 ---- } ! static PyObject *TE_TETextBox(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 957,963 **** } ! static PyObject *TE_TEStyleNew(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 870,874 ---- } ! static PyObject *TE_TEStyleNew(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 976,982 **** } ! static PyObject *TE_TESetScrapLength(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 887,891 ---- } ! static PyObject *TE_TESetScrapLength(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 991,997 **** } ! static PyObject *TE_TEFromScrap(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 900,904 ---- } ! static PyObject *TE_TEFromScrap(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1006,1012 **** } ! static PyObject *TE_TEToScrap(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 913,917 ---- } ! static PyObject *TE_TEToScrap(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1023,1029 **** #if TARGET_API_MAC_CARBON ! static PyObject *TE_TEGetScrapHandle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 928,932 ---- #if TARGET_API_MAC_CARBON ! static PyObject *TE_TEGetScrapHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1040,1046 **** #if TARGET_API_MAC_CARBON ! static PyObject *TE_TESetScrapHandle(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 943,947 ---- #if TARGET_API_MAC_CARBON ! static PyObject *TE_TESetScrapHandle(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1056,1062 **** #endif ! static PyObject *TE_as_TE(_self, _args) ! PyObject *_self; ! PyObject *_args; { PyObject *_res = NULL; --- 957,961 ---- #endif ! static PyObject *TE_as_TE(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1107,1111 **** ! void initTE() { PyObject *m; --- 1006,1010 ---- ! void initTE(void) { PyObject *m; *************** *** 1114,1119 **** ! PyMac_INIT_TOOLBOX_OBJECT_NEW(TEObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEObj_Convert); --- 1013,1018 ---- ! PyMac_INIT_TOOLBOX_OBJECT_NEW(TEHandle, TEObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEHandle, TEObj_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:56:12 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:56:12 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/te tesupport.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/te In directory usw-pr-cvs1:/tmp/cvs-serv15270/Python/Mac/Modules/te Modified Files: tesupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: tesupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/te/tesupport.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** tesupport.py 2001/05/17 21:58:17 1.7 --- tesupport.py 2001/05/22 21:56:10 1.8 *************** *** 33,37 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ #ifdef USE_TOOLBOX_OBJECT_GLUE --- 33,41 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 50,55 **** */ static PyObject * ! TextStyle_New(itself) ! TextStylePtr itself; { --- 54,58 ---- */ static PyObject * ! TextStyle_New(TextStylePtr itself) { *************** *** 59,65 **** static int ! TextStyle_Convert(v, p_itself) ! PyObject *v; ! TextStylePtr p_itself; { long font, face, size; --- 62,66 ---- static int ! TextStyle_Convert(PyObject *v, TextStylePtr p_itself) { long font, face, size; *************** *** 75,80 **** initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(TEObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEObj_Convert); """ --- 76,81 ---- initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(TEHandle, TEObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TEHandle, TEObj_Convert); """ From jackjansen@users.sourceforge.net Tue May 22 22:56:22 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:56:22 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/waste wastemodule.c,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/waste In directory usw-pr-cvs1:/tmp/cvs-serv15301/Python/Mac/Modules/waste Modified Files: wastemodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: wastemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/waste/wastemodule.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** wastemodule.c 2001/01/24 16:03:05 1.15 --- wastemodule.c 2001/05/22 21:56:20 1.16 *************** *** 155,159 **** static pascal OSErr ! my_draw_handler(const Rect *destRect, WEObjectReference objref) { PyObject *args=NULL, *rv=NULL; --- 155,159 ---- static pascal OSErr ! my_draw_handler(Rect *destRect, WEObjectReference objref) { [...1520 lines suppressed...] PyObject *_res = NULL; --- 1969,1973 ---- } ! static PyObject *waste_WEInstallObjectHandler(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 2261,2265 **** ! void initwaste() { PyObject *m; --- 2061,2065 ---- ! void initwaste(void) { PyObject *m; From jackjansen@users.sourceforge.net Tue May 22 22:54:01 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:54:01 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qdoffs qdoffssupport.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qdoffs In directory usw-pr-cvs1:/tmp/cvs-serv14586/Python/Mac/Modules/qdoffs Modified Files: qdoffssupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: qdoffssupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qdoffs/qdoffssupport.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** qdoffssupport.py 2001/05/17 21:56:55 1.4 --- qdoffssupport.py 2001/05/22 21:53:59 1.5 *************** *** 35,39 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ #ifdef USE_TOOLBOX_OBJECT_GLUE --- 35,43 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 50,55 **** initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldObj_Convert); """ --- 54,59 ---- initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(GWorldPtr, GWorldObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(GWorldPtr, GWorldObj_Convert); """ From jackjansen@users.sourceforge.net Tue May 22 22:54:40 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:54:40 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qt Qtmodule.c,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qt In directory usw-pr-cvs1:/tmp/cvs-serv14688/Python/Mac/Modules/qt Modified Files: Qtmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Qtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qt/Qtmodule.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** Qtmodule.c 2001/05/17 21:57:32 1.23 --- Qtmodule.c 2001/05/22 21:54:37 1.24 *************** *** 9,13 **** --- 9,19 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + /* #include */ + #include + #endif + [...6302 lines suppressed...] ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MediaObj_Convert); --- 8369,8384 ---- ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Track, TrackObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Track, TrackObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Movie, MovieObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Movie, MovieObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieController, MovieCtlObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieController, MovieCtlObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBase, TimeBaseObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBase, TimeBaseObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(UserData, UserDataObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserData, UserDataObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Media, MediaObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Media, MediaObj_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:54:44 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:54:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/qt qtsupport.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qt In directory usw-pr-cvs1:/tmp/cvs-serv14807/Python/Mac/Modules/qt Modified Files: qtsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: qtsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qt/qtsupport.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** qtsupport.py 2001/05/17 21:57:42 1.16 --- qtsupport.py 2001/05/22 21:54:42 1.17 *************** *** 25,29 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ #ifdef USE_TOOLBOX_OBJECT_GLUE --- 25,35 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! /* #include */ ! #include ! #endif ! #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 63,68 **** */ static PyObject * ! QtTimeRecord_New(itself) ! TimeRecord *itself; { if (itself->base) --- 69,73 ---- */ static PyObject * ! QtTimeRecord_New(TimeRecord *itself) { if (itself->base) *************** *** 75,81 **** static int ! QtTimeRecord_Convert(v, p_itself) ! PyObject *v; ! TimeRecord *p_itself; { PyObject *base = NULL; --- 80,84 ---- static int ! QtTimeRecord_Convert(PyObject *v, TimeRecord *p_itself) { PyObject *base = NULL; *************** *** 96,111 **** initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(TrackObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TrackObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieCtlObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieCtlObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBaseObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBaseObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(UserDataObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserDataObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(MediaObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MediaObj_Convert); """ --- 99,114 ---- initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Track, TrackObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Track, TrackObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Movie, MovieObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Movie, MovieObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(MovieController, MovieCtlObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(MovieController, MovieCtlObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(TimeBase, TimeBaseObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(TimeBase, TimeBaseObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(UserData, UserDataObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(UserData, UserDataObj_Convert); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(Media, MediaObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(Media, MediaObj_Convert); """ From jackjansen@users.sourceforge.net Tue May 22 22:55:42 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:55:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/snd sndsupport.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/snd In directory usw-pr-cvs1:/tmp/cvs-serv15120/Python/Mac/Modules/snd Modified Files: sndsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: sndsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/snd/sndsupport.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** sndsupport.py 2001/01/12 23:39:59 1.14 --- sndsupport.py 2001/05/22 21:55:39 1.15 *************** *** 18,22 **** --- 18,27 ---- includestuff = includestuff + """ + #ifdef WITHOUT_FRAMEWORKS #include + #include /* for Set(Current)A5 */ + #else + #include + #endif """ *************** *** 58,62 **** OutRbrace() def passInput(self, name): ! return "NewSndCallBackProc(SndCh_UserRoutine)" def cleanup(self, name): # XXX This knows it is executing inside the SndNewChannel wrapper --- 63,67 ---- OutRbrace() def passInput(self, name): ! return "NewSndCallBackUPP(SndCh_UserRoutine)" def cleanup(self, name): # XXX This knows it is executing inside the SndNewChannel wrapper *************** *** 91,95 **** includestuff = includestuff + """ - #include /* for Set(Current)A5 */ /* Create a SndCommand object (an (int, int, int) tuple) */ --- 96,99 ---- *************** *** 127,132 **** /* Routine passed to Py_AddPendingCall -- call the Python callback */ static int ! SndCh_CallCallBack(arg) ! void *arg; { SndChannelObject *p = (SndChannelObject *)arg; --- 131,135 ---- /* Routine passed to Py_AddPendingCall -- call the Python callback */ static int ! SndCh_CallCallBack(void *arg) { SndChannelObject *p = (SndChannelObject *)arg; *************** *** 158,163 **** /* SPB callbacks - Schedule callbacks to Python */ static int ! SPB_CallCallBack(arg) ! void *arg; { SPBObject *p = (SPBObject *)arg; --- 161,165 ---- /* SPB callbacks - Schedule callbacks to Python */ static int ! SPB_CallCallBack(void *arg) { SPBObject *p = (SPBObject *)arg; *************** *** 269,277 **** def outputConvert(self): ! Output("%s%s_Convert(v, p_itself)", self.static, self.prefix) ! IndentLevel() ! Output("PyObject *v;") ! Output("%s *p_itself;", self.itselftype) ! DedentLevel() OutLbrace() self.outputCheckConvertArg() --- 271,275 ---- def outputConvert(self): ! Output("%s%s_Convert(PyObject *v, %s *p_itself)", self.static, self.prefix, self.itselftype) OutLbrace() self.outputCheckConvertArg() *************** *** 287,296 **** def outputSetattr(self): Output() ! Output("static int %s_setattr(self, name, value)", self.prefix) ! IndentLevel() ! Output("%s *self;", self.objecttype) ! Output("char *name;") ! Output("PyObject *value;") ! DedentLevel() OutLbrace() self.outputSetattrBody() --- 285,290 ---- def outputSetattr(self): Output() ! Output("static int %s_setattr(%s *self, char *name, PyObject *value)", ! self.prefix, self.objecttype) OutLbrace() self.outputSetattrBody() *************** *** 310,314 **** rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); else if (strcmp(name, "completionRoutine") == 0) { ! self->ob_spb.completionRoutine = NewSICompletionProc(SPB_completion); self->ob_completion = value; Py_INCREF(value); --- 304,308 ---- rv = PyArg_Parse(value, "w#", &self->ob_spb.bufferPtr, &self->ob_spb.bufferLength); else if (strcmp(name, "completionRoutine") == 0) { ! self->ob_spb.completionRoutine = NewSICompletionUPP(SPB_completion); self->ob_completion = value; Py_INCREF(value); *************** *** 316,320 **** #if !TARGET_API_MAC_CARBON } else if (strcmp(name, "interruptRoutine") == 0) { ! self->ob_spb.completionRoutine = NewSIInterruptProc(SPB_interrupt); self->ob_interrupt = value; Py_INCREF(value); --- 310,314 ---- #if !TARGET_API_MAC_CARBON } else if (strcmp(name, "interruptRoutine") == 0) { ! self->ob_spb.completionRoutine = NewSIInterruptUPP(SPB_interrupt); self->ob_interrupt = value; Py_INCREF(value); From jackjansen@users.sourceforge.net Tue May 22 22:56:38 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:56:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/win Winmodule.c,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory usw-pr-cvs1:/tmp/cvs-serv15363/Python/Mac/Modules/win Modified Files: Winmodule.c Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: Winmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/Winmodule.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** Winmodule.c 2001/05/17 21:58:27 1.34 --- Winmodule.c 2001/05/22 21:56:36 1.35 *************** *** 9,13 **** --- 9,17 ---- #include "pymactoolbox.h" + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif #ifdef USE_TOOLBOX_OBJECT_GLUE [...2224 lines suppressed...] ! void initWin(void) { PyObject *m; *************** *** 3079,3085 **** ! PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_WhichWindow); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WinObj_Convert); --- 2793,2799 ---- ! PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert); From jackjansen@users.sourceforge.net Tue May 22 22:56:44 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 14:56:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Modules/win winsupport.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory usw-pr-cvs1:/tmp/cvs-serv15405/Python/Mac/Modules/win Modified Files: winsupport.py Log Message: Lots more Carbon/Carbon.h includes, new UPP routine names, function prototypes. Most toolbox modules now compile, link and import in MacOSX-MachO python. Index: winsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/winsupport.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** winsupport.py 2001/05/17 21:58:34 1.23 --- winsupport.py 2001/05/22 21:56:42 1.24 *************** *** 55,59 **** includestuff = includestuff + """ ! #include <%s>""" % MACHEADERFILE + """ #ifdef USE_TOOLBOX_OBJECT_GLUE --- 55,63 ---- includestuff = includestuff + """ ! #ifdef WITHOUT_FRAMEWORKS ! #include ! #else ! #include ! #endif #ifdef USE_TOOLBOX_OBJECT_GLUE *************** *** 93,98 **** PyObject * ! WinObj_WhichWindow(w) ! WindowPtr w; { PyObject *it; --- 97,101 ---- PyObject * ! WinObj_WhichWindow(WindowPtr w) { PyObject *it; *************** *** 115,121 **** initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(WinObj_WhichWindow); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WinObj_Convert); """ --- 118,124 ---- initstuff = initstuff + """ ! PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_New); ! PyMac_INIT_TOOLBOX_OBJECT_NEW(WindowPtr, WinObj_WhichWindow); ! PyMac_INIT_TOOLBOX_OBJECT_CONVERT(WindowPtr, WinObj_Convert); """ *************** *** 165,172 **** def outputCompare(self): Output() ! Output("static int %s_compare(self, other)", self.prefix) ! IndentLevel() ! Output("%s *self, *other;", self.objecttype) ! DedentLevel() OutLbrace() Output("if ( self->ob_itself > other->ob_itself ) return 1;") --- 168,172 ---- def outputCompare(self): Output() ! Output("static int %s_compare(%s *self, %s *other)", self.prefix, self.objecttype, self.objecttype) OutLbrace() Output("if ( self->ob_itself > other->ob_itself ) return 1;") *************** *** 177,184 **** def outputHash(self): Output() ! Output("static int %s_hash(self)", self.prefix) ! IndentLevel() ! Output("%s *self;", self.objecttype) ! DedentLevel() OutLbrace() Output("return (int)self->ob_itself;") --- 177,181 ---- def outputHash(self): Output() ! Output("static int %s_hash(%s *self)", self.prefix, self.objecttype) OutLbrace() Output("return (int)self->ob_itself;") *************** *** 187,194 **** def outputRepr(self): Output() ! Output("static PyObject * %s_repr(self)", self.prefix) ! IndentLevel() ! Output("%s *self;", self.objecttype) ! DedentLevel() OutLbrace() Output("char buf[100];") --- 184,188 ---- def outputRepr(self): Output() ! Output("static PyObject * %s_repr(%s *self)", self.prefix, self.objecttype) OutLbrace() Output("char buf[100];") From fdrake@users.sourceforge.net Tue May 22 23:00:42 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 15:00:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib librfc822.tex,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv16416/Doc/lib Modified Files: librfc822.tex Log Message: One more update related to the new get() and setdefault() methods on the Message object. Index: librfc822.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** librfc822.tex 2001/05/22 15:12:46 1.33 --- librfc822.tex 2001/05/22 22:00:40 1.34 *************** *** 219,227 **** \code{\var{m}.has_key(name)}, \code{\var{m}.keys()}, \code{\var{m}.values()} \code{\var{m}.items()}, and ! \code{\var{m}.setdefault(name\optional{, default})} act as expected ! (and consistently). \class{Message} instances also support the ! mapping writable interface \code{\var{m}[name] = value} and \code{del ! \var{m}[name]}. \class{Message} objects do not support the ! \method{clear()}, \method{copy()}, \method{popitem()}, or \method{update()} methods of the mapping interface. (Support for \method{.get()} and \method{.setdefault()} was only added in Python --- 219,228 ---- \code{\var{m}.has_key(name)}, \code{\var{m}.keys()}, \code{\var{m}.values()} \code{\var{m}.items()}, and ! \code{\var{m}.setdefault(name\optional{, default})} act as expected, ! with the one difference that \method{get()} and \method{setdefault()} ! use an empty string as the default value. \class{Message} instances ! also support the mapping writable interface \code{\var{m}[name] = ! value} and \code{del \var{m}[name]}. \class{Message} objects do not ! support the \method{clear()}, \method{copy()}, \method{popitem()}, or \method{update()} methods of the mapping interface. (Support for \method{.get()} and \method{.setdefault()} was only added in Python From jackjansen@users.sourceforge.net Tue May 22 23:18:23 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 15:18:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/scripts bgenall.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory usw-pr-cvs1:/tmp/cvs-serv20103/Python/Mac/scripts Added Files: bgenall.py Log Message: Simple script to regenerate all bgen-generated modules. --- NEW FILE: bgenall.py --- # bgenall - Generate all bgen-generated modules # import sys import os import string def bgenone(dirname, shortname): os.chdir(dirname) m = __import__(shortname+'scan') try: m.main() except: return 0 return 1 def main(): success = [] failure = [] sys.path.insert(0, ':') srcdir = os.path.join(os.path.join(sys.prefix, 'Mac'), 'Modules') contents = os.listdir(srcdir) for name in contents: moduledir = os.path.join(srcdir, name) scanmodule = os.path.join(moduledir, name +'scan.py') if os.path.exists(scanmodule): if bgenone(moduledir, name): success.append(name) else: failure.append(name) print 'Done:', string.join(success, ' ') if failure: print 'Failed:', string.join(failure, ' ') return 0 return 1 if __name__ == '__main__': rv = main() sys.exit(not rv) From fdrake@acm.org Tue May 22 23:19:46 2001 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Tue, 22 May 2001 18:19:46 -0400 (EDT) Subject: [Python-checkins] CVS: python/nondist/sandbox/sets set.py,NONE,1.1 test_set.py,NONE,1.1 In-Reply-To: References: Message-ID: <15114.58882.78136.84582@cj42289-a.reston1.va.home.com> Greg Wilson writes: > --- NEW FILE: test_set.py --- > #!/usr/bin/env python ... > class TestBasicOps(unittest.TestCase): > > def checkRepr(self): > if self.repr is not None: Greg, I know there's a dearth of documentation on writing regression tests for Python, but for the the unittest-based tests we're moving to, we're sticking with "test_" for the test method prefix; this avoids needing to pass the extra parameter when building the test suite since the default for PyUnit is "test". I'd like to also stick with lower-case names separated by underscores as well -- camel case is said to be difficult for non-native English speakers. I have assigned a bug to myself to deal with the lack of documentation. -Fred -- Fred L. Drake, Jr. PythonLabs at Digital Creations From jackjansen@users.sourceforge.net Tue May 22 23:21:34 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 15:21:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_carbonplugin_config.h,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv20834/Python/Mac/mwerks Modified Files: mwerks_carbonplugin_config.h Log Message: Added WITHOUT_FRAMEWORKS and USE_TOOLBOX_OBJECT_GLUE defines. Index: mwerks_carbonplugin_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_carbonplugin_config.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mwerks_carbonplugin_config.h 2001/05/14 14:59:43 1.2 --- mwerks_carbonplugin_config.h 2001/05/22 22:21:32 1.3 *************** *** 7,10 **** --- 7,11 ---- #define TARGET_API_MAC_CARBON_NOTYET 1 /* Things we should do eventually, but not now */ #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ + #define USE_TOOLBOX_OBJECT_GLUE /* Use glue routines for accessing PyArg_Parse/Py_BuildValue helpers */ /* #define USE_GUSI1 /* Stdio implemented with GUSI */ From jackjansen@users.sourceforge.net Tue May 22 23:21:39 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 15:21:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_plugin_config.h,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv20869/Python/Mac/mwerks Modified Files: mwerks_plugin_config.h Log Message: Added WITHOUT_FRAMEWORKS and USE_TOOLBOX_OBJECT_GLUE defines. Index: mwerks_plugin_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_plugin_config.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** mwerks_plugin_config.h 2001/05/14 15:00:00 1.9 --- mwerks_plugin_config.h 2001/05/22 22:21:37 1.10 *************** *** 9,13 **** #endif #define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ ! #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ #define USE_MSL /* Use MSL libraries */ #ifdef USE_MSL --- 9,14 ---- #endif #define WITH_THREAD /* Use thread support (needs GUSI 2, not GUSI 1) */ ! #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ ! #define USE_TOOLBOX_OBJECT_GLUE /* Use glue routines for accessing PyArg_Parse/Py_BuildValue helpers */ #define USE_MSL /* Use MSL libraries */ #ifdef USE_MSL From jackjansen@users.sourceforge.net Tue May 22 23:21:43 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 15:21:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_shared_config.h,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv20896/Python/Mac/mwerks Modified Files: mwerks_shared_config.h Log Message: Added WITHOUT_FRAMEWORKS and USE_TOOLBOX_OBJECT_GLUE defines. Index: mwerks_shared_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_shared_config.h,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** mwerks_shared_config.h 2001/05/14 15:00:06 1.17 --- mwerks_shared_config.h 2001/05/22 22:21:41 1.18 *************** *** 29,32 **** --- 29,33 ---- #define USE_APPEARANCE /* Enable Appearance support */ #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ + #define USE_TOOLBOX_OBJECT_GLUE /* Call toolbox object converters indirectly */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ From jackjansen@users.sourceforge.net Tue May 22 23:21:47 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 15:21:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/mwerks mwerks_shcarbon_config.h,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory usw-pr-cvs1:/tmp/cvs-serv20921/Python/Mac/mwerks Modified Files: mwerks_shcarbon_config.h Log Message: Added WITHOUT_FRAMEWORKS and USE_TOOLBOX_OBJECT_GLUE defines. Index: mwerks_shcarbon_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/mwerks_shcarbon_config.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** mwerks_shcarbon_config.h 2001/05/14 15:00:12 1.2 --- mwerks_shcarbon_config.h 2001/05/22 22:21:45 1.3 *************** *** 34,37 **** --- 34,38 ---- #define USE_APPEARANCE /* Enable Appearance support */ #define WITHOUT_FRAMEWORKS /* Use old-style Universal Header includes, not Carbon/Carbon.h */ + #define USE_TOOLBOX_OBJECT_GLUE /* Call toolbox object converters indirectly */ #define USE_MSL_MALLOC /* Disable private malloc. Also disables next two defines */ From fdrake@users.sourceforge.net Tue May 22 23:32:26 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 15:32:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_copy_reg,1.1,NONE test_dospath,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv23369 Removed Files: test_copy_reg test_dospath Log Message: Remove output files that are no longer needed since the corresponding tests were moved to PyUnit. --- test_copy_reg DELETED --- --- test_dospath DELETED --- From jackjansen@users.sourceforge.net Tue May 22 23:34:58 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 15:34:58 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Include pymactoolbox.h,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv23838/Python/Mac/Include Modified Files: pymactoolbox.h Log Message: Include Carbon/Carbon.h if appropriate. Fixed glue initialization code so prototype is correct. Index: pymactoolbox.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/pymactoolbox.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** pymactoolbox.h 2001/05/19 12:32:39 1.6 --- pymactoolbox.h 2001/05/22 22:34:56 1.7 *************** *** 26,35 **** ** it sets the function pointer to point to the real function. */ ! #define PyMac_INIT_TOOLBOX_OBJECT_NEW(rtn) { \ extern PyObject *(*PyMacGluePtr_##rtn)(object); \ PyMacGluePtr_##rtn = _##rtn; \ } ! #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(rtn) { \ ! extern int (*PyMacGluePtr_##rtn)(object); \ PyMacGluePtr_##rtn = _##rtn; \ } --- 26,35 ---- ** it sets the function pointer to point to the real function. */ ! #define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) { \ extern PyObject *(*PyMacGluePtr_##rtn)(object); \ PyMacGluePtr_##rtn = _##rtn; \ } ! #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) { \ ! extern int (*PyMacGluePtr_##rtn)(PyObject *, object *); \ PyMacGluePtr_##rtn = _##rtn; \ } *************** *** 39,44 **** ** _xxx_New to be the same as xxx_New, and the code in mactoolboxglue isn't included. */ ! #define PyMac_INIT_TOOLBOX_OBJECT_NEW(rtn) ! #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(rtn) #endif /* USE_TOOLBOX_OBJECT_GLUE */ --- 39,44 ---- ** _xxx_New to be the same as xxx_New, and the code in mactoolboxglue isn't included. */ ! #define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) ! #define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) #endif /* USE_TOOLBOX_OBJECT_GLUE */ From fdrake@users.sourceforge.net Tue May 22 23:36:54 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 15:36:54 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.91,2.92 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv24227 Modified Files: dictobject.c Log Message: Remove unused variable. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.91 retrieving revision 2.92 diff -C2 -r2.91 -r2.92 *** dictobject.c 2001/05/22 20:40:22 2.91 --- dictobject.c 2001/05/22 22:36:52 2.92 *************** *** 396,400 **** dictresize(dictobject *mp, int minused) { - register int oldsize = mp->ma_size; register int newsize, newpoly; register dictentry *oldtable = mp->ma_table; --- 396,399 ---- From jackjansen@users.sourceforge.net Tue May 22 23:37:07 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Tue, 22 May 2001 15:37:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Python macgetargv.c,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Python In directory usw-pr-cvs1:/tmp/cvs-serv24230 Modified Files: macgetargv.c Log Message: removed a routine that has moved to macglue.c Index: macgetargv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Python/macgetargv.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -r1.22 -r1.23 *** macgetargv.c 2001/05/19 12:55:57 1.22 --- macgetargv.c 2001/05/22 22:37:05 1.23 *************** *** 88,112 **** } - /* Given an FSSpec, return the FSSpec of the parent folder */ - - static OSErr - get_folder_parent (FSSpec * fss, FSSpec * parent) - { - CInfoPBRec rec; - short err; - - * parent = * fss; - rec.hFileInfo.ioNamePtr = parent->name; - rec.hFileInfo.ioVRefNum = parent->vRefNum; - rec.hFileInfo.ioDirID = parent->parID; - rec.hFileInfo.ioFDirIndex = -1; - rec.hFileInfo.ioFVersNum = 0; - if (err = PBGetCatInfoSync (& rec)) - return err; - parent->parID = rec.dirInfo.ioDrParID; - /* parent->name[0] = 0; */ - return 0; - } - /* Check that there aren't any args remaining in the event */ --- 88,91 ---- From gvanrossum@users.sourceforge.net Wed May 23 00:39:13 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Tue, 22 May 2001 16:39:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib HTMLParser.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv1550 Modified Files: HTMLParser.py Log Message: Removed incorrect comment left over from sgmllib.py. Index: HTMLParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/HTMLParser.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** HTMLParser.py 2001/05/18 14:50:52 1.1 --- HTMLParser.py 2001/05/22 23:39:10 1.2 *************** *** 76,87 **** # HTML parser class -- find tags and call handler functions. # Usage: p = HTMLParser(); p.feed(data); ...; p.close(). ! # The dtd is defined by deriving a class which defines methods ! # with special names to handle tags: start_foo and end_foo to handle ! # and , respectively, or do_foo to handle by itself. ! # (Tags are converted to lower case for this purpose.) The data ! # between tags is passed to the parser by calling self.handle_data() ! # with some data as argument (the data may be split up in arbitrary ! # chunks). Entity references are passed by calling # self.handle_entityref() with the entity reference as argument. class HTMLParser: --- 76,87 ---- # HTML parser class -- find tags and call handler functions. # Usage: p = HTMLParser(); p.feed(data); ...; p.close(). ! ! # Start tags are handled by calling self.handle_starttag() or ! # self.handle_startendtag(); end tags by self.handle_endtag(). The ! # data between tags is passed to the parser by calling ! # self.handle_data() with some data as argument (the data may be split ! # up in arbitrary chunks). Entity references are passed by calling # self.handle_entityref() with the entity reference as argument. + # Etc. class HTMLParser: From tim.one@home.com Wed May 23 01:41:58 2001 From: tim.one@home.com (Tim Peters) Date: Tue, 22 May 2001 20:41:58 -0400 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.91,2.92 In-Reply-To: Message-ID: [Fred L. Drake] > Update of /cvsroot/python/python/dist/src/Objects > In directory usw-pr-cvs1:/tmp/cvs-serv24227 > > Modified Files: > dictobject.c > Log Message: > > Remove unused variable. > > > Index: dictobject.c > ... > dictresize(dictobject *mp, int minused) > { > - register int oldsize = mp->ma_size; Thanks, Fred! I tried deleting it a few times myself, but it turned out that all but the last version of the code still used it. Indeed, the patch was largely driven by an obsession to remove that offensive line . From tim_one@users.sourceforge.net Wed May 23 02:45:21 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 22 May 2001 18:45:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_difflib,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv18817/python/dist/src/Lib/test/output Removed Files: test_difflib Log Message: Remove test_difflib's output file and change test_difflib to stop generating it. Since this is purely a doctest, the output file never served a good purpose. --- test_difflib DELETED --- From tim_one@users.sourceforge.net Wed May 23 02:45:21 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 22 May 2001 18:45:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_difflib.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv18817/python/dist/src/Lib/test Modified Files: test_difflib.py Log Message: Remove test_difflib's output file and change test_difflib to stop generating it. Since this is purely a doctest, the output file never served a good purpose. Index: test_difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_difflib.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_difflib.py 2001/02/10 08:00:53 1.1 --- test_difflib.py 2001/05/23 01:45:19 1.2 *************** *** 1,2 **** import doctest, difflib ! doctest.testmod(difflib, verbose=1) --- 1,2 ---- import doctest, difflib ! doctest.testmod(difflib, verbose=0) From fdrake@users.sourceforge.net Wed May 23 05:53:46 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 21:53:46 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib HTMLParser.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv13706/Lib Modified Files: HTMLParser.py Log Message: Merge my changes to the offending comment with Guido's changes. Index: HTMLParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/HTMLParser.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** HTMLParser.py 2001/05/22 23:39:10 1.2 --- HTMLParser.py 2001/05/23 04:53:44 1.3 *************** *** 75,87 **** # HTML parser class -- find tags and call handler functions. ! # Usage: p = HTMLParser(); p.feed(data); ...; p.close(). # Start tags are handled by calling self.handle_starttag() or # self.handle_startendtag(); end tags by self.handle_endtag(). The ! # data between tags is passed to the parser by calling ! # self.handle_data() with some data as argument (the data may be split ! # up in arbitrary chunks). Entity references are passed by calling ! # self.handle_entityref() with the entity reference as argument. ! # Etc. class HTMLParser: --- 75,91 ---- # HTML parser class -- find tags and call handler functions. ! # Usage: ! # ! # p = HTMLParser(); p.feed(data); ...; p.close() # Start tags are handled by calling self.handle_starttag() or # self.handle_startendtag(); end tags by self.handle_endtag(). The ! # data between tags is passed from the parser to the derived class by ! # calling self.handle_data() with the data as argument (the data may ! # be split up in arbitrary chunks). Entity references are passed by ! # calling self.handle_entityref() with the entity reference as the ! # argument. Numeric character references are passed to ! # self.handle_charref() with the string containing the reference as ! # the argument. class HTMLParser: From fdrake@users.sourceforge.net Wed May 23 05:57:51 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 22 May 2001 21:57:51 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test README,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv14199/Lib/test Modified Files: README Log Message: Update to reflect recent changes to regrtest and the new approaches to testing using doctest and PyUnit. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/README,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** README 2000/10/23 16:37:14 1.6 --- README 2001/05/23 04:57:49 1.7 *************** *** 9,20 **** If you add a new module to Python or modify the functionality of an existing module, you should write one or more test cases to exercise that new ! functionality. The mechanics of how the test system operates are fairly ! straightforward. When a test case is run, the output is compared with the ! expected output that is stored in .../Lib/test/output. If the test runs to ! completion and the actual and expected outputs match, the test succeeds, if ! not, it fails. If an ImportError or test_support.TestSkipped error is ! raised, the test is not run. ! You will be writing unit tests (isolated tests of functions and objects defined by the module) using white box techniques. Unlike black box testing, where you only have the external interfaces to guide your test case --- 9,23 ---- If you add a new module to Python or modify the functionality of an existing module, you should write one or more test cases to exercise that new ! functionality. There are different ways to do this within the regression ! testing facility provided with Python; any particular test should use only ! one of these options. Each option requires writing a test module using the ! conventions of the the selected option: ! ! - PyUnit based tests ! - doctest based tests ! - "traditional" Python test modules ! Regardless of the mechanics of the testing approach you choose, ! you will be writing unit tests (isolated tests of functions and objects defined by the module) using white box techniques. Unlike black box testing, where you only have the external interfaces to guide your test case *************** *** 24,28 **** --- 27,72 ---- your regression test cases. + PyUnit based tests + + The PyUnit framework is based on the ideas of unit testing as espoused + by Kent Beck and the Extreme Programming (XP) movement. The specific + interface provided by the framework is tightly based on the JUnit + Java implementation of Beck's original SmallTalk test framework. Please + see the documentation of the unittest module for detailed information on + the interface and general guidelines on writing PyUnit based tests. + + The test_support helper module provides a single function for use by + PyUnit based tests in the Python regression testing framework: + run_unittest() takes a unittest.TestCase derived class as a parameter + and runs the tests defined in that class. All test methods in the + Python regression framework have names that start with "test_" and use + lower-case names with words separated with underscores. + + doctest based tests + + Tests written to use doctest are actually part of the docstrings for + the module being tested. Each test is written as a display of an + interactive session, including the Python prompts, statements that would + be typed by the user, and the output of those statements (including + tracebacks!). The module in the test package is simply a wrapper that + causes doctest to run over the tests in the module. The test for the + doctest module provides a convenient example: + + import doctest + doctest.testmod(doctest, verbose=1) + See the documentation for the doctest module for information on + writing tests using the doctest framework. + + "traditional" Python test modules + + The mechanics of how the "traditional" test system operates are fairly + straightforward. When a test case is run, the output is compared with the + expected output that is stored in .../Lib/test/output. If the test runs to + completion and the actual and expected outputs match, the test succeeds, if + not, it fails. If an ImportError or test_support.TestSkipped error is + raised, the test is not run. + + Executing Test Cases *************** *** 35,38 **** --- 79,86 ---- ./python Lib/test/regrtest.py -g test_spam.py + + (If your test does not generate any output when run successfully, this + step may be skipped; no file containing expected output will be needed + in this case.) Any time you modify test_spam.py you need to generate a new expected From tim_one@users.sourceforge.net Wed May 23 08:46:38 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 23 May 2001 00:46:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_doctest,1.5,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv5835/python/dist/src/Lib/test/output Removed Files: test_doctest Log Message: Remove test_doctest's expected-output file. Change test_doctest and test_difflib to pass regrtest's notion of verbosity on to doctest. Add explanation for a dozen "new" things to test/README. --- test_doctest DELETED --- From tim_one@users.sourceforge.net Wed May 23 08:46:38 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 23 May 2001 00:46:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test README,1.7,1.8 test_difflib.py,1.2,1.3 test_doctest.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5835/python/dist/src/Lib/test Modified Files: README test_difflib.py test_doctest.py Log Message: Remove test_doctest's expected-output file. Change test_doctest and test_difflib to pass regrtest's notion of verbosity on to doctest. Add explanation for a dozen "new" things to test/README. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/README,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** README 2001/05/23 04:57:49 1.7 --- README 2001/05/23 07:46:36 1.8 *************** *** 1,6 **** ! Writing Python Regression Tests ! ------------------------------- ! Skip Montanaro ! (skip@mojam.com) --- 1,6 ---- ! Writing Python Regression Tests ! ------------------------------- ! Skip Montanaro ! (skip@mojam.com) *************** *** 27,30 **** --- 27,31 ---- your regression test cases. + PyUnit based tests *************** *** 43,46 **** --- 44,48 ---- lower-case names with words separated with underscores. + doctest based tests *************** *** 49,62 **** interactive session, including the Python prompts, statements that would be typed by the user, and the output of those statements (including ! tracebacks!). The module in the test package is simply a wrapper that ! causes doctest to run over the tests in the module. The test for the ! doctest module provides a convenient example: ! import doctest ! doctest.testmod(doctest, verbose=1) See the documentation for the doctest module for information on writing tests using the doctest framework. "traditional" Python test modules --- 51,72 ---- interactive session, including the Python prompts, statements that would be typed by the user, and the output of those statements (including ! tracebacks, although only the exception msg needs to be retained then). ! The module in the test package is simply a wrapper that causes doctest ! to run over the tests in the module. The test for the difflib module ! provides a convenient example: ! ! from test_support import verbose ! import doctest, difflib ! doctest.testmod(difflib, verbose=verbose) ! If the test is successful, nothing is written to stdout (so you should not ! create a corresponding output/test_difflib file), but running regrtest ! with -v will give a detailed report, the same as if passing -v to doctest ! (that's what importing verbose from test_support accomplishes). See the documentation for the doctest module for information on writing tests using the doctest framework. + "traditional" Python test modules *************** *** 72,91 **** If you are writing test cases for module spam, you need to create a file ! in .../Lib/test named test_spam.py and an expected output file in ! .../Lib/test/output named test_spam ("..." represents the top-level ! directory in the Python source tree, the directory containing the configure ! script). From the top-level directory, generate the initial version of the ! test output file by executing: ./python Lib/test/regrtest.py -g test_spam.py ! (If your test does not generate any output when run successfully, this ! step may be skipped; no file containing expected output will be needed ! in this case.) Any time you modify test_spam.py you need to generate a new expected output file. Don't forget to desk check the generated output to make sure ! it's really what you expected to find! To run a single test after modifying ! a module, simply run regrtest.py without the -g flag: ./python Lib/test/regrtest.py test_spam.py --- 82,104 ---- If you are writing test cases for module spam, you need to create a file ! in .../Lib/test named test_spam.py. In addition, if the tests are expected ! to write to stdout during a successful run, you also need to create an ! expected output file in .../Lib/test/output named test_spam ("..." ! represents the top-level directory in the Python source tree, the directory ! containing the configure script). If needed, generate the initial version ! of the test output file by executing: ./python Lib/test/regrtest.py -g test_spam.py ! from the top-level directory. Any time you modify test_spam.py you need to generate a new expected output file. Don't forget to desk check the generated output to make sure ! it's really what you expected to find! All in all it's usually better ! not to have an expected-out file (note that doctest- and unittest-based ! tests do not). ! ! To run a single test after modifying a module, simply run regrtest.py ! without the -g flag: ./python Lib/test/regrtest.py test_spam.py *************** *** 96,109 **** ./python Lib/test/test_spam.py ! To run the entire test suite, make the "test" target at the top level: make test ! On non-Unix platforms where make may not be available, you can simply ! execute the two runs of regrtest (optimized and non-optimized) directly: ./python Lib/test/regrtest.py ./python -O Lib/test/regrtest.py Test cases generate output based upon values computed by the test code. --- 109,132 ---- ./python Lib/test/test_spam.py ! To run the entire test suite: + [UNIX, + other platforms where "make" works] Make the "test" target at the + top level: + make test + + {WINDOWS] Run rt.bat from your PCBuild directory. Read the comments at + the top of rt.bat for the use of special -d, -O and -q options processed + by rt.bat. ! [OTHER] You can simply execute the two runs of regrtest (optimized and ! non-optimized) directly: ./python Lib/test/regrtest.py ./python -O Lib/test/regrtest.py + But note that this way picks up whatever .pyc and .pyo files happen to be + around. The makefile and rt.bat ways run the tests twice, the first time + removing all .pyc and .pyo files from the subtree rooted at Lib/. Test cases generate output based upon values computed by the test code. *************** *** 173,177 **** Each test case is different. There is no "standard" form for a Python ! regression test case, though there are some general rules: * If your test case detects a failure, raise TestFailed (found in --- 196,202 ---- Each test case is different. There is no "standard" form for a Python ! regression test case, though there are some general rules (note that ! these mostly apply only to the "classic" tests; unittest- and doctest- ! based tests should follow the conventions natural to those frameworks): * If your test case detects a failure, raise TestFailed (found in *************** *** 213,224 **** file support), even if all the required modules are available. - * findfile(file) - you can call this function to locate a file somewhere - along sys.path or in the Lib/test tree - see test_linuxaudiodev.py for - an example of its use. - * verbose - you can use this variable to control print output. Many modules use it. Search for "verbose" in the test_*.py files to see lots of examples. * use_large_resources - true iff tests requiring large time or space should be run. --- 238,267 ---- file support), even if all the required modules are available. * verbose - you can use this variable to control print output. Many modules use it. Search for "verbose" in the test_*.py files to see lots of examples. + * verify(condition, reason='test failed'). Use this instead of + + assert condition[, reason] + + verify() has two advantages over assert: it works even in -O mode, + and it raises TestFailed on failure instead of AssertionError. + + * TESTFN - a string that should always be used as the filename when you + need to create a temp file. Also use try/finally to ensure that your + temp files are deleted before your test completes. Note that you + cannot unlink an open file on all operating systems, so also be sure + to close temp files before trying to unlink them. + + * sortdict(dict) - acts like repr(dict.items()), but sorts the items + first. This is important when printing a dict value, because the + order of items produced by dict.items() is not defined by the + language. + + * findfile(file) - you can call this function to locate a file somewhere + along sys.path or in the Lib/test tree - see test_linuxaudiodev.py for + an example of its use. + * use_large_resources - true iff tests requiring large time or space should be run. *************** *** 259,260 **** --- 302,330 ---- where coverage is adequate or lacking and write test cases to beef up the coverage. + + + Some Non-Obvious regrtest Features + + * Automagic test detection: When you create a new test file + test_spam.py, you do not need to modify regrtest (or anything else) + to advertise its existence. regrtest searches for and runs all + modules in the test directory with names of the form test_xxx.py. + + * Miranda output: If, when running test_spam.py, regrtest does not + find an expected-output file test/output/test_spam, regrtest + pretends that it did find one, containing the single line + + test_spam + + This allows new tests that don't expect to print anything to stdout + to not bother creating expected-output files. + + * Two-stage testing: To run test_spam.py, regrtest imports test_spam + as a module. Most tests run to completion as a side-effect of + getting imported. After importing test_spam, regrtest also executes + test_spam.test_main(), if test_spam has a "test_main" attribute. + This is rarely needed, and you shouldn't create a module global + with name test_main unless you're specifically exploiting this + gimmick. In such cases, please put a comment saying so near your + def test_main, because this feature is so rarely used it's not + obvious when reading the test code. Index: test_difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_difflib.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_difflib.py 2001/05/23 01:45:19 1.2 --- test_difflib.py 2001/05/23 07:46:36 1.3 *************** *** 1,2 **** import doctest, difflib ! doctest.testmod(difflib, verbose=0) --- 1,3 ---- + from test_support import verbose import doctest, difflib ! doctest.testmod(difflib, verbose=verbose) Index: test_doctest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_doctest.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_doctest.py 2001/02/10 01:36:47 1.1 --- test_doctest.py 2001/05/23 07:46:36 1.2 *************** *** 1,2 **** import doctest ! doctest.testmod(doctest, verbose=1) --- 1,3 ---- + from test_support import verbose import doctest ! doctest.testmod(doctest, verbose=verbose) From jackjansen@users.sourceforge.net Wed May 23 09:55:52 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Wed, 23 May 2001 01:55:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Include config.h,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Include In directory usw-pr-cvs1:/tmp/cvs-serv17831/python/Mac/Include Modified Files: config.h Log Message: Updated to reflect the current state of config.h.in. Index: config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/config.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** config.h 2001/02/12 14:59:13 1.31 --- config.h 2001/05/23 08:55:50 1.32 *************** *** 136,139 **** --- 136,142 ---- #undef clock_t + /* Defined on Solaris to see additional function prototypes. */ + #undef __EXTENSIONS__ + /* Define if getpgrp() must be called as getpgrp(0). */ #undef GETPGRP_HAVE_ARG *************** *** 275,284 **** linker (rld). Dyld is necessary to support frameworks. */ #undef WITH_DYLD - - /* Define if you want to use BSD db. */ - #undef WITH_LIBDB ! /* Define if you want to use ndbm. */ ! #undef WITH_LIBNDBM /* Define if you want to produce an OpenStep/Rhapsody framework --- 278,284 ---- linker (rld). Dyld is necessary to support frameworks. */ #undef WITH_DYLD ! /* Define if you want to compile in Python-specific mallocs */ ! #undef WITH_PYMALLOC /* Define if you want to produce an OpenStep/Rhapsody framework *************** *** 416,420 **** #endif ! /* Define if you have getpgrp. */ #undef HAVE_GETPGRP --- 416,420 ---- #endif ! /* Define if you have the getpgrp function. */ #undef HAVE_GETPGRP *************** *** 481,485 **** /* Define if you have the pthread_init function. */ - /* XXXX GUSI threads* */ #undef HAVE_PTHREAD_INIT --- 481,484 ---- *************** *** 667,670 **** --- 666,672 ---- #undef HAVE_SYS_LOCK_H + /* Define if you have the header file. */ + #undef HAVE_SYS_MODEM_H + /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H *************** *** 718,721 **** --- 720,724 ---- /* Define if you have the ieee library (-lieee). */ #undef HAVE_LIBIEEE + #ifdef __CYGWIN__ #ifdef USE_DL_IMPORT From twouters@users.sourceforge.net Wed May 23 12:32:08 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 04:32:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules termios.c,2.24.2.1,2.24.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv17552/dist/src/Modules Modified Files: Tag: release21-maint termios.c Log Message: Backport Fred's checkin 2.29: Correct the sense of a couple of conditional compilations -- used #ifndef when #ifdef was needed. This closes (reallu!) SF bug #417418. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.24.2.1 retrieving revision 2.24.2.2 diff -C2 -r2.24.2.1 -r2.24.2.2 *** termios.c 2001/05/11 16:34:23 2.24.2.1 --- termios.c 2001/05/23 11:32:06 2.24.2.2 *************** *** 537,544 **** {"VSUSP", VSUSP}, {"VEOL", VEOL}, ! #ifndef VREPRINT {"VREPRINT", VREPRINT}, #endif ! #ifndef VDISCARD {"VDISCARD", VDISCARD}, #endif --- 537,544 ---- {"VSUSP", VSUSP}, {"VEOL", VEOL}, ! #ifdef VREPRINT {"VREPRINT", VREPRINT}, #endif ! #ifdef VDISCARD {"VDISCARD", VDISCARD}, #endif From twouters@users.sourceforge.net Wed May 23 13:11:38 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 05:11:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.196,2.196.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv24402/Python Modified Files: Tag: release21-maint compile.c Log Message: Backport Jeremy's checkin 2.198: Fix 2.1 nested scopes crash reported by Evan Simpson The new test case demonstrates the bug. Be more careful in symtable_resolve_free() to add a var to cells or frees only if it won't be added under some other rule. XXX Add new assertion that will catch this bug. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.196 retrieving revision 2.196.2.1 diff -C2 -r2.196 -r2.196.2.1 *** compile.c 2001/04/14 17:51:48 2.196 --- compile.c 2001/05/23 12:11:35 2.196.2.1 *************** *** 4070,4074 **** static int ! symtable_resolve_free(struct compiling *c, PyObject *name, struct symbol_info *si) { --- 4070,4074 ---- static int ! symtable_resolve_free(struct compiling *c, PyObject *name, int flags, struct symbol_info *si) { *************** *** 4080,4088 **** method and a free variable with the same name. */ - if (c->c_symtable->st_cur->ste_type == TYPE_FUNCTION) { v = PyInt_FromLong(si->si_ncells++); dict = c->c_cellvars; } else { v = PyInt_FromLong(si->si_nfrees++); dict = c->c_freevars; --- 4080,4096 ---- 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))) + return 0; v = PyInt_FromLong(si->si_ncells++); dict = c->c_cellvars; } else { + /* If it is free anyway, then there is no need to do + anything here. + */ + if (is_free(flags ^ DEF_FREE_CLASS) + || flags == DEF_FREE_CLASS) + return 0; v = PyInt_FromLong(si->si_nfrees++); dict = c->c_freevars; *************** *** 4370,4377 **** */ if (flags & (DEF_FREE | DEF_FREE_CLASS)) { ! if ((ste->ste_type == TYPE_CLASS ! && flags != DEF_FREE_CLASS) ! || (flags & (DEF_LOCAL | DEF_PARAM))) ! symtable_resolve_free(c, name, &si); } --- 4378,4382 ---- */ if (flags & (DEF_FREE | DEF_FREE_CLASS)) { ! symtable_resolve_free(c, name, flags, &si); } *************** *** 4432,4435 **** --- 4437,4449 ---- } } + + /* + fprintf(stderr, + "cells %d: %s\n" + "frees %d: %s\n", + si.si_ncells, PyObject_REPR(c->c_cellvars), + si.si_nfrees, PyObject_REPR(c->c_freevars)); + */ + assert(PyDict_Size(c->c_freevars) == si.si_nfrees); if (si.si_ncells > 1) { /* one cell is always in order */ From twouters@users.sourceforge.net Wed May 23 13:15:19 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 05:15:19 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_scope.py,1.14,1.14.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv25199/Lib/test Modified Files: Tag: release21-maint test_scope.py Log Message: Backport Jeremy's checkin 1.15: Fix 2.1 nested scopes crash reported by Evan Simpson The new test case demonstrates the bug. Be more careful in symtable_resolve_free() to add a var to cells or frees only if it won't be added under some other rule. XXX Add new assertion that will catch this bug. Index: test_scope.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v retrieving revision 1.14 retrieving revision 1.14.2.1 diff -C2 -r1.14 -r1.14.2.1 *** test_scope.py 2001/04/13 16:51:46 1.14 --- test_scope.py 2001/05/23 12:15:17 1.14.2.1 *************** *** 437,438 **** --- 437,449 ---- verify(d == {'x': 2, 'y': 7, 'w': 6}) + print "19. var is bound and free in class" + + def f(x): + class C: + def m(self): + return x + a = x + return C + + inst = f(3)() + verify(inst.a == inst.m()) From twouters@users.sourceforge.net Wed May 23 13:15:59 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 05:15:59 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_scope,1.6,1.6.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv25389/Lib/test/output Modified Files: Tag: release21-maint test_scope Log Message: Backport Jeremy's checkin 1.7: Fix 2.1 nested scopes crash reported by Evan Simpson The new test case demonstrates the bug. Be more careful in symtable_resolve_free() to add a var to cells or frees only if it won't be added under some other rule. XXX Add new assertion that will catch this bug. Index: test_scope =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_scope,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -C2 -r1.6 -r1.6.2.1 *** test_scope 2001/03/21 16:44:39 1.6 --- test_scope 2001/05/23 12:15:57 1.6.2.1 *************** *** 18,19 **** --- 18,20 ---- 17. class and global 18. verify that locals() works + 19. var is bound and free in class From twouters@users.sourceforge.net Wed May 23 13:31:01 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 05:31:01 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.102,2.102.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28190/Objects Modified Files: Tag: release21-maint stringobject.c Log Message: Backport Tim's checkin 2.104: A different approach to the problem reported in Patch #419651: Metrowerks on Mac adds 0x itself C std says %#x and %#X conversion of 0 do not add the 0x/0X base marker. Metrowerks apparently does. Mark Favas reported the same bug under a Compaq compiler on Tru64 Unix, but no other libc broken in this respect is known (known to be OK under MSVC and gcc). So just try the damn thing at runtime and see what the platform does. Note that we've always had bugs here, but never knew it before because a relevant test case didn't exist before 2.1. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.102 retrieving revision 2.102.2.1 diff -C2 -r2.102 -r2.102.2.1 *** stringobject.c 2001/04/12 18:38:48 2.102 --- stringobject.c 2001/05/23 12:30:59 2.102.2.1 *************** *** 2674,2680 **** * but we want it (for consistency with other %#x conversions, and * for consistency with Python's hex() function). */ ! if (x == 0 && (flags & F_ALT) && (type == 'x' || type == 'X')) { ! assert(buf[1] != type); /* else this C *is* adding 0x/0X */ memmove(buf+2, buf, strlen(buf) + 1); buf[0] = '0'; --- 2674,2684 ---- * but we want it (for consistency with other %#x conversions, and * for consistency with Python's hex() function). + * BUG 28-Apr-2001 tim: At least two platform Cs (Metrowerks & + * Compaq Tru64) violate the std by converting 0 w/ leading 0x anyway. + * So add it only if the platform didn't already. */ ! if (x == 0 && (flags & F_ALT) && (type == 'x' || type == 'X') && ! buf[1] != (char)type) /* this last always true under std C */ ! { memmove(buf+2, buf, strlen(buf) + 1); buf[0] = '0'; From twouters@users.sourceforge.net Wed May 23 13:31:27 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 05:31:27 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.82,2.82.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv28351/Objects Modified Files: Tag: release21-maint unicodeobject.c Log Message: Backport of Tim's checkin 2.88: A different approach to the problem reported in Patch #419651: Metrowerks on Mac adds 0x itself C std says %#x and %#X conversion of 0 do not add the 0x/0X base marker. Metrowerks apparently does. Mark Favas reported the same bug under a Compaq compiler on Tru64 Unix, but no other libc broken in this respect is known (known to be OK under MSVC and gcc). So just try the damn thing at runtime and see what the platform does. Note that we've always had bugs here, but never knew it before because a relevant test case didn't exist before 2.1. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.82 retrieving revision 2.82.2.1 diff -C2 -r2.82 -r2.82.2.1 *** unicodeobject.c 2001/04/12 18:38:48 2.82 --- unicodeobject.c 2001/05/23 12:31:25 2.82.2.1 *************** *** 4671,4674 **** --- 4671,4675 ---- char fmt[64]; /* plenty big enough! */ long x; + int use_native_c_format = 1; x = PyInt_AsLong(v); *************** *** 4687,4695 **** * but we want it (for consistency with other %#x conversions, and * for consistency with Python's hex() function). */ ! if (x == 0 && (flags & F_ALT) && (type == 'x' || type == 'X')) ! sprintf(fmt, "0%c%%%s.%dl%c", type, "#", prec, type); ! else ! sprintf(fmt, "%%%s.%dl%c", (flags & F_ALT) ? "#" : "", prec, type); return usprintf(buf, fmt, x); } --- 4688,4706 ---- * but we want it (for consistency with other %#x conversions, and * for consistency with Python's hex() function). + * BUG 28-Apr-2001 tim: At least two platform Cs (Metrowerks & + * Compaq Tru64) violate the std by converting 0 w/ leading 0x anyway. + * So add it only if the platform doesn't already. */ ! if (x == 0 && (flags & F_ALT) && (type == 'x' || type == 'X')) { ! /* Only way to know what the platform does is to try it. */ ! sprintf(fmt, type == 'x' ? "%#x" : "%#X", 0); ! if (fmt[1] != (char)type) { ! /* Supply our own leading 0x/0X -- needed under std C */ ! use_native_c_format = 0; ! sprintf(fmt, "0%c%%#.%dl%c", type, prec, type); ! } ! } ! if (use_native_c_format) ! sprintf(fmt, "%%%s.%dl%c", (flags & F_ALT) ? "#" : "", prec, type); return usprintf(buf, fmt, x); } From twouters@users.sourceforge.net Wed May 23 13:46:48 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 05:46:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.197,2.197.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv30835/Python Modified Files: Tag: release21-maint bltinmodule.c Log Message: Backport Tim's checkin 2.199: Fix buglet reported on c.l.py: map(fnc, file.xreadlines()) blows up. Took away map()'s insistence that sequences support __len__, and cleaned up the convoluted code that made it *look* like it really cared about __len__ (in fact the old ->len field was only *used* as a flag bit, as the main loop only looked at its sign bit, setting the field to -1 when IndexError got raised; renamed the field to ->saw_IndexError instead). Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.197 retrieving revision 2.197.2.1 diff -C2 -r2.197 -r2.197.2.1 *** bltinmodule.c 2001/04/07 20:34:48 2.197 --- bltinmodule.c 2001/05/23 12:46:45 2.197.2.1 *************** *** 817,824 **** PyCompilerFlags cf; cf.cf_nested_scopes = 1; ! res = PyRun_FileExFlags(fp, filename, Py_file_input, globals, locals, 1, &cf); ! } else ! res = PyRun_FileEx(fp, filename, Py_file_input, globals, locals, 1); return res; --- 817,824 ---- PyCompilerFlags cf; cf.cf_nested_scopes = 1; ! res = PyRun_FileExFlags(fp, filename, Py_file_input, globals, locals, 1, &cf); ! } else ! res = PyRun_FileEx(fp, filename, Py_file_input, globals, locals, 1); return res; *************** *** 925,929 **** PyObject *seq; PySequenceMethods *sqf; ! int len; } sequence; --- 925,929 ---- PyObject *seq; PySequenceMethods *sqf; ! int saw_IndexError; } sequence; *************** *** 953,956 **** --- 953,960 ---- } + /* Do a first pass to (a) verify the args are sequences; (b) set + * len to the largest of their lengths; (c) initialize the seqs + * descriptor vector. + */ for (len = 0, i = 0, sqp = seqs; i < n; ++i, ++sqp) { int curlen; *************** *** 960,966 **** goto Fail_2; sqp->sqf = sqf = sqp->seq->ob_type->tp_as_sequence; if (sqf == NULL || - sqf->sq_length == NULL || sqf->sq_item == NULL) { --- 964,971 ---- goto Fail_2; + sqp->saw_IndexError = 0; + sqp->sqf = sqf = sqp->seq->ob_type->tp_as_sequence; if (sqf == NULL || sqf->sq_item == NULL) { *************** *** 974,980 **** } ! if ((curlen = sqp->len = (*sqp->sqf->sq_length)(sqp->seq)) < 0) goto Fail_2; - if (curlen > len) len = curlen; --- 979,989 ---- } ! if (sqf->sq_length == NULL) ! /* doesn't matter -- make something up */ ! curlen = 8; ! else ! curlen = (*sqf->sq_length)(sqp->seq); ! if (curlen < 0) goto Fail_2; if (curlen > len) len = curlen; *************** *** 984,987 **** --- 993,997 ---- goto Fail_2; + /* Iterate over the sequences until all have raised IndexError. */ for (i = 0; ; ++i) { PyObject *alist, *item=NULL, *value; *************** *** 996,1000 **** for (j = 0, sqp = seqs; j < n; ++j, ++sqp) { ! if (sqp->len < 0) { Py_INCREF(Py_None); item = Py_None; --- 1006,1010 ---- for (j = 0, sqp = seqs; j < n; ++j, ++sqp) { ! if (sqp->saw_IndexError) { Py_INCREF(Py_None); item = Py_None; *************** *** 1009,1013 **** Py_INCREF(Py_None); item = Py_None; ! sqp->len = -1; } else { --- 1019,1023 ---- Py_INCREF(Py_None); item = Py_None; ! sqp->saw_IndexError = 1; } else { From twouters@users.sourceforge.net Wed May 23 13:51:24 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 05:51:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.175,2.175.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv31242/Python Modified Files: Tag: release21-maint import.c Log Message: Backport of Tim's checkin 2.177: SF bug #417093: Case sensitive import: dir and .py file w/ same name Directory containing Spam.py spam/__init__.py Then "import Spam" caused a SystemError, because code checking for the existence of "Spam/__init__.py" finds it on a case-insensitive filesystem, but then bails because the directory it finds it in doesn't match case, and then old code assumed that was still an error even though it isn't anymore. Changed the code to just continue looking in this case (instead of calling it an error). So import Spam and import spam both work now. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.175 retrieving revision 2.175.2.1 diff -C2 -r2.175 -r2.175.2.1 *** import.c 2001/04/13 17:50:20 2.175 --- import.c 2001/05/23 12:51:22 2.175.2.1 *************** *** 959,970 **** and there's an __init__ module in that directory */ #ifdef HAVE_STAT ! if (stat(buf, &statbuf) == 0 && ! S_ISDIR(statbuf.st_mode) && ! find_init_module(buf)) { ! if (case_ok(buf, len, namelen, name)) ! return &fd_package; ! else ! return NULL; ! } #else /* XXX How are you going to test for directories? */ --- 959,967 ---- and there's an __init__ module in that directory */ #ifdef HAVE_STAT ! if (stat(buf, &statbuf) == 0 && /* it exists */ ! S_ISDIR(statbuf.st_mode) && /* it's a directory */ ! find_init_module(buf) && /* it has __init__.py */ ! case_ok(buf, len, namelen, name)) /* and case matches */ ! return &fd_package; #else /* XXX How are you going to test for directories? */ From twouters@users.sourceforge.net Wed May 23 14:03:16 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 06:03:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects classobject.c,2.125,2.125.2.1 object.c,2.124.2.2,2.124.2.3 stringobject.c,2.102.2.1,2.102.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1685/Objects Modified Files: Tag: release21-maint classobject.c object.c stringobject.c Log Message: Net result of Guido's checkins of object.c (2.125 and 2.126), classobject.c (2.128) and stringobject.c (2.105), which reworks PyObject_Str() and PyObject_Repr() so strings and instances aren't special-cased, and print >> file, instance works like expected in all cases. Index: classobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/classobject.c,v retrieving revision 2.125 retrieving revision 2.125.2.1 diff -C2 -r2.125 -r2.125.2.1 *** classobject.c 2001/03/23 04:19:27 2.125 --- classobject.c 2001/05/23 13:03:13 2.125.2.1 *************** *** 782,785 **** --- 782,804 ---- } + static PyObject * + instance_str(PyInstanceObject *inst) + { + PyObject *func; + PyObject *res; + static PyObject *strstr; + + if (strstr == NULL) + strstr = PyString_InternFromString("__str__"); + func = instance_getattr(inst, strstr); + if (func == NULL) { + PyErr_Clear(); + return instance_repr(inst); + } + res = PyEval_CallObject(func, (PyObject *)NULL); + Py_DECREF(func); + return res; + } + static long instance_hash(PyInstanceObject *inst) *************** *** 1767,1771 **** (hashfunc)instance_hash, /* tp_hash */ 0, /* tp_call */ ! 0, /* tp_str */ (getattrofunc)instance_getattr, /* tp_getattro */ (setattrofunc)instance_setattr, /* tp_setattro */ --- 1786,1790 ---- (hashfunc)instance_hash, /* tp_hash */ 0, /* tp_call */ ! (reprfunc)instance_str, /* tp_str */ (getattrofunc)instance_getattr, /* tp_getattro */ (setattrofunc)instance_setattr, /* tp_setattro */ Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.2.2 retrieving revision 2.124.2.3 diff -C2 -r2.124.2.2 -r2.124.2.3 *** object.c 2001/05/03 20:04:49 2.124.2.2 --- object.c 2001/05/23 13:03:13 2.124.2.3 *************** *** 189,210 **** op->ob_refcnt, op); else if (op->ob_type->tp_print == NULL) { ! if (op->ob_type->tp_repr == NULL) { ! fprintf(fp, "<%s object at %p>", ! op->ob_type->tp_name, op); ! } else { ! PyObject *s; ! if (flags & Py_PRINT_RAW) ! s = PyObject_Str(op); ! else ! s = PyObject_Repr(op); ! if (s == NULL) ! ret = -1; ! else { ! ret = PyObject_Print(s, fp, ! Py_PRINT_RAW); ! } ! Py_XDECREF(s); } } else --- 189,203 ---- op->ob_refcnt, op); else if (op->ob_type->tp_print == NULL) { ! PyObject *s; ! if (flags & Py_PRINT_RAW) ! s = PyObject_Str(op); ! else ! s = PyObject_Repr(op); ! if (s == NULL) ! ret = -1; else { ! ret = PyObject_Print(s, fp, Py_PRINT_RAW); } + Py_XDECREF(s); } else *************** *** 291,310 **** if (v == NULL) return PyString_FromString(""); ! else if (PyString_Check(v)) { Py_INCREF(v); return v; - } - else if (v->ob_type->tp_str != NULL) - res = (*v->ob_type->tp_str)(v); - else { - PyObject *func; - if (!PyInstance_Check(v) || - (func = PyObject_GetAttrString(v, "__str__")) == NULL) { - PyErr_Clear(); - return PyObject_Repr(v); - } - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); } if (res == NULL) return NULL; --- 284,295 ---- if (v == NULL) return PyString_FromString(""); ! if (PyString_Check(v)) { Py_INCREF(v); return v; } + if (v->ob_type->tp_str == NULL) + return PyObject_Repr(v); + + res = (*v->ob_type->tp_str)(v); if (res == NULL) return NULL; Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.102.2.1 retrieving revision 2.102.2.2 diff -C2 -r2.102.2.1 -r2.102.2.2 *** stringobject.c 2001/05/23 12:30:59 2.102.2.1 --- stringobject.c 2001/05/23 13:03:13 2.102.2.2 *************** *** 402,405 **** --- 402,412 ---- } + static PyObject * + string_str(PyObject *s) + { + Py_INCREF(s); + return s; + } + static int string_length(PyStringObject *a) *************** *** 2375,2379 **** (hashfunc)string_hash, /*tp_hash*/ 0, /*tp_call*/ ! 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ --- 2382,2386 ---- (hashfunc)string_hash, /*tp_hash*/ 0, /*tp_call*/ ! (reprfunc)string_str, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ From twouters@users.sourceforge.net Wed May 23 14:14:26 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 06:14:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.102.2.2,2.102.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv4349/Objects Modified Files: Tag: release21-maint stringobject.c Log Message: Backport MAL's checkin 2.105: Fix for bug #417030: "print '%*s' fails for unicode string" Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.102.2.2 retrieving revision 2.102.2.3 diff -C2 -r2.102.2.2 -r2.102.2.3 *** stringobject.c 2001/05/23 13:03:13 2.102.2.2 --- stringobject.c 2001/05/23 13:14:24 2.102.2.3 *************** *** 2780,2783 **** --- 2780,2784 ---- char formatbuf[FORMATBUFLEN]; /* For format{float,int,char}() */ char *fmt_start = fmt; + int argidx_start = argidx; fmt++; *************** *** 2933,2936 **** --- 2934,2938 ---- if (PyUnicode_Check(v)) { fmt = fmt_start; + argidx = argidx_start; goto unicode; } *************** *** 3097,3102 **** args_owned = 0; } ! /* Fiddle args right (remove the first argidx-1 arguments) */ ! --argidx; if (PyTuple_Check(orig_args) && argidx > 0) { PyObject *v; --- 3099,3103 ---- args_owned = 0; } ! /* Fiddle args right (remove the first argidx arguments) */ if (PyTuple_Check(orig_args) && argidx > 0) { PyObject *v; From twouters@users.sourceforge.net Wed May 23 14:15:05 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 06:15:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_unicode.py,1.31,1.31.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv4566/Lib/test Modified Files: Tag: release21-maint test_unicode.py Log Message: Backport MAL's checkin 1.32: Fix for bug #417030: "print '%*s' fails for unicode string" Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.31 retrieving revision 1.31.4.1 diff -C2 -r1.31 -r1.31.4.1 *** test_unicode.py 2001/02/10 14:09:31 1.31 --- test_unicode.py 2001/05/23 13:15:03 1.31.4.1 *************** *** 367,370 **** --- 367,376 ---- verify('...%%...%%s...%s...%s...%s...%s...' % (1,2,3,u"abc") == u'...%...%s...1...2...3...abc...') verify('...%s...' % u"abc" == u'...abc...') + verify('%*s' % (5,u'abc',) == u' abc') + verify('%*s' % (-5,u'abc',) == u'abc ') + verify('%*.*s' % (5,2,u'abc',) == u' ab') + verify('%*.*s' % (5,3,u'abc',) == u' abc') + verify('%i %*.*s' % (10, 5,3,u'abc',) == u'10 abc') + verify('%i%s %*.*s' % (10, 3, 5,3,u'abc',) == u'103 abc') print 'done.' From twouters@users.sourceforge.net Wed May 23 14:18:32 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 06:18:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects object.c,2.124.2.3,2.124.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv5274/Objects Modified Files: Tag: release21-maint object.c Log Message: Backport Tim's checkin 2.130: SF bug #422108 - Error in rich comparisons. Fix a bad (albeit unlikely) return value in try_rich_to_3way_compare(). Also document do_cmp()'s return values. Index: object.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v retrieving revision 2.124.2.3 retrieving revision 2.124.2.4 diff -C2 -r2.124.2.3 -r2.124.2.4 *** object.c 2001/05/23 13:03:13 2.124.2.3 --- object.c 2001/05/23 13:18:30 2.124.2.4 *************** *** 448,452 **** switch (try_rich_compare_bool(v, w, tries[i].op)) { case -1: ! return -1; case 1: return tries[i].outcome; --- 448,452 ---- switch (try_rich_compare_bool(v, w, tries[i].op)) { case -1: ! return -2; case 1: return tries[i].outcome; *************** *** 586,589 **** --- 586,595 ---- #define CHECK_TYPES(o) PyType_HasFeature((o)->ob_type, Py_TPFLAGS_CHECKTYPES) + /* Do a 3-way comparison, by hook or by crook. Return: + -2 for an exception; + -1 if v < w; + 0 if v == w; + 1 if v > w; + */ static int do_cmp(PyObject *v, PyObject *w) From gvanrossum@users.sourceforge.net Wed May 23 14:24:32 2001 From: gvanrossum@users.sourceforge.net (Guido van Rossum) Date: Wed, 23 May 2001 06:24:32 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test README,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6432 Modified Files: README Log Message: When Tim untabified this file, his editor accidentally assumed 4-space tabs. The title was centered using 8-byte tabs, however, and the result looked strange. Fixed this. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/README,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** README 2001/05/23 07:46:36 1.8 --- README 2001/05/23 13:24:30 1.9 *************** *** 1,6 **** ! Writing Python Regression Tests ! ------------------------------- ! Skip Montanaro ! (skip@mojam.com) --- 1,6 ---- ! Writing Python Regression Tests ! ------------------------------- ! Skip Montanaro ! (skip@mojam.com) From twouters@users.sourceforge.net Wed May 23 14:26:31 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 06:26:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects frameobject.c,2.49,2.49.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6540/Objects Modified Files: Tag: release21-maint frameobject.c Log Message: Backport Jeremy's checkins (frameobject.c:2.50, test_scope.py:1.16, test_scope:1.8): SF patch 419176 from MvL; fixed bug 418977 Two errors in dict_to_map() helper used by PyFrame_LocalsToFast(). Index: frameobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v retrieving revision 2.49 retrieving revision 2.49.2.1 diff -C2 -r2.49 -r2.49.2.1 *** frameobject.c 2001/04/14 17:55:41 2.49 --- frameobject.c 2001/05/23 13:26:29 2.49.2.1 *************** *** 284,293 **** Py_XINCREF(value); if (deref) { ! if (value) { if (PyCell_Set(values[j], value) < 0) PyErr_Clear(); - } else if (clear) { - Py_XDECREF(values[j]); - values[j] = value; } } else if (value != NULL || clear) { --- 284,290 ---- Py_XINCREF(value); if (deref) { ! if (value || clear) { if (PyCell_Set(values[j], value) < 0) PyErr_Clear(); } } else if (value != NULL || clear) { *************** *** 371,378 **** dict_to_map(f->f_code->co_cellvars, PyTuple_GET_SIZE(f->f_code->co_cellvars), ! locals, fast, 1, clear); dict_to_map(f->f_code->co_freevars, PyTuple_GET_SIZE(f->f_code->co_freevars), ! locals, fast, 1, clear); } PyErr_Restore(error_type, error_value, error_traceback); --- 368,375 ---- dict_to_map(f->f_code->co_cellvars, PyTuple_GET_SIZE(f->f_code->co_cellvars), ! locals, fast + f->f_nlocals, 1, clear); dict_to_map(f->f_code->co_freevars, PyTuple_GET_SIZE(f->f_code->co_freevars), ! locals, fast + f->f_nlocals + f->f_ncells, 1, clear); } PyErr_Restore(error_type, error_value, error_traceback); From twouters@users.sourceforge.net Wed May 23 14:26:31 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 06:26:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_scope.py,1.14.2.1,1.14.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6540/Lib/test Modified Files: Tag: release21-maint test_scope.py Log Message: Backport Jeremy's checkins (frameobject.c:2.50, test_scope.py:1.16, test_scope:1.8): SF patch 419176 from MvL; fixed bug 418977 Two errors in dict_to_map() helper used by PyFrame_LocalsToFast(). Index: test_scope.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_scope.py,v retrieving revision 1.14.2.1 retrieving revision 1.14.2.2 diff -C2 -r1.14.2.1 -r1.14.2.2 *** test_scope.py 2001/05/23 12:15:17 1.14.2.1 --- test_scope.py 2001/05/23 13:26:29 1.14.2.2 *************** *** 448,449 **** --- 448,469 ---- inst = f(3)() verify(inst.a == inst.m()) + + print "20. interaction with trace function" + + import sys + def tracer(a,b,c): + return tracer + + def adaptgetter(name, klass, getter): + kind, des = getter + if kind == 1: # AV happens when stepping from this line to next + if des == "": + des = "_%s__%s" % (klass.__name__, name) + return lambda obj: getattr(obj, des) + + class TestClass: + pass + + sys.settrace(tracer) + adaptgetter("foo", TestClass, (1, "")) + sys.settrace(None) From twouters@users.sourceforge.net Wed May 23 14:26:31 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 06:26:31 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_scope,1.6.2.1,1.6.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv6540/Lib/test/output Modified Files: Tag: release21-maint test_scope Log Message: Backport Jeremy's checkins (frameobject.c:2.50, test_scope.py:1.16, test_scope:1.8): SF patch 419176 from MvL; fixed bug 418977 Two errors in dict_to_map() helper used by PyFrame_LocalsToFast(). Index: test_scope =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_scope,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -C2 -r1.6.2.1 -r1.6.2.2 *** test_scope 2001/05/23 12:15:57 1.6.2.1 --- test_scope 2001/05/23 13:26:29 1.6.2.2 *************** *** 19,20 **** --- 19,21 ---- 18. verify that locals() works 19. var is bound and free in class + 20. interaction with trace function From twouters@users.sourceforge.net Wed May 23 14:36:39 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 06:36:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules stropmodule.c,2.75,2.75.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8843/Modules Modified Files: Tag: release21-maint stropmodule.c Log Message: Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.75 retrieving revision 2.75.6.1 diff -C2 -r2.75 -r2.75.6.1 *** stropmodule.c 2000/09/26 05:46:01 2.75 --- stropmodule.c 2001/05/23 13:36:37 2.75.6.1 *************** *** 1057,1090 **** if (nfound == 0) goto return_same; - new_len = len + nfound*(sub_len - pat_len); - - new_s = (char *)PyMem_MALLOC(new_len); - if (new_s == NULL) return NULL; - - *out_len = new_len; - out_s = new_s; - - while (len > 0) { - /* find index of next instance of pattern */ - offset = mymemfind(str, len, pat, pat_len); - /* if not found, break out of loop */ - if (offset == -1) break; ! /* copy non matching part of input string */ ! memcpy(new_s, str, offset); /* copy part of str before pat */ ! str += offset + pat_len; /* move str past pattern */ ! len -= offset + pat_len; /* reduce length of str remaining */ ! ! /* copy substitute into the output string */ ! new_s += offset; /* move new_s to dest for sub string */ ! memcpy(new_s, sub, sub_len); /* copy substring into new_s */ ! new_s += sub_len; /* offset new_s past sub string */ ! ! /* break when we've done count replacements */ ! if (--count == 0) break; } ! /* copy any remaining values into output string */ ! if (len > 0) ! memcpy(new_s, str, len); return out_s; --- 1057,1097 ---- if (nfound == 0) goto return_same; ! new_len = len + nfound*(sub_len - pat_len); ! if (new_len == 0) { ! out_s = ""; } ! else { ! assert(new_len > 0); ! new_s = (char *)PyMem_MALLOC(new_len); ! if (new_s == NULL) ! return NULL; ! out_s = new_s; ! ! while (len > 0) { ! /* find index of next instance of pattern */ ! offset = mymemfind(str, len, pat, pat_len); ! if (offset == -1) ! break; ! ! /* copy non matching part of input string */ ! memcpy(new_s, str, offset); ! str += offset + pat_len; ! len -= offset + pat_len; ! ! /* copy substitute into the output string */ ! new_s += offset; ! memcpy(new_s, sub, sub_len); ! new_s += sub_len; ! ! /* note count==0 is effectively infinity */ ! if (--count == 0) ! break; ! } ! /* copy any remaining values into output string */ ! if (len > 0) ! memcpy(new_s, str, len); ! } ! *out_len = new_len; return out_s; From twouters@users.sourceforge.net Wed May 23 14:36:39 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 06:36:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test string_tests.py,1.7,1.7.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv8843/Lib/test Modified Files: Tag: release21-maint string_tests.py Log Message: Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.7 retrieving revision 1.7.4.1 diff -C2 -r1.7 -r1.7.4.1 *** string_tests.py 2001/02/09 11:43:35 1.7 --- string_tests.py 2001/05/23 13:36:37 1.7.4.1 *************** *** 178,181 **** --- 178,187 ---- test('replace', 'one!two!three!', 'one!two!three!', 'x', '@') test('replace', 'one!two!three!', 'one!two!three!', 'x', '@', 2) + # Next three for SF bug 422088: [OSF1 alpha] string.replace(); died with + # MemoryError due to empty result (platform malloc issue when requesting + # 0 bytes). + test('replace', '123', '', '123', '') + test('replace', '123123', '', '123', '') + test('replace', '123x123', 'x', '123', '') test('startswith', 'hello', 1, 'he') From thomas@xs4all.net Wed May 23 14:55:56 2001 From: thomas@xs4all.net (Thomas Wouters) Date: Wed, 23 May 2001 15:55:56 +0200 Subject: [Python-checkins] CVS: python/dist/src/Modules stropmodule.c,2.75,2.75.6.1 In-Reply-To: ; from twouters@users.sourceforge.net on Wed, May 23, 2001 at 06:36:39AM -0700 References: Message-ID: <20010523155555.A690@xs4all.nl> On Wed, May 23, 2001 at 06:36:39AM -0700, Thomas Wouters wrote: > Update of /cvsroot/python/python/dist/src/Modules > In directory usw-pr-cvs1:/tmp/cvs-serv8843/Modules > > Modified Files: > Tag: release21-maint > stropmodule.c > Log Message: Apologies. I tried to abort to do the whole slew of strop/string/test checkins Tim did in one big checkin, but botched it and commited with an empty checkin. The next checkin will explain the whole thing (hopefully in a sensible manner ;P) -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From twouters@users.sourceforge.net Wed May 23 15:38:55 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 07:38:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules stropmodule.c,2.75.6.1,2.75.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv19878/Modules Modified Files: Tag: release21-maint stropmodule.c Log Message: Net result of Tim's checkins to stropmodule.c (2.78, 2.79, 2.80, 2.81), stringobject.c (2.114, 2.115) and test_strop.py (1.11, 1.12). Fixes 'replace' behaviour on systems on which 'malloc(0)' returns NULL (together with previous checkins) and re-synchs the string-operation code in stringobject.c and stropmodule.c, with the exception of 'replace', which has the old semantics in stropmodule but the new semantics in stringobjects. Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.75.6.1 retrieving revision 2.75.6.2 diff -C2 -r2.75.6.1 -r2.75.6.2 *** stropmodule.c 2001/05/23 13:36:37 2.75.6.1 --- stropmodule.c 2001/05/23 14:38:53 2.75.6.2 *************** *** 983,987 **** MEM, the function returns -1. */ ! static int mymemfind(char *mem, int len, char *pat, int pat_len) { register int ii; --- 983,988 ---- MEM, the function returns -1. */ ! static int ! mymemfind(const char *mem, int len, const char *pat, int pat_len) { register int ii; *************** *** 1007,1011 **** mem=11111 and pat==11 also return 2. */ ! static int mymemcnt(char *mem, int len, char *pat, int pat_len) { register int offset = 0; --- 1008,1013 ---- mem=11111 and pat==11 also return 2. */ ! static int ! mymemcnt(const char *mem, int len, const char *pat, int pat_len) { register int offset = 0; *************** *** 1042,1046 **** NULL if an error occurred. */ ! static char *mymemreplace(char *str, int len, char *pat, int pat_len, char *sub, int sub_len, int count, int *out_len) { char *out_s; --- 1044,1053 ---- NULL if an error occurred. */ ! static char * ! mymemreplace(const char *str, int len, /* input string */ ! const char *pat, int pat_len, /* pattern string to find */ ! const char *sub, int sub_len, /* substitution string */ ! int count, /* number of replacements */ ! int *out_len) { char *out_s; *************** *** 1053,1058 **** /* find length of output string */ nfound = mymemcnt(str, len, pat, pat_len); ! if (count > 0) ! nfound = nfound > count ? count : nfound; if (nfound == 0) goto return_same; --- 1060,1067 ---- /* find length of output string */ nfound = mymemcnt(str, len, pat, pat_len); ! if (count < 0) ! count = INT_MAX; ! else if (nfound > count) ! nfound = count; if (nfound == 0) goto return_same; *************** *** 1060,1064 **** new_len = len + nfound*(sub_len - pat_len); if (new_len == 0) { ! out_s = ""; } else { --- 1069,1077 ---- new_len = len + nfound*(sub_len - pat_len); if (new_len == 0) { ! /* Have to allocate something for the caller to free(). */ ! out_s = (char *)PyMem_MALLOC(1); ! if (out_s == NULL) ! return NULL; ! out_s[0] = '\0'; } else { *************** *** 1069,1073 **** out_s = new_s; ! while (len > 0) { /* find index of next instance of pattern */ offset = mymemfind(str, len, pat, pat_len); --- 1082,1086 ---- out_s = new_s; ! for (; count > 0 && len > 0; --count) { /* find index of next instance of pattern */ offset = mymemfind(str, len, pat, pat_len); *************** *** 1084,1091 **** memcpy(new_s, sub, sub_len); new_s += sub_len; - - /* note count==0 is effectively infinity */ - if (--count == 0) - break; } /* copy any remaining values into output string */ --- 1097,1100 ---- *************** *** 1098,1102 **** return_same: *out_len = -1; ! return str; } --- 1107,1111 ---- return_same: *out_len = -1; ! return (char *)str; /* cast away const */ } *************** *** 1114,1118 **** char *str, *pat,*sub,*new_s; int len,pat_len,sub_len,out_len; ! int count = 0; PyObject *new; --- 1123,1127 ---- char *str, *pat,*sub,*new_s; int len,pat_len,sub_len,out_len; ! int count = -1; PyObject *new; *************** *** 1125,1128 **** --- 1134,1143 ---- return NULL; } + /* CAUTION: strop treats a replace count of 0 as infinity, unlke + * current (2.1) string.py and string methods. Preserve this for + * ... well, hard to say for what . + */ + if (count == 0) + count = -1; new_s = mymemreplace(str,len,pat,pat_len,sub,sub_len,count,&out_len); if (new_s == NULL) { From twouters@users.sourceforge.net Wed May 23 15:38:55 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 07:38:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.102.2.3,2.102.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv19878/Objects Modified Files: Tag: release21-maint stringobject.c Log Message: Net result of Tim's checkins to stropmodule.c (2.78, 2.79, 2.80, 2.81), stringobject.c (2.114, 2.115) and test_strop.py (1.11, 1.12). Fixes 'replace' behaviour on systems on which 'malloc(0)' returns NULL (together with previous checkins) and re-synchs the string-operation code in stringobject.c and stropmodule.c, with the exception of 'replace', which has the old semantics in stropmodule but the new semantics in stringobjects. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.102.2.3 retrieving revision 2.102.2.4 diff -C2 -r2.102.2.3 -r2.102.2.4 *** stringobject.c 2001/05/23 13:14:24 2.102.2.3 --- stringobject.c 2001/05/23 14:38:53 2.102.2.4 *************** *** 1532,1536 **** const char *sub, int sub_len, /* substitution string */ int count, /* number of replacements */ ! int *out_len) { char *out_s; --- 1532,1536 ---- const char *sub, int sub_len, /* substitution string */ int count, /* number of replacements */ ! int *out_len) { char *out_s; *************** *** 1549,1587 **** if (nfound == 0) goto return_same; - new_len = len + nfound*(sub_len - pat_len); - - new_s = (char *)PyMem_MALLOC(new_len); - if (new_s == NULL) return NULL; - - *out_len = new_len; - out_s = new_s; ! while (len > 0) { ! /* find index of next instance of pattern */ ! offset = mymemfind(str, len, pat, pat_len); ! /* if not found, break out of loop */ ! if (offset == -1) break; ! ! /* copy non matching part of input string */ ! memcpy(new_s, str, offset); /* copy part of str before pat */ ! str += offset + pat_len; /* move str past pattern */ ! len -= offset + pat_len; /* reduce length of str remaining */ ! ! /* copy substitute into the output string */ ! new_s += offset; /* move new_s to dest for sub string */ ! memcpy(new_s, sub, sub_len); /* copy substring into new_s */ ! new_s += sub_len; /* offset new_s past sub string */ ! ! /* break when we've done count replacements */ ! if (--count == 0) break; } ! /* copy any remaining values into output string */ ! if (len > 0) ! memcpy(new_s, str, len); return out_s; return_same: *out_len = -1; ! return (char*)str; /* have to cast away constness here */ } --- 1549,1594 ---- if (nfound == 0) goto return_same; ! new_len = len + nfound*(sub_len - pat_len); ! if (new_len == 0) { ! /* Have to allocate something for the caller to free(). */ ! out_s = (char *)PyMem_MALLOC(1); ! if (out_s == NULL) ! return NULL; ! out_s[0] = '\0'; } ! else { ! assert(new_len > 0); ! new_s = (char *)PyMem_MALLOC(new_len); ! if (new_s == NULL) ! return NULL; ! out_s = new_s; ! ! for (; count > 0 && len > 0; --count) { ! /* find index of next instance of pattern */ ! offset = mymemfind(str, len, pat, pat_len); ! if (offset == -1) ! break; ! ! /* copy non matching part of input string */ ! memcpy(new_s, str, offset); ! str += offset + pat_len; ! len -= offset + pat_len; ! ! /* copy substitute into the output string */ ! new_s += offset; ! memcpy(new_s, sub, sub_len); ! new_s += sub_len; ! } ! /* copy any remaining values into output string */ ! if (len > 0) ! memcpy(new_s, str, len); ! } ! *out_len = new_len; return out_s; return_same: *out_len = -1; ! return (char *)str; /* cast away const */ } From twouters@users.sourceforge.net Wed May 23 15:38:55 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 07:38:55 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_strop.py,1.10,1.10.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv19878/Lib/test Modified Files: Tag: release21-maint test_strop.py Log Message: Net result of Tim's checkins to stropmodule.c (2.78, 2.79, 2.80, 2.81), stringobject.c (2.114, 2.115) and test_strop.py (1.11, 1.12). Fixes 'replace' behaviour on systems on which 'malloc(0)' returns NULL (together with previous checkins) and re-synchs the string-operation code in stringobject.c and stropmodule.c, with the exception of 'replace', which has the old semantics in stropmodule but the new semantics in stringobjects. Index: test_strop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strop.py,v retrieving revision 1.10 retrieving revision 1.10.4.1 diff -C2 -r1.10 -r1.10.4.1 *** test_strop.py 2001/01/17 21:51:36 1.10 --- test_strop.py 2001/05/23 14:38:53 1.10.4.1 *************** *** 78,81 **** --- 78,83 ---- test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 3) test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 4) + # CAUTION: a replace count of 0 means infinity only to strop, not to the + # string .replace() method or to the string.replace() function. test('replace', 'one!two!three!', 'one@two@three@', '!', '@', 0) test('replace', 'one!two!three!', 'one@two@three@', '!', '@') From twouters@users.sourceforge.net Wed May 23 15:52:47 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 07:52:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mutants.py,NONE,1.3.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv26550/Lib/test Added Files: Tag: release21-maint test_mutants.py Log Message: Tim's test_mutants test, taken from revision 1.3 (unsure if I used the right dead chicken for CVS to make the connection... lets hope so.) --- NEW FILE: test_mutants.py --- from test_support import verbose import random # From SF bug #422121: Insecurities in dict comparison. # Safety of code doing comparisons has been an historical Python weak spot. # The problem is that comparison of structures written in C *naturally* # wants to hold on to things like the size of the container, or "the # biggest" containee so far, across a traversal of the container; but # code to do containee comparisons can call back into Python and mutate # the container in arbitrary ways while the C loop is in midstream. If the # C code isn't extremely paranoid about digging things out of memory on # each trip, and artificially boosting refcounts for the duration, anything # from infinite loops to OS crashes can result (yes, I use Windows ). # # The other problem is that code designed to provoke a weakness is usually # white-box code, and so catches only the particular vulnerabilities the # author knew to protect against. For example, Python's list.sort() code # went thru many iterations as one "new" vulnerability after another was # discovered. # # So the dict comparison test here uses a black-box approach instead, # generating dicts of various sizes at random, and performing random # mutations on them at random times. This proved very effective, # triggering at least six distinct failure modes the first 20 times I # ran it. Indeed, at the start, the driver never got beyond 6 iterations # before the test died. # The dicts are global to make it easy to mutate tham from within functions. dict1 = {} dict2 = {} # The current set of keys in dict1 and dict2. These are materialized as # lists to make it easy to pick a dict key at random. dict1keys = [] dict2keys = [] # Global flag telling maybe_mutate() wether to *consider* mutating. mutate = 0 # If global mutate is true, consider mutating a dict. May or may not # mutate a dict even if mutate is true. If it does decide to mutate a # dict, it picks one of {dict1, dict2} at random, and deletes a random # entry from it; or, more rarely, adds a random element. def maybe_mutate(): global mutate if not mutate: return if random.random() < 0.5: return if random.random() < 0.5: target, keys = dict1, dict1keys else: target, keys = dict2, dict2keys if random.random() < 0.2: # Insert a new key. mutate = 0 # disable mutation until key inserted while 1: newkey = Horrid(random.randrange(100)) if newkey not in target: break target[newkey] = Horrid(random.randrange(100)) keys.append(newkey) mutate = 1 elif keys: # Delete a key at random. i = random.randrange(len(keys)) key = keys[i] del target[key] # CAUTION: don't use keys.remove(key) here. Or do . The # point is that .remove() would trigger more comparisons, and so # also more calls to this routine. We're mutating often enough # without that. del keys[i] # A horrid class that triggers random mutations of dict1 and dict2 when # instances are compared. class Horrid: def __init__(self, i): # Comparison outcomes are determined by the value of i. self.i = i # An artificial hashcode is selected at random so that we don't # have any systematic relationship between comparison outcomes # (based on self.i and other.i) and relative position within the # hash vector (based on hashcode). self.hashcode = random.randrange(1000000000) def __hash__(self): return self.hashcode def __cmp__(self, other): maybe_mutate() # The point of the test. return cmp(self.i, other.i) def __repr__(self): return "Horrid(%d)" % self.i # Fill dict d with numentries (Horrid(i), Horrid(j)) key-value pairs, # where i and j are selected at random from the candidates list. # Return d.keys() after filling. def fill_dict(d, candidates, numentries): d.clear() for i in xrange(numentries): d[Horrid(random.choice(candidates))] = \ Horrid(random.choice(candidates)) return d.keys() # Test one pair of randomly generated dicts, each with n entries. # Note that dict comparison is trivial if they don't have the same number # of entires (then the "shorter" dict is instantly considered to be the # smaller one, without even looking at the entries). def test_one(n): global mutate, dict1, dict2, dict1keys, dict2keys # Fill the dicts without mutating them. mutate = 0 dict1keys = fill_dict(dict1, range(n), n) dict2keys = fill_dict(dict2, range(n), n) # Enable mutation, then compare the dicts so long as they have the # same size. mutate = 1 if verbose: print "trying w/ lengths", len(dict1), len(dict2), while dict1 and len(dict1) == len(dict2): if verbose: print ".", c = cmp(dict1, dict2) if verbose: print # Run test_one n times. At the start (before the bugs were fixed), 20 # consecutive runs of this test each blew up on or before the sixth time # test_one was run. So n doesn't have to be large to get an interesting # test. # OTOH, calling with large n is also interesting, to ensure that the fixed # code doesn't hold on to refcounts *too* long (in which case memory would # leak). def test(n): for i in xrange(n): test_one(random.randrange(1, 100)) # See last comment block for clues about good values for n. test(100) From twouters@users.sourceforge.net Wed May 23 15:55:56 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 07:55:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_mutants.py,1.3.2.1,1.3.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv26969 Modified Files: Tag: release21-maint test_mutants.py Log Message: Now that the backporting of test_mutants.py worked successfully (Barnevelder chickens work best!) adapt test_mutants to the absense of 'key in dict'. Index: test_mutants.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mutants.py,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -r1.3.2.1 -r1.3.2.2 *** test_mutants.py 2001/05/23 14:52:45 1.3.2.1 --- test_mutants.py 2001/05/23 14:55:54 1.3.2.2 *************** *** 61,65 **** while 1: newkey = Horrid(random.randrange(100)) ! if newkey not in target: break target[newkey] = Horrid(random.randrange(100)) --- 61,65 ---- while 1: newkey = Horrid(random.randrange(100)) ! if not target.has_key(newkey): break target[newkey] = Horrid(random.randrange(100)) From twouters@users.sourceforge.net Wed May 23 15:56:38 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 07:56:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_mutants,NONE,1.2.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv27246/output Added Files: Tag: release21-maint test_mutants Log Message: Re-incarnate dead turd of old test_mutants output file. --- NEW FILE: test_mutants --- test_mutants From twouters@users.sourceforge.net Wed May 23 16:07:57 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 08:07:57 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.76,2.76.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv29248/Objects Modified Files: Tag: release21-maint dictobject.c Log Message: Backport Tim's checkin 2.84: SF bug #422121 Insecurities in dict comparison. Fixed a half dozen ways in which general dict comparison could crash Python (even cause Win98SE to reboot) in the presence of kay and/or value comparison routines that mutate the dict during dict comparison. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.76 retrieving revision 2.76.2.1 diff -C2 -r2.76 -r2.76.2.1 *** dictobject.c 2001/04/16 00:02:32 2.76 --- dictobject.c 2001/05/23 15:07:55 2.76.2.1 *************** *** 982,1022 **** /* Subroutine which returns the smallest key in a for which b's value is different or absent. The value is returned too, through the ! pval argument. No reference counts are incremented. */ static PyObject * characterize(dictobject *a, dictobject *b, PyObject **pval) { ! PyObject *diff = NULL; int i, cmp; - *pval = NULL; for (i = 0; i < a->ma_size; i++) { ! if (a->ma_table[i].me_value != NULL) { ! PyObject *key = a->ma_table[i].me_key; ! PyObject *aval, *bval; ! if (diff != NULL) { ! cmp = PyObject_RichCompareBool(diff, key, Py_LT); ! if (cmp < 0) ! return NULL; ! if (cmp > 0) ! continue; } ! aval = a->ma_table[i].me_value; ! bval = PyDict_GetItem((PyObject *)b, key); ! if (bval == NULL) ! cmp = 0; ! else { ! cmp = PyObject_RichCompareBool(aval, bval, Py_EQ); ! if (cmp < 0) ! return NULL; ! } ! if (cmp == 0) { ! diff = key; ! *pval = aval; } } } ! return diff; } --- 982,1062 ---- /* Subroutine which returns the smallest key in a for which b's value is different or absent. The value is returned too, through the ! pval argument. Both are NULL if no key in a is found for which b's status ! differs. The refcounts on (and only on) non-NULL *pval and function return ! values must be decremented by the caller (characterize() increments them ! to ensure that mutating comparison and PyDict_GetItem calls can't delete ! them before the caller is done looking at them). */ static PyObject * characterize(dictobject *a, dictobject *b, PyObject **pval) { ! PyObject *akey = NULL; /* smallest key in a s.t. a[akey] != b[akey] */ ! PyObject *aval = NULL; /* a[akey] */ int i, cmp; for (i = 0; i < a->ma_size; i++) { ! PyObject *thiskey, *thisaval, *thisbval; ! if (a->ma_table[i].me_value == NULL) ! continue; ! thiskey = a->ma_table[i].me_key; ! Py_INCREF(thiskey); /* keep alive across compares */ ! if (akey != NULL) { ! cmp = PyObject_RichCompareBool(akey, thiskey, Py_LT); ! if (cmp < 0) { ! Py_DECREF(thiskey); ! goto Fail; } ! if (cmp > 0 || ! i >= a->ma_size || ! a->ma_table[i].me_value == NULL) { ! /* Not the *smallest* a key; or maybe it is ! * but the compare shrunk the dict so we can't ! * find its associated value anymore; or ! * maybe it is but the compare deleted the ! * a[thiskey] entry. ! */ ! Py_DECREF(thiskey); ! continue; } } + + /* Compare a[thiskey] to b[thiskey]; cmp <- true iff equal. */ + thisaval = a->ma_table[i].me_value; + assert(thisaval); + Py_INCREF(thisaval); /* keep alive */ + thisbval = PyDict_GetItem((PyObject *)b, thiskey); + if (thisbval == NULL) + cmp = 0; + else { + /* both dicts have thiskey: same values? */ + cmp = PyObject_RichCompareBool( + thisaval, thisbval, Py_EQ); + if (cmp < 0) { + Py_DECREF(thiskey); + Py_DECREF(thisaval); + goto Fail; + } + } + if (cmp == 0) { + /* New winner. */ + Py_XDECREF(akey); + Py_XDECREF(aval); + akey = thiskey; + aval = thisaval; + } + else { + Py_DECREF(thiskey); + Py_DECREF(thisaval); + } } ! *pval = aval; ! return akey; ! ! Fail: ! Py_XDECREF(akey); ! Py_XDECREF(aval); ! *pval = NULL; ! return NULL; } *************** *** 1032,1048 **** else if (a->ma_used > b->ma_used) return 1; /* b is shorter */ /* Same length -- check all keys */ adiff = characterize(a, b, &aval); ! if (adiff == NULL && PyErr_Occurred()) ! return -1; ! if (adiff == NULL) ! return 0; /* a is a subset with the same length */ bdiff = characterize(b, a, &bval); ! if (bdiff == NULL && PyErr_Occurred()) ! return -1; ! /* bdiff == NULL would be impossible now */ ! res = PyObject_Compare(adiff, bdiff); ! if (res == 0) res = PyObject_Compare(aval, bval); return res; } --- 1072,1109 ---- else if (a->ma_used > b->ma_used) return 1; /* b is shorter */ + /* Same length -- check all keys */ + bdiff = bval = NULL; adiff = characterize(a, b, &aval); ! if (adiff == NULL) { ! assert(!aval); ! /* Either an error, or a is a subst with the same length so ! * must be equal. ! */ ! res = PyErr_Occurred() ? -1 : 0; ! goto Finished; ! } bdiff = characterize(b, a, &bval); ! if (bdiff == NULL && PyErr_Occurred()) { ! assert(!bval); ! res = -1; ! goto Finished; ! } ! res = 0; ! if (bdiff) { ! /* bdiff == NULL "should be" impossible now, but perhaps ! * the last comparison done by the characterize() on a had ! * the side effect of making the dicts equal! ! */ ! res = PyObject_Compare(adiff, bdiff); ! } ! if (res == 0 && bval != NULL) res = PyObject_Compare(aval, bval); + + Finished: + Py_XDECREF(adiff); + Py_XDECREF(bdiff); + Py_XDECREF(aval); + Py_XDECREF(bval); return res; } From twouters@users.sourceforge.net Wed May 23 16:21:52 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Wed, 23 May 2001 08:21:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/mac libcolorpicker.tex,1.2,1.2.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory usw-pr-cvs1:/tmp/cvs-serv32165 Modified Files: Tag: release21-maint libcolorpicker.tex Log Message: Backport Fred's checkin 1.3: Actually include a synopsis line for the ColorPicker module. Index: libcolorpicker.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libcolorpicker.tex,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -C2 -r1.2 -r1.2.2.1 *** libcolorpicker.tex 2001/04/13 17:37:00 1.2 --- libcolorpicker.tex 2001/05/23 15:21:50 1.2.2.1 *************** *** 4,8 **** \declaremodule{extension}{ColorPicker} \platform{Mac} ! \modulesynopsis{} \moduleauthor{Just van Rossum}{just@letterror.com} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} --- 4,8 ---- \declaremodule{extension}{ColorPicker} \platform{Mac} ! \modulesynopsis{Interface to the standard color selection dialog.} \moduleauthor{Just van Rossum}{just@letterror.com} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} From bwarsaw@users.sourceforge.net Wed May 23 17:59:47 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Wed, 23 May 2001 09:59:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/i18n pygettext.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/i18n In directory usw-pr-cvs1:/tmp/cvs-serv18696 Modified Files: pygettext.py Log Message: write(): Do two levels of sorting: first sort the individual location tuples by filename/lineno, then sort the catalog entries by their location tuples. Index: pygettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/i18n/pygettext.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** pygettext.py 2001/05/21 19:58:23 1.16 --- pygettext.py 2001/05/23 16:59:45 1.17 *************** *** 326,330 **** --- 326,340 ---- # generated by xgettext... print >> fp, pot_header % {'time': timestamp, 'version': __version__} + # Sort the entries. First sort each particular entry's keys, then + # sort all the entries by their first item. + reverse = {} for k, v in self.__messages.items(): + keys = v.keys() + keys.sort() + reverse[tuple(keys)] = (k, v) + rkeys = reverse.keys() + rkeys.sort() + for rkey in rkeys: + k, v = reverse[rkey] # If the entry was gleaned out of a docstring, then add a comment # stating so. This is to aid translators who may wish to skip From jackjansen@users.sourceforge.net Wed May 23 21:03:08 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Wed, 23 May 2001 13:03:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE PyEdit.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv23536/Python/Mac/Tools/IDE Modified Files: PyEdit.py Log Message: One more macroman<->latin1 conversion victim. Index: PyEdit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyEdit.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** PyEdit.py 2001/02/21 13:54:31 1.17 --- PyEdit.py 2001/05/23 20:03:06 1.18 *************** *** 68,72 **** sourceOS = 'UNIX' searchString = '\n' ! change = EasyDialogs.AskYesNoCancel('³%s² contains %s-style line feeds. ' 'Change them to MacOS carriage returns?' % (self.title, sourceOS), 1) # bug: Cancel is treated as No --- 68,72 ---- sourceOS = 'UNIX' searchString = '\n' ! change = EasyDialogs.AskYesNoCancel('–%s” contains %s-style line feeds. ' 'Change them to MacOS carriage returns?' % (self.title, sourceOS), 1) # bug: Cancel is treated as No *************** *** 225,230 **** def makeoptionsmenu(self): ! menuitems = [('Font settingsŠ', self.domenu_fontsettings), ! ("Save optionsŠ", self.domenu_options), '-', ('\0' + chr(self.run_as_main) + 'Run as __main__', self.domenu_toggle_run_as_main), --- 225,230 ---- def makeoptionsmenu(self): ! menuitems = [('Font settingsƒ', self.domenu_fontsettings), ! ("Save optionsƒ", self.domenu_options), '-', ('\0' + chr(self.run_as_main) + 'Run as __main__', self.domenu_toggle_run_as_main), *************** *** 232,236 **** #'-', ('Modularize', self.domenu_modularize), ! ('Browse namespaceŠ', self.domenu_browsenamespace), '-'] if self.profiling: --- 232,236 ---- #'-', ('Modularize', self.domenu_modularize), ! ('Browse namespaceƒ', self.domenu_browsenamespace), '-'] if self.profiling: *************** *** 241,245 **** menuitems = menuitems + [('Disable debugger', self.domenu_toggledebugger), ('Clear breakpoints', self.domenu_clearbreakpoints), ! ('Edit breakpointsŠ', self.domenu_editbreakpoints)] else: menuitems = menuitems + [('Enable debugger', self.domenu_toggledebugger)] --- 241,245 ---- menuitems = menuitems + [('Disable debugger', self.domenu_toggledebugger), ('Clear breakpoints', self.domenu_clearbreakpoints), ! ('Edit breakpointsƒ', self.domenu_editbreakpoints)] else: menuitems = menuitems + [('Enable debugger', self.domenu_toggledebugger)] *************** *** 286,290 **** modname = _filename_as_modname(self.title) if not modname: ! raise W.AlertError, 'Can¹t modularize ³%s²' % self.title run_as_main = self.run_as_main self.run_as_main = 0 --- 286,290 ---- modname = _filename_as_modname(self.title) if not modname: ! raise W.AlertError, 'CanÕt modularize –%s”' % self.title run_as_main = self.run_as_main self.run_as_main = 0 *************** *** 361,365 **** import Qd Qd.InitCursor() # XXX should be done by dialog ! save = EasyDialogs.AskYesNoCancel('Save window ³%s² before closing?' % self.title, 1) if save > 0: if self.domenu_save(): --- 361,365 ---- import Qd Qd.InitCursor() # XXX should be done by dialog ! save = EasyDialogs.AskYesNoCancel('Save window –%s” before closing?' % self.title, 1) if save > 0: if self.domenu_save(): *************** *** 421,425 **** except ImportError: # only have buildtools in Python >= 1.5.2 ! raise W.AlertError, "³Save as Applet² is only supported in\rPython 1.5.2 and up." buildtools.DEBUG = 0 # ouch. --- 421,425 ---- except ImportError: # only have buildtools in Python >= 1.5.2 ! raise W.AlertError, "–Save as Applet” is only supported in\rPython 1.5.2 and up." buildtools.DEBUG = 0 # ouch. *************** *** 505,509 **** import EasyDialogs import Qd; Qd.InitCursor() ! save = EasyDialogs.AskYesNoCancel('Save ³%s² before running?' % self.title, 1) if save > 0: if self.domenu_save(): --- 505,509 ---- import EasyDialogs import Qd; Qd.InitCursor() ! save = EasyDialogs.AskYesNoCancel('Save –%s” before running?' % self.title, 1) if save > 0: if self.domenu_save(): *************** *** 561,575 **** classend = identifieRE_match(classname) if classend < 1: ! raise W.AlertError, 'Can¹t find a class.' classname = classname[:classend] break elif line and line[0] not in '\t#': ! raise W.AlertError, 'Can¹t find a class.' else: ! raise W.AlertError, 'Can¹t find a class.' if globals.has_key(classname): locals = globals[classname].__dict__ else: ! raise W.AlertError, 'Can¹t find class ³%s².' % classname # dedent to top level for i in range(len(lines)): --- 561,575 ---- classend = identifieRE_match(classname) if classend < 1: ! raise W.AlertError, 'CanÕt find a class.' classname = classname[:classend] break elif line and line[0] not in '\t#': ! raise W.AlertError, 'CanÕt find a class.' else: ! raise W.AlertError, 'CanÕt find a class.' if globals.has_key(classname): locals = globals[classname].__dict__ else: ! raise W.AlertError, 'CanÕt find class –%s”.' % classname # dedent to top level for i in range(len(lines)): *************** *** 577,581 **** pytext = string.join(lines, '\r') elif indent > 0: ! raise W.AlertError, 'Can¹t run indented code.' # add "newlines" to fool compile/exec: --- 577,581 ---- pytext = string.join(lines, '\r') elif indent > 0: ! raise W.AlertError, 'CanÕt run indented code.' # add "newlines" to fool compile/exec: *************** *** 840,844 **** ("Replace", "cmdr", self.replace), ("Replace all", None, self.replaceall), ! ("Don¹t find", "cmdd", self.dont), ("Cancel", "cmd.", self.cancel) ] --- 840,844 ---- ("Replace", "cmdr", self.replace), ("Replace all", None, self.replaceall), ! ("DonÕt find", "cmdd", self.dont), ("Cancel", "cmd.", self.cancel) ] *************** *** 849,853 **** if shortcut: self.w.bind(shortcut, self.w[title].push) ! self.w.setdefaultbutton(self.w["Don¹t find"]) self.w.find.edit.bind("", self.key) self.w.bind("", self.activate) --- 849,853 ---- if shortcut: self.w.bind(shortcut, self.w[title].push) ! self.w.setdefaultbutton(self.w["DonÕt find"]) self.w.find.edit.bind("", self.key) self.w.bind("", self.activate) *************** *** 882,890 **** for title, cmd, call in self.buttons[:-2]: self.w[title].enable(0) ! self.w.setdefaultbutton(self.w["Don¹t find"]) else: for title, cmd, call in self.buttons[:-2]: self.w[title].enable(0) ! self.w.setdefaultbutton(self.w["Don¹t find"]) def find(self): --- 882,890 ---- for title, cmd, call in self.buttons[:-2]: self.w[title].enable(0) ! self.w.setdefaultbutton(self.w["DonÕt find"]) else: for title, cmd, call in self.buttons[:-2]: self.w[title].enable(0) ! self.w.setdefaultbutton(self.w["DonÕt find"]) def find(self): *************** *** 1205,1209 **** self.fontsettings, self.tabsettings, self.windowsize = geteditorprefs() self.w = W.Dialog((328, 120), "Editor default settings") ! self.w.setfontbutton = W.Button((8, 8, 80, 16), "Set fontŠ", self.dofont) self.w.fonttext = W.TextBox((98, 10, -8, 14), self.template % (self.fontsettings[0], self.fontsettings[2])) --- 1205,1209 ---- self.fontsettings, self.tabsettings, self.windowsize = geteditorprefs() self.w = W.Dialog((328, 120), "Editor default settings") ! self.w.setfontbutton = W.Button((8, 8, 80, 16), "Set fontƒ", self.dofont) self.w.fonttext = W.TextBox((98, 10, -8, 14), self.template % (self.fontsettings[0], self.fontsettings[2])) From tim_one@users.sourceforge.net Thu May 24 00:34:00 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 23 May 2001 16:34:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_operations.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv1630/python/dist/src/Lib/test Modified Files: test_operations.py Log Message: Jack Jansen hit a bug in the new dict code, reported on python-dev. dictresize() was too aggressive about never ever resizing small dicts. If a small dict is entirely full, it needs to rebuild it despite that it won't actually resize it, in order to purge old dummy entries thus creating at least one virgin slot (lookdict assumes at least one such exists). Also took the opportunity to add some high-level comments to dictresize. Index: test_operations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_operations.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_operations.py 2000/10/23 17:22:07 1.3 --- test_operations.py 2001/05/23 23:33:57 1.4 *************** *** 27,28 **** --- 27,43 ---- d[x2] = 2 print "No exception passed through." + + # Dict resizing bug, found by Jack Jansen in 2.2 CVS development. + # This version got an assert failure in debug build, infinite loop in + # release build. Unfortunately, provoking this kind of stuff requires + # a mix of inserts and deletes hitting exactly the right hash codes in + # exactly the right order, and I can't think of a randomized approach + # that would be *likely* to hit a failing case in reasonable time. + + d = {} + for i in range(5): + d[i] = i + for i in range(5): + del d[i] + for i in range(5, 9): # i==8 was the problem + d[i] = i From tim_one@users.sourceforge.net Thu May 24 00:34:00 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Wed, 23 May 2001 16:34:00 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.92,2.93 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv1630/python/dist/src/Objects Modified Files: dictobject.c Log Message: Jack Jansen hit a bug in the new dict code, reported on python-dev. dictresize() was too aggressive about never ever resizing small dicts. If a small dict is entirely full, it needs to rebuild it despite that it won't actually resize it, in order to purge old dummy entries thus creating at least one virgin slot (lookdict assumes at least one such exists). Also took the opportunity to add some high-level comments to dictresize. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.92 retrieving revision 2.93 diff -C2 -r2.92 -r2.93 *** dictobject.c 2001/05/22 22:36:52 2.92 --- dictobject.c 2001/05/23 23:33:57 2.93 *************** *** 396,407 **** dictresize(dictobject *mp, int minused) { ! register int newsize, newpoly; ! register dictentry *oldtable = mp->ma_table; ! register dictentry *newtable; ! register dictentry *ep; ! register int i; assert(minused >= 0); ! assert(oldtable != NULL); newpoly = 0; newsize = MINSIZE; --- 396,408 ---- dictresize(dictobject *mp, int minused) { ! int newsize, newpoly; ! dictentry *oldtable, *newtable, *ep; ! int i; ! int is_oldtable_malloced; ! dictentry small_copy[MINSIZE]; assert(minused >= 0); ! ! /* Find the smallest table size > minused, and its poly[] entry. */ newpoly = 0; newsize = MINSIZE; *************** *** 420,427 **** return -1; } if (newsize == MINSIZE) { newtable = mp->ma_smalltable; ! if (newtable == oldtable) ! return 0; } else { --- 421,444 ---- return -1; } + + /* Get space for a new table. */ + oldtable = mp->ma_table; + assert(oldtable != NULL); + is_oldtable_malloced = oldtable != mp->ma_smalltable; + if (newsize == MINSIZE) { + /* Either a large table is shrinking, or we can't get any + smaller. */ newtable = mp->ma_smalltable; ! if (newtable == oldtable) { ! if (mp->ma_fill < mp->ma_size) ! return 0; ! /* The small table is entirely full. We're not ! going to resise it, but need to rebuild it ! anyway to purge old dummy entries. */ ! assert(mp->ma_fill > mp->ma_used); /* a dummy exists */ ! memcpy(small_copy, oldtable, sizeof(small_copy)); ! oldtable = small_copy; ! } } else { *************** *** 432,435 **** --- 449,454 ---- } } + + /* Make the dict empty, using the new table. */ assert(newtable != oldtable); mp->ma_table = newtable; *************** *** 456,460 **** } ! if (oldtable != mp->ma_smalltable) PyMem_DEL(oldtable); return 0; --- 475,479 ---- } ! if (is_oldtable_malloced) PyMem_DEL(oldtable); return 0; From tim_one@users.sourceforge.net Thu May 24 17:26:42 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Thu, 24 May 2001 09:26:42 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.93,2.94 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6271/python/dist/src/Objects Modified Files: dictobject.c Log Message: dictresize(): Rebuild small tables if there are any dummies, not just if they're entirely full. Not a question of correctness, but of temporarily misplaced common sense. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.93 retrieving revision 2.94 diff -C2 -r2.93 -r2.94 *** dictobject.c 2001/05/23 23:33:57 2.93 --- dictobject.c 2001/05/24 16:26:40 2.94 *************** *** 428,441 **** if (newsize == MINSIZE) { ! /* Either a large table is shrinking, or we can't get any ! smaller. */ newtable = mp->ma_smalltable; if (newtable == oldtable) { ! if (mp->ma_fill < mp->ma_size) return 0; ! /* The small table is entirely full. We're not ! going to resise it, but need to rebuild it ! anyway to purge old dummy entries. */ ! assert(mp->ma_fill > mp->ma_used); /* a dummy exists */ memcpy(small_copy, oldtable, sizeof(small_copy)); oldtable = small_copy; --- 428,445 ---- if (newsize == MINSIZE) { ! /* A large table is shrinking, or we can't get any smaller. */ newtable = mp->ma_smalltable; if (newtable == oldtable) { ! if (mp->ma_fill == mp->ma_used) { ! /* No dummies, so no point doing anything. */ return 0; ! } ! /* We're not going to resize it, but rebuild the ! table anyway to purge old dummy entries. ! Subtle: This is *necessary* if fill==size, ! as lookdict needs at least one virgin slot to ! terminate failing searches. If fill < size, it's ! merely desirable, as dummies slow searches. */ ! assert(mp->ma_fill > mp->ma_used); memcpy(small_copy, oldtable, sizeof(small_copy)); oldtable = small_copy; From loewis@users.sourceforge.net Thu May 24 17:56:37 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Thu, 24 May 2001 09:56:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.94,2.95 stringobject.c,2.116,2.117 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv11296/Objects Modified Files: dictobject.c stringobject.c Log Message: Patch #424335: Implement string_richcompare, remove string_compare. Use new _PyString_Eq in lookdict_string. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.94 retrieving revision 2.95 diff -C2 -r2.94 -r2.95 *** dictobject.c 2001/05/24 16:26:40 2.94 --- dictobject.c 2001/05/24 16:56:35 2.95 *************** *** 295,299 **** * be dropped; string-string comparisons never raise exceptions. This also * means we don't need to go through PyObject_Compare(); we can always use ! * the tp_compare slot of the string type object directly. * * This really only becomes meaningful if proper error handling in lookdict() --- 295,299 ---- * be dropped; string-string comparisons never raise exceptions. This also * means we don't need to go through PyObject_Compare(); we can always use ! * _PyString_Eq directly. * * This really only becomes meaningful if proper error handling in lookdict() *************** *** 309,313 **** dictentry *ep0 = mp->ma_table; register dictentry *ep; - cmpfunc compare = PyString_Type.tp_compare; /* make sure this function doesn't have to handle non-string keys */ --- 309,312 ---- *************** *** 329,333 **** else { if (ep->me_hash == hash ! && compare(ep->me_key, key) == 0) { return ep; } --- 328,332 ---- else { if (ep->me_hash == hash ! && _PyString_Eq(ep->me_key, key)) { return ep; } *************** *** 348,352 **** || (ep->me_hash == hash && ep->me_key != dummy ! && compare(ep->me_key, key) == 0)) return ep; if (ep->me_key == dummy && freeslot == NULL) --- 347,351 ---- || (ep->me_hash == hash && ep->me_key != dummy ! && _PyString_Eq(ep->me_key, key))) return ep; if (ep->me_key == dummy && freeslot == NULL) Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.116 retrieving revision 2.117 diff -C2 -r2.116 -r2.117 *** stringobject.c 2001/05/15 11:58:06 2.116 --- stringobject.c 2001/05/24 16:56:35 2.117 *************** *** 631,648 **** } ! static int ! string_compare(PyStringObject *a, PyStringObject *b) { ! int len_a = a->ob_size, len_b = b->ob_size; ! int min_len = (len_a < len_b) ? len_a : len_b; ! int cmp; ! if (min_len > 0) { ! cmp = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval); ! if (cmp == 0) ! cmp = memcmp(a->ob_sval, b->ob_sval, min_len); ! if (cmp != 0) ! return cmp; } ! return (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0; } --- 631,707 ---- } ! static PyObject* ! string_richcompare(PyStringObject *a, PyStringObject *b, int op) { ! int c; ! int len_a, len_b; ! int min_len; ! PyObject *result; ! ! /* One of the objects is a string object. Make sure the ! other one is one, too. */ ! if (a->ob_type != b->ob_type) { ! result = Py_NotImplemented; ! goto out; ! } ! if (a == b) { ! switch (op) { ! case Py_EQ:case Py_LE:case Py_GE: ! result = Py_True; ! goto out; ! case Py_NE:case Py_LT:case Py_GT: ! result = Py_False; ! goto out; ! } ! } ! if (op == Py_EQ) { ! /* Supporting Py_NE here as well does not save ! much time, since Py_NE is rarely used. */ ! if (a->ob_size == b->ob_size ! && (a->ob_sval[0] == b->ob_sval[0] ! && memcmp(a->ob_sval, b->ob_sval, ! a->ob_size) == 0)) { ! result = Py_True; ! } else { ! result = Py_False; ! } ! goto out; } ! len_a = a->ob_size; len_b = b->ob_size; ! min_len = (len_a < len_b) ? len_a : len_b; ! if (min_len > 0) { ! c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval); ! if (c==0) ! c = memcmp(a->ob_sval, b->ob_sval, min_len); ! }else ! c = 0; ! if (c == 0) ! c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0; ! switch (op) { ! case Py_LT: c = c < 0; break; ! case Py_LE: c = c <= 0; break; ! case Py_EQ: assert(0); break; /* unreachable */ ! case Py_NE: c = c != 0; break; ! case Py_GT: c = c > 0; break; ! case Py_GE: c = c >= 0; break; ! default: ! result = Py_NotImplemented; ! goto out; ! } ! result = c ? Py_True : Py_False; ! out: ! Py_INCREF(result); ! return result; ! } ! ! int ! _PyString_Eq(PyObject *o1, PyObject *o2) ! { ! PyStringObject *a, *b; ! a = (PyStringObject*)o1; ! b = (PyStringObject*)o2; ! return a->ob_size == b->ob_size ! && *a->ob_sval == *b->ob_sval ! && memcmp(a->ob_sval, b->ob_sval, a->ob_size) == 0; } *************** *** 2467,2471 **** (getattrfunc)string_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ ! (cmpfunc)string_compare, /*tp_compare*/ (reprfunc)string_repr, /*tp_repr*/ 0, /*tp_as_number*/ --- 2526,2530 ---- (getattrfunc)string_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ ! 0, /*tp_compare*/ (reprfunc)string_repr, /*tp_repr*/ 0, /*tp_as_number*/ *************** *** 2480,2483 **** --- 2539,2548 ---- Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + (richcmpfunc)string_richcompare, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ }; From loewis@users.sourceforge.net Thu May 24 17:56:37 2001 From: loewis@users.sourceforge.net (Martin v. L?wis) Date: Thu, 24 May 2001 09:56:37 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include stringobject.h,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv11296/Include Modified Files: stringobject.h Log Message: Patch #424335: Implement string_richcompare, remove string_compare. Use new _PyString_Eq in lookdict_string. Index: stringobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/stringobject.h,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -r2.26 -r2.27 *** stringobject.h 2001/05/15 11:58:05 2.26 --- stringobject.h 2001/05/24 16:56:35 2.27 *************** *** 59,62 **** --- 59,63 ---- extern DL_IMPORT(void) PyString_ConcatAndDel(PyObject **, PyObject *); extern DL_IMPORT(int) _PyString_Resize(PyObject **, int); + extern DL_IMPORT(int) _PyString_Eq(PyObject *, PyObject*); extern DL_IMPORT(PyObject *) PyString_Format(PyObject *, PyObject *); extern DL_IMPORT(PyObject *) _PyString_FormatLong(PyObject*, int, int, From bwarsaw@users.sourceforge.net Fri May 25 00:06:16 2001 From: bwarsaw@users.sourceforge.net (Barry Warsaw) Date: Thu, 24 May 2001 16:06:16 -0700 Subject: [Python-checkins] CVS: python/dist/src/Tools/i18n pygettext.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/i18n In directory usw-pr-cvs1:/tmp/cvs-serv15162 Modified Files: pygettext.py Log Message: write(): Aggressively sort all catalog entries, and fix the bug where there were multiple translatable strings on a single line of source code. Index: pygettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/i18n/pygettext.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** pygettext.py 2001/05/23 16:59:45 1.17 --- pygettext.py 2001/05/24 23:06:13 1.18 *************** *** 332,374 **** keys = v.keys() keys.sort() ! reverse[tuple(keys)] = (k, v) rkeys = reverse.keys() rkeys.sort() for rkey in rkeys: ! k, v = reverse[rkey] ! # If the entry was gleaned out of a docstring, then add a comment ! # stating so. This is to aid translators who may wish to skip ! # translating some unimportant docstrings. ! if reduce(operator.__add__, v.values()): ! print >> fp, '#. docstring' ! # k is the message string, v is a dictionary-set of (filename, ! # lineno) tuples. We want to sort the entries in v first by file ! # name and then by line number. ! v = v.keys() ! v.sort() ! if not options.writelocations: ! pass ! # location comments are different b/w Solaris and GNU: ! elif options.locationstyle == options.SOLARIS: ! for filename, lineno in v: ! d = {'filename': filename, 'lineno': lineno} ! print >>fp, _('# File: %(filename)s, line: %(lineno)d') % d ! elif options.locationstyle == options.GNU: ! # fit as many locations on one line, as long as the ! # resulting line length doesn't exceeds 'options.width' ! locline = '#:' ! for filename, lineno in v: ! d = {'filename': filename, 'lineno': lineno} ! s = _(' %(filename)s:%(lineno)d') % d ! if len(locline) + len(s) <= options.width: ! locline = locline + s ! else: print >> fp, locline ! locline = "#:" + s ! if len(locline) > 2: ! print >> fp, locline ! # TBD: sorting, normalizing ! print >> fp, 'msgid', normalize(k) ! print >> fp, 'msgstr ""\n' --- 332,376 ---- keys = v.keys() keys.sort() ! reverse.setdefault(tuple(keys), []).append((k, v)) rkeys = reverse.keys() rkeys.sort() for rkey in rkeys: ! rentries = reverse[rkey] ! rentries.sort() ! for k, v in rentries: ! # If the entry was gleaned out of a docstring, then add a ! # comment stating so. This is to aid translators who may wish ! # to skip translating some unimportant docstrings. ! if reduce(operator.__add__, v.values()): ! print >> fp, '#. docstring' ! # k is the message string, v is a dictionary-set of (filename, ! # lineno) tuples. We want to sort the entries in v first by ! # file name and then by line number. ! v = v.keys() ! v.sort() ! if not options.writelocations: ! pass ! # location comments are different b/w Solaris and GNU: ! elif options.locationstyle == options.SOLARIS: ! for filename, lineno in v: ! d = {'filename': filename, 'lineno': lineno} ! print >>fp, _( ! '# File: %(filename)s, line: %(lineno)d') % d ! elif options.locationstyle == options.GNU: ! # fit as many locations on one line, as long as the ! # resulting line length doesn't exceeds 'options.width' ! locline = '#:' ! for filename, lineno in v: ! d = {'filename': filename, 'lineno': lineno} ! s = _(' %(filename)s:%(lineno)d') % d ! if len(locline) + len(s) <= options.width: ! locline = locline + s ! else: ! print >> fp, locline ! locline = "#:" + s ! if len(locline) > 2: print >> fp, locline ! print >> fp, 'msgid', normalize(k) ! print >> fp, 'msgstr ""\n' From fdrake@users.sourceforge.net Fri May 25 05:24:39 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 24 May 2001 21:24:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libstdtypes.tex,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv1010/lib Modified Files: libstdtypes.tex Log Message: Add descriptions of {}.iteritems(), {}.iterkeys(), and {}.itervalues() in the table of mapping object operations. Re-numbered the list of notes to reflect the move of the "Added in version 2.2." note to the list of notes instead of being inserted into the last column of the table. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -r1.58 -r1.59 *** libstdtypes.tex 2001/05/03 04:39:10 1.58 --- libstdtypes.tex 2001/05/25 04:24:37 1.59 *************** *** 924,950 **** \lineiii{\var{k} \code{in} \var{a}} {Equivalent to \var{a}.has_key(\var{k})} ! {\versionadded{2.2}} \lineiii{\var{k} not in \var{a}} {Equivalent to \code{not} \var{a}.has_key(\var{k})} ! {\versionadded{2.2}} \lineiii{\var{a}.items()} {a copy of \var{a}'s list of (\var{key}, \var{value}) pairs} ! {(2)} \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)} \lineiii{\var{a}.update(\var{b})} {\code{for k in \var{b}.keys(): \var{a}[k] = \var{b}[k]}} ! {(3)} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, else \var{x}} ! {(4)} \lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})} {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, else \var{x} (also setting it)} ! {(5)} \lineiii{\var{a}.popitem()} {remove and return an arbitrary (\var{key}, \var{value}) pair} ! {(6)} \end{tableiii} --- 924,959 ---- \lineiii{\var{k} \code{in} \var{a}} {Equivalent to \var{a}.has_key(\var{k})} ! {(2)} \lineiii{\var{k} not in \var{a}} {Equivalent to \code{not} \var{a}.has_key(\var{k})} ! {(2)} \lineiii{\var{a}.items()} {a copy of \var{a}'s list of (\var{key}, \var{value}) pairs} ! {(3)} \lineiii{\var{a}.keys()}{a copy of \var{a}'s list of keys}{(2)} \lineiii{\var{a}.update(\var{b})} {\code{for k in \var{b}.keys(): \var{a}[k] = \var{b}[k]}} ! {(4)} \lineiii{\var{a}.values()}{a copy of \var{a}'s list of values}{(2)} \lineiii{\var{a}.get(\var{k}\optional{, \var{x}})} {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, else \var{x}} ! {(5)} \lineiii{\var{a}.setdefault(\var{k}\optional{, \var{x}})} {\code{\var{a}[\var{k}]} if \code{\var{k} in \var{a}}, else \var{x} (also setting it)} ! {(6)} \lineiii{\var{a}.popitem()} {remove and return an arbitrary (\var{key}, \var{value}) pair} ! {(7)} ! \lineiii{\var{a}.iteritems()} ! {return an iterator over (\var{key}, \var{value}) pairs} ! {(2)} ! \lineiii{\var{a}.iterkeys()} ! {return an iterator over the mapping's keys} ! {(2)} ! \lineiii{\var{a}.itervalues()} ! {return an iterator over the mapping's values} ! {(2)} \end{tableiii} *************** *** 954,959 **** \item[(1)] Raises a \exception{KeyError} exception if \var{k} is not in the map. ! \item[(2)] Keys and values are listed in random order. If \method{keys()} and \method{values()} are called with no intervening modifications to the dictionary, the two lists will directly --- 963,970 ---- \item[(1)] Raises a \exception{KeyError} exception if \var{k} is not in the map. + + \item[(2)] \versionadded{2.2} ! \item[(3)] Keys and values are listed in random order. If \method{keys()} and \method{values()} are called with no intervening modifications to the dictionary, the two lists will directly *************** *** 962,976 **** \var{a}.values(), \var{a}.keys())}. ! \item[(3)] \var{b} must be of the same type as \var{a}. ! \item[(4)] Never raises an exception if \var{k} is not in the map, instead it returns \var{x}. \var{x} is optional; when \var{x} is not provided and \var{k} is not in the map, \code{None} is returned. ! \item[(5)] \function{setdefault()} is like \function{get()}, except that if \var{k} is missing, \var{x} is both returned and inserted into the dictionary as the value of \var{k}. ! \item[(6)] \function{popitem()} is useful to destructively iterate over a dictionary, as often used in set algorithms. \end{description} --- 973,987 ---- \var{a}.values(), \var{a}.keys())}. ! \item[(4)] \var{b} must be of the same type as \var{a}. ! \item[(5)] Never raises an exception if \var{k} is not in the map, instead it returns \var{x}. \var{x} is optional; when \var{x} is not provided and \var{k} is not in the map, \code{None} is returned. ! \item[(6)] \function{setdefault()} is like \function{get()}, except that if \var{k} is missing, \var{x} is both returned and inserted into the dictionary as the value of \var{k}. ! \item[(7)] \function{popitem()} is useful to destructively iterate over a dictionary, as often used in set algorithms. \end{description} From gvwilson@users.sourceforge.net Fri May 25 16:54:28 2001 From: gvwilson@users.sourceforge.net (Greg Wilson) Date: Fri, 25 May 2001 08:54:28 -0700 Subject: [Python-checkins] CVS: python/nondist/sandbox/sets set.py,1.1,1.2 test_set.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/sets In directory usw-pr-cvs1:/tmp/cvs-serv3005 Modified Files: set.py test_set.py Log Message: Changed names of methods and sets to reflect preference for underscore separated rather than camel back. Index: set.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sets/set.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** set.py 2001/05/22 16:55:12 1.1 --- set.py 2001/05/25 15:54:25 1.2 *************** *** 21,28 **** #---------------------------------------- ! def __init__(self, seq=None, sortRepr=0): """Construct a set, optionally initializing it with elements ! drawn from a sequence. If 'sortRepr' is true, the set's elements are displayed in sorted order. This slows down conversion, but simplifies comparison during testing. The --- 21,28 ---- #---------------------------------------- ! def __init__(self, seq=None, sort_repr=0): """Construct a set, optionally initializing it with elements ! drawn from a sequence. If 'sort_repr' is true, the set's elements are displayed in sorted order. This slows down conversion, but simplifies comparison during testing. The *************** *** 32,36 **** self.elements = {} ! self.sortRepr = sortRepr if seq is not None: for x in seq: --- 32,36 ---- self.elements = {} ! self.sort_repr = sort_repr if seq is not None: for x in seq: *************** *** 42,46 **** """Convert set to string.""" content = self.elements.keys() ! if self.sortRepr: content.sort() return 'Set(' + `content` + ')' --- 42,46 ---- """Convert set to string.""" content = self.elements.keys() ! if self.sort_repr: content.sort() return 'Set(' + `content` + ')' *************** *** 95,99 **** #---------------------------------------- ! def isFrozen(self): """Report whether set is frozen or not. A frozen set is one --- 95,99 ---- #---------------------------------------- ! def is_frozen(self): """Report whether set is frozen or not. A frozen set is one *************** *** 129,137 **** #---------------------------------------- ! def unionUpdate(self, other): """Update set with union of its own elements and the elements in another set.""" ! self._binaryOpSanityCheck(other, "updating union") self.elements.update(other.elements) return self --- 129,137 ---- #---------------------------------------- ! def union_update(self, other): """Update set with union of its own elements and the elements in another set.""" ! self._binary_sanity_check(other, "updating union") self.elements.update(other.elements) return self *************** *** 142,156 **** and another's.""" ! self._binaryOpSanityCheck(other) result = self.__copy__() ! result.unionUpdate(other) return result #---------------------------------------- ! def intersectUpdate(self, other): """Update set with intersection of its own elements and the elements in another set.""" ! self._binaryOpSanityCheck(other, "updating intersection") new_elements = {} for elt in self.elements: --- 142,156 ---- and another's.""" ! self._binary_sanity_check(other) result = self.__copy__() ! result.union_update(other) return result #---------------------------------------- ! def intersect_update(self, other): """Update set with intersection of its own elements and the elements in another set.""" ! self._binary_sanity_check(other, "updating intersection") new_elements = {} for elt in self.elements: *************** *** 165,169 **** set's and another's.""" ! self._binaryOpSanityCheck(other) if len(self) <= len(other): little, big = self, other --- 165,169 ---- set's and another's.""" ! self._binary_sanity_check(other) if len(self) <= len(other): little, big = self, other *************** *** 177,181 **** #---------------------------------------- ! def symDifferenceUpdate(self, other): """Update set with symmetric difference of its own elements and the elements in another set. A value 'x' is in the result --- 177,181 ---- #---------------------------------------- ! def sym_difference_update(self, other): """Update set with symmetric difference of its own elements and the elements in another set. A value 'x' is in the result *************** *** 183,192 **** in both.""" ! self._binaryOpSanityCheck(other, "updating symmetric difference") ! self.elements = self._rawSymDifference(self.elements, other.elements) return self #---------------------------------------- ! def symDifference(self, other): """Create new set with symmetric difference of this set's own elements and the elements in another set. A value 'x' is in --- 183,192 ---- in both.""" ! self._binary_sanity_check(other, "updating symmetric difference") ! self.elements = self._raw_sym_difference(self.elements, other.elements) return self #---------------------------------------- ! def sym_difference(self, other): """Create new set with symmetric difference of this set's own elements and the elements in another set. A value 'x' is in *************** *** 194,207 **** set, but not in both.""" ! self._binaryOpSanityCheck(other) result = Set() ! result.elements = self._rawSymDifference(self.elements, other.elements) return result #---------------------------------------- ! def differenceUpdate(self, other): """Remove all elements of another set from this set.""" ! self._binaryOpSanityCheck(other, "updating difference") new_elements = {} for elt in self.elements: --- 194,207 ---- set, but not in both.""" ! self._binary_sanity_check(other) result = Set() ! result.elements = self._raw_sym_difference(self.elements, other.elements) return result #---------------------------------------- ! def difference_update(self, other): """Remove all elements of another set from this set.""" ! self._binary_sanity_check(other, "updating difference") new_elements = {} for elt in self.elements: *************** *** 216,220 **** present in another set.""" ! self._binaryOpSanityCheck(other) result = Set() for elt in self.elements: --- 216,220 ---- present in another set.""" ! self._binary_sanity_check(other) result = Set() for elt in self.elements: *************** *** 224,227 **** --- 224,242 ---- #---------------------------------------- + # Arithmetic forms of operations + __or__ = union + __ror__ = union + __ior__ = union_update + __and__ = intersect + __rand__ = intersect + __iand__ = intersect_update + __xor__ = sym_difference + __rxor__ = sym_difference + __ixor__ = sym_difference_update + __sub__ = difference + __rsub__ = difference + __isub__ = difference_update + + #---------------------------------------- def add(self, item): """Add an item to a set. This has no effect if the item is *************** *** 277,281 **** #---------------------------------------- ! def isSubsetOf(self, other): """Reports whether other set contains this set.""" if not isinstance(other, Set): --- 292,296 ---- #---------------------------------------- ! def is_subset_of(self, other): """Reports whether other set contains this set.""" if not isinstance(other, Set): *************** *** 287,291 **** #---------------------------------------- ! def containsAllOf(self, other): """Report whether other subset is subset of this set.""" if not isinstance(other, Set): --- 302,306 ---- #---------------------------------------- ! def contains_all_of(self, other): """Report whether other subset is subset of this set.""" if not isinstance(other, Set): *************** *** 297,319 **** #---------------------------------------- - # Arithmetic forms of operations - __or__ = union - __ror__ = union - __ior__ = unionUpdate - __and__ = intersect - __rand__ = intersect - __iand__ = intersectUpdate - __xor__ = symDifference - __rxor__ = symDifference - __ixor__ = symDifferenceUpdate - __sub__ = difference - __rsub__ = difference - __isub__ = differenceUpdate - - #---------------------------------------- # Check that the other argument to a binary operation is also a # set, and that this set is still mutable (if appropriate), # raising a ValueError if either condition is not met. ! def _binaryOpSanityCheck(self, other, updating_op=''): if updating_op and (self.hashcode is not None): raise ValueError, Set._Frozen_Msg % updating_op --- 312,319 ---- #---------------------------------------- # Check that the other argument to a binary operation is also a # set, and that this set is still mutable (if appropriate), # raising a ValueError if either condition is not met. ! def _binary_sanity_check(self, other, updating_op=''): if updating_op and (self.hashcode is not None): raise ValueError, Set._Frozen_Msg % updating_op *************** *** 324,328 **** # Calculate the symmetric difference between the keys in two # dictionaries with don't-care values. ! def _rawSymDifference(self, left, right): result = {} for elt in left: --- 324,328 ---- # Calculate the symmetric difference between the keys in two # dictionaries with don't-care values. ! def _raw_sym_difference(self, left, right): result = {} for elt in left: *************** *** 345,362 **** # Unit set ! green = Set((0,)) assert `green` == "Set([0])", "Unit set: %s" % `green` # 3-element set ! blue = Set([0, 1, 2]) ! assert `blue` == "Set([2, 1, 0])", "3-element set: %s" % `blue` # 2-element set with other values ! black = Set([0, 5]) ! assert `black` == "Set([5, 0])", "2-element set: %s" % `black` # All elements from all sets ! white = Set([0, 1, 2, 5]) ! assert `white` == "Set([5, 2, 1, 0])", "4-element set: %s" % `white` # Add element to empty set --- 345,362 ---- # Unit set ! green = Set((0,), 1) assert `green` == "Set([0])", "Unit set: %s" % `green` # 3-element set ! blue = Set([0, 1, 2], 1) ! assert `blue` == "Set([0, 1, 2])", "3-element set: %s" % `blue` # 2-element set with other values ! black = Set([0, 5], 1) ! assert `black` == "Set([0, 5])", "2-element set: %s" % `black` # All elements from all sets ! white = Set([0, 1, 2, 5], 1) ! assert `white` == "Set([0, 1, 2, 5])", "4-element set: %s" % `white` # Add element to empty set *************** *** 372,376 **** red.remove(0) assert 0, "Remove element from empty set: %s" % `red` ! except KeyError: pass --- 372,376 ---- red.remove(0) assert 0, "Remove element from empty set: %s" % `red` ! except LookupError: pass Index: test_set.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/sets/test_set.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_set.py 2001/05/22 16:55:12 1.1 --- test_set.py 2001/05/25 15:54:25 1.2 *************** *** 4,8 **** import unittest, operator, copy ! EmptySet = Set() #=============================================================================== --- 4,8 ---- import unittest, operator, copy ! empty_set = Set() #=============================================================================== *************** *** 10,74 **** class TestBasicOps(unittest.TestCase): ! def checkRepr(self): if self.repr is not None: assert `self.set` == self.repr, "Wrong representation for " + self.case ! def checkLength(self): assert len(self.set) == self.length, "Wrong length for " + self.case ! def checkSelfEquality(self): assert self.set == self.set, "Self-equality failed for " + self.case ! def checkEquivalentEquality(self): assert self.set == self.dup, "Equivalent equality failed for " + self.case ! def checkCopy(self): assert self.set.copy() == self.dup, "Copy and comparison failed for " + self.case ! def checkSelfUnion(self): result = self.set | self.set assert result == self.dup, "Self-union failed for " + self.case ! def checkEmptyUnion(self): ! result = self.set | EmptySet assert result == self.dup, "Union with empty failed for " + self.case ! def checkUnionEmpty(self): ! result = EmptySet | self.set assert result == self.dup, "Union with empty failed for " + self.case ! def checkSelfIntersection(self): result = self.set & self.set assert result == self.dup, "Self-intersection failed for " + self.case ! def checkEmptyIntersection(self): ! result = self.set & EmptySet ! assert result == EmptySet, "Intersection with empty failed for " + self.case ! ! def checkIntersectionEmpty(self): ! result = EmptySet & self.set ! assert result == EmptySet, "Intersection with empty failed for " + self.case ! def checkSelfSymmetricDifference(self): result = self.set ^ self.set ! assert result == EmptySet, "Self-symdiff failed for " + self.case ! def checkEmptySymmetricDifference(self): ! result = self.set ^ EmptySet assert result == self.set, "Symdiff with empty failed for " + self.case ! def checkSelfDifference(self): result = self.set - self.set ! assert result == EmptySet, "Self-difference failed for " + self.case ! def checkEmptyDifference(self): ! result = self.set - EmptySet assert result == self.dup, "Difference with empty failed for " + self.case ! def checkEmptyDifferenceRev(self): ! result = EmptySet - self.set ! assert result == EmptySet, "Difference from empty failed for " + self.case ! def checkIteration(self): for v in self.set: assert v in self.values, "Missing item in iteration for " + self.case --- 10,74 ---- class TestBasicOps(unittest.TestCase): ! def test_repr(self): if self.repr is not None: assert `self.set` == self.repr, "Wrong representation for " + self.case ! def test_length(self): assert len(self.set) == self.length, "Wrong length for " + self.case ! def test_self_equality(self): assert self.set == self.set, "Self-equality failed for " + self.case ! def test_equivalent_equality(self): assert self.set == self.dup, "Equivalent equality failed for " + self.case ! def test_copy(self): assert self.set.copy() == self.dup, "Copy and comparison failed for " + self.case ! def test_self_union(self): result = self.set | self.set assert result == self.dup, "Self-union failed for " + self.case ! def test_empty_union(self): ! result = self.set | empty_set assert result == self.dup, "Union with empty failed for " + self.case ! def test_union_empty(self): ! result = empty_set | self.set assert result == self.dup, "Union with empty failed for " + self.case ! def test_self_intersection(self): result = self.set & self.set assert result == self.dup, "Self-intersection failed for " + self.case ! def test_empty_intersection(self): ! result = self.set & empty_set ! assert result == empty_set, "Intersection with empty failed for " + self.case ! ! def test_intersection_empty(self): ! result = empty_set & self.set ! assert result == empty_set, "Intersection with empty failed for " + self.case ! def test_self_symmetric_difference(self): result = self.set ^ self.set ! assert result == empty_set, "Self-symdiff failed for " + self.case ! def checkempty_symmetric_difference(self): ! result = self.set ^ empty_set assert result == self.set, "Symdiff with empty failed for " + self.case ! def test_self_difference(self): result = self.set - self.set ! assert result == empty_set, "Self-difference failed for " + self.case ! def test_empty_difference(self): ! result = self.set - empty_set assert result == self.dup, "Difference with empty failed for " + self.case ! def test_empty_difference_rev(self): ! result = empty_set - self.set ! assert result == empty_set, "Difference from empty failed for " + self.case ! def test_iteration(self): for v in self.set: assert v in self.values, "Missing item in iteration for " + self.case *************** *** 96,103 **** self.repr = "Set([3])" ! def checkIn(self): assert 3 in self.set, "Valueship for unit set" ! def checkNotIn(self): assert 2 not in self.set, "Non-valueship for unit set" --- 96,103 ---- self.repr = "Set([3])" ! def test_in(self): assert 3 in self.set, "Valueship for unit set" ! def test_not_in(self): assert 2 not in self.set, "Non-valueship for unit set" *************** *** 113,120 **** self.repr = "Set([(0, 'zero')])" ! def checkIn(self): assert (0, "zero") in self.set, "Valueship for tuple set" ! def checkNotIn(self): assert 9 not in self.set, "Non-valueship for tuple set" --- 113,120 ---- self.repr = "Set([(0, 'zero')])" ! def test_in(self): assert (0, "zero") in self.set, "Valueship for tuple set" ! def test_not_in(self): assert 9 not in self.set, "Non-valueship for tuple set" *************** *** 136,184 **** self.set = Set((2, 4, 6)) ! def checkUnionSubset(self): result = self.set | Set([2]) assert result == Set((2, 4, 6)), "Subset union" ! def checkUnionSuperset(self): result = self.set | Set([2, 4, 6, 8]) assert result == Set([2, 4, 6, 8]), "Superset union" ! def checkUnionOverlap(self): result = self.set | Set([3, 4, 5]) assert result == Set([2, 3, 4, 5, 6]), "Overlapping union" ! def checkUnionNonOverlap(self): result = self.set | Set([8]) assert result == Set([2, 4, 6, 8]), "Non-overlapping union" ! def checkIntersectionSubset(self): result = self.set & Set((2, 4)) assert result == Set((2, 4)), "Subset intersection" ! def checkIntersectionSuperset(self): result = self.set & Set([2, 4, 6, 8]) assert result == Set([2, 4, 6]), "Superset intersection" ! def checkIntersectionOverlap(self): result = self.set & Set([3, 4, 5]) assert result == Set([4]), "Overlapping intersection" ! def checkIntersectionNonOverlap(self): result = self.set & Set([8]) ! assert result == EmptySet, "Non-overlapping intersection" ! def checkSymDifferenceSubset(self): result = self.set ^ Set((2, 4)) assert result == Set([6]), "Subset symmetric difference" ! def checkSymDifferenceSuperset(self): result = self.set ^ Set((2, 4, 6, 8)) assert result == Set([8]), "Superset symmetric difference" ! def checkSymDifferenceOverlap(self): result = self.set ^ Set((3, 4, 5)) assert result == Set([2, 3, 5, 6]), "Overlapping symmetric difference" ! def checkSymDifferenceNonOverlap(self): result = self.set ^ Set([8]) assert result == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" --- 136,184 ---- self.set = Set((2, 4, 6)) ! def test_union_subset(self): result = self.set | Set([2]) assert result == Set((2, 4, 6)), "Subset union" ! def test_union_superset(self): result = self.set | Set([2, 4, 6, 8]) assert result == Set([2, 4, 6, 8]), "Superset union" ! def test_union_overlap(self): result = self.set | Set([3, 4, 5]) assert result == Set([2, 3, 4, 5, 6]), "Overlapping union" ! def test_union_non_overlap(self): result = self.set | Set([8]) assert result == Set([2, 4, 6, 8]), "Non-overlapping union" ! def test_intersection_subset(self): result = self.set & Set((2, 4)) assert result == Set((2, 4)), "Subset intersection" ! def test_intersection_superset(self): result = self.set & Set([2, 4, 6, 8]) assert result == Set([2, 4, 6]), "Superset intersection" ! def test_intersection_overlap(self): result = self.set & Set([3, 4, 5]) assert result == Set([4]), "Overlapping intersection" ! def test_intersection_non_overlap(self): result = self.set & Set([8]) ! assert result == empty_set, "Non-overlapping intersection" ! def test_sym_difference_subset(self): result = self.set ^ Set((2, 4)) assert result == Set([6]), "Subset symmetric difference" ! def test_sym_difference_superset(self): result = self.set ^ Set((2, 4, 6, 8)) assert result == Set([8]), "Superset symmetric difference" ! def test_sym_difference_overlap(self): result = self.set ^ Set((3, 4, 5)) assert result == Set([2, 3, 5, 6]), "Overlapping symmetric difference" ! def test_sym_difference_non_overlap(self): result = self.set ^ Set([8]) assert result == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" *************** *** 190,238 **** self.set = Set((2, 4, 6)) ! def checkUnionSubset(self): self.set |= Set([2]) assert self.set == Set((2, 4, 6)), "Subset union" ! def checkUnionSuperset(self): self.set |= Set([2, 4, 6, 8]) assert self.set == Set([2, 4, 6, 8]), "Superset union" ! def checkUnionOverlap(self): self.set |= Set([3, 4, 5]) assert self.set == Set([2, 3, 4, 5, 6]), "Overlapping union" ! def checkUnionNonOverlap(self): self.set |= Set([8]) assert self.set == Set([2, 4, 6, 8]), "Non-overlapping union" ! def checkIntersectionSubset(self): self.set &= Set((2, 4)) assert self.set == Set((2, 4)), "Subset intersection" ! def checkIntersectionSuperset(self): self.set &= Set([2, 4, 6, 8]) assert self.set == Set([2, 4, 6]), "Superset intersection" ! def checkIntersectionOverlap(self): self.set &= Set([3, 4, 5]) assert self.set == Set([4]), "Overlapping intersection" ! def checkIntersectionNonOverlap(self): self.set &= Set([8]) ! assert self.set == EmptySet, "Non-overlapping intersection" ! def checkSymDifferenceSubset(self): self.set ^= Set((2, 4)) assert self.set == Set([6]), "Subset symmetric difference" ! def checkSymDifferenceSuperset(self): self.set ^= Set((2, 4, 6, 8)) assert self.set == Set([8]), "Superset symmetric difference" ! def checkSymDifferenceOverlap(self): self.set ^= Set((3, 4, 5)) assert self.set == Set([2, 3, 5, 6]), "Overlapping symmetric difference" ! def checkSymDifferenceNonOverlap(self): self.set ^= Set([8]) assert self.set == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" --- 190,238 ---- self.set = Set((2, 4, 6)) ! def test_union_subset(self): self.set |= Set([2]) assert self.set == Set((2, 4, 6)), "Subset union" ! def test_union_superset(self): self.set |= Set([2, 4, 6, 8]) assert self.set == Set([2, 4, 6, 8]), "Superset union" ! def test_union_overlap(self): self.set |= Set([3, 4, 5]) assert self.set == Set([2, 3, 4, 5, 6]), "Overlapping union" ! def test_union_non_overlap(self): self.set |= Set([8]) assert self.set == Set([2, 4, 6, 8]), "Non-overlapping union" ! def test_intersection_subset(self): self.set &= Set((2, 4)) assert self.set == Set((2, 4)), "Subset intersection" ! def test_intersection_superset(self): self.set &= Set([2, 4, 6, 8]) assert self.set == Set([2, 4, 6]), "Superset intersection" ! def test_intersection_overlap(self): self.set &= Set([3, 4, 5]) assert self.set == Set([4]), "Overlapping intersection" ! def test_intersection_non_overlap(self): self.set &= Set([8]) ! assert self.set == empty_set, "Non-overlapping intersection" ! def test_sym_difference_subset(self): self.set ^= Set((2, 4)) assert self.set == Set([6]), "Subset symmetric difference" ! def test_sym_difference_superset(self): self.set ^= Set((2, 4, 6, 8)) assert self.set == Set([8]), "Superset symmetric difference" ! def test_sym_difference_overlap(self): self.set ^= Set((3, 4, 5)) assert self.set == Set([2, 3, 5, 6]), "Overlapping symmetric difference" ! def test_sym_difference_non_overlap(self): self.set ^= Set([8]) assert self.set == Set([2, 4, 6, 8]), "Non-overlapping symmetric difference" *************** *** 245,270 **** self.set = Set(self.values) ! def checkAddPresent(self): self.set.add("c") assert self.set == Set(("a", "b", "c")), "Adding present element" ! def checkAddAbsent(self): self.set.add("d") assert self.set == Set(("a", "b", "c", "d")), "Adding missing element" ! def checkAddUntilFull(self): tmp = Set() ! expectedLen = 0 for v in self.values: tmp.add(v) ! expectedLen += 1 ! assert len(tmp) == expectedLen, "Adding values one by one to temporary" assert tmp == self.set, "Adding values one by one" ! def checkRemovePresent(self): self.set.remove("b") assert self.set == Set(("a", "c")), "Removing present element" ! def checkRemoveAbsent(self): try: self.set.remove("d") --- 245,270 ---- self.set = Set(self.values) ! def test_add_present(self): self.set.add("c") assert self.set == Set(("a", "b", "c")), "Adding present element" ! def test_add_absent(self): self.set.add("d") assert self.set == Set(("a", "b", "c", "d")), "Adding missing element" ! def test_add_until_full(self): tmp = Set() ! expected_len = 0 for v in self.values: tmp.add(v) ! expected_len += 1 ! assert len(tmp) == expected_len, "Adding values one by one to temporary" assert tmp == self.set, "Adding values one by one" ! def test_remove_present(self): self.set.remove("b") assert self.set == Set(("a", "c")), "Removing present element" ! def test_remove_absent(self): try: self.set.remove("d") *************** *** 273,296 **** pass ! def checkRemoveUntilEmpty(self): ! expectedLen = len(self.set) for v in self.values: self.set.remove(v) ! expectedLen -= 1 ! assert len(self.set) == expectedLen, "Removing values one by one" ! def checkDiscardPresent(self): self.set.discard("c") assert self.set == Set(("a", "b")), "Discarding present element" ! def checkDiscardAbsent(self): self.set.discard("d") assert self.set == Set(("a", "b", "c")), "Discarding missing element" ! def checkClear(self): self.set.clear() assert len(self.set) == 0, "Clearing set" ! def checkPopitem(self): popped = {} while self.set: --- 273,296 ---- pass ! def test_remove_until_empty(self): ! expected_len = len(self.set) for v in self.values: self.set.remove(v) ! expected_len -= 1 ! assert len(self.set) == expected_len, "Removing values one by one" ! def test_discard_present(self): self.set.discard("c") assert self.set == Set(("a", "b")), "Discarding present element" ! def test_discard_absent(self): self.set.discard("d") assert self.set == Set(("a", "b", "c")), "Discarding missing element" ! def test_clear(self): self.set.clear() assert len(self.set) == 0, "Clearing set" ! def test_popitem(self): popped = {} while self.set: *************** *** 300,312 **** assert v in popped, "Popping items" ! def checkUpdateEmptyTuple(self): self.set.update(()) assert self.set == Set(self.values), "Updating with empty tuple" ! def checkUpdateUnitTupleOverlap(self): self.set.update(("a",)) assert self.set == Set(self.values), "Updating with overlapping unit tuple" ! def checkUpdateUnitTupleNonOverlap(self): self.set.update(("a", "z")) assert self.set == Set(self.values + ["z"]), "Updating with non-overlapping unit tuple" --- 300,312 ---- assert v in popped, "Popping items" ! def test_update_empty_tuple(self): self.set.update(()) assert self.set == Set(self.values), "Updating with empty tuple" ! def test_update_unit_tuple_overlap(self): self.set.update(("a",)) assert self.set == Set(self.values), "Updating with overlapping unit tuple" ! def test_update_unit_tuple_non_overlap(self): self.set.update(("a", "z")) assert self.set == Set(self.values + ["z"]), "Updating with non-overlapping unit tuple" *************** *** 320,327 **** hash(self.set) ! def checkFreezeAfterHash(self): ! assert self.set.isFrozen(), "Set not frozen after hashing" ! def checkClearAfterFreeze(self): try: self.set.clear() --- 320,327 ---- hash(self.set) ! def test_freeze_after_hash(self): ! assert self.set.is_frozen(), "Set not frozen after hashing" ! def test_clear_after_freeze(self): try: self.set.clear() *************** *** 330,334 **** pass ! def checkUnionAfterFreeze(self): try: self.set |= Set([2]) --- 330,334 ---- pass ! def test_union_after_freeze(self): try: self.set |= Set([2]) *************** *** 337,341 **** pass ! def checkIntersectionAfterFreeze(self): try: self.set &= Set([2]) --- 337,341 ---- pass ! def test_intersection_after_freeze(self): try: self.set &= Set([2]) *************** *** 344,348 **** pass ! def checkSymDifferenceAfterFreeze(self): try: self.set ^= Set([2]) --- 344,348 ---- pass ! def test_sym_difference_after_freeze(self): try: self.set ^= Set([2]) *************** *** 351,355 **** pass ! def checkDifferenceAfterFreeze(self): try: self.set -= Set([2]) --- 351,355 ---- pass ! def test_difference_after_freeze(self): try: self.set -= Set([2]) *************** *** 358,362 **** pass ! def checkAddAfterFreeze(self): try: self.set.add(4) --- 358,362 ---- pass ! def test_add_after_freeze(self): try: self.set.add(4) *************** *** 365,369 **** pass ! def checkUpdateAfterFreeze(self): try: self.set.update([4, 5]) --- 365,369 ---- pass ! def test_update_after_freeze(self): try: self.set.update([4, 5]) *************** *** 376,381 **** class TestSubsets(unittest.TestCase): ! def checkIsSubsetOf(self): ! result = self.left.isSubsetOf(self.right) if "<" in self.cases: assert result, "subset: " + self.name --- 376,381 ---- class TestSubsets(unittest.TestCase): ! def test_is_subset_of(self): ! result = self.left.is_subset_of(self.right) if "<" in self.cases: assert result, "subset: " + self.name *************** *** 383,388 **** assert not result, "non-subset: " + self.name ! def checkContainsAllOf(self): ! result = self.left.containsAllOf(self.right) if ">" in self.cases: assert result, "contains all: " + self.name --- 383,388 ---- assert not result, "non-subset: " + self.name ! def test_contains_all_of(self): ! result = self.left.contains_all_of(self.right) if ">" in self.cases: assert result, "contains all: " + self.name *************** *** 439,443 **** class TestOnlySetsInBinaryOps(unittest.TestCase): ! def checkCmp(self): try: self.other < self.set --- 439,443 ---- class TestOnlySetsInBinaryOps(unittest.TestCase): ! def test_cmp(self): try: self.other < self.set *************** *** 451,455 **** pass ! def checkUnionUpdate(self): try: self.set |= self.other --- 451,455 ---- pass ! def test_union_update(self): try: self.set |= self.other *************** *** 458,462 **** pass ! def checkUnion(self): try: self.other | self.set --- 458,462 ---- pass ! def test_union(self): try: self.other | self.set *************** *** 470,474 **** pass ! def checkIntersectionUpdate(self): try: self.set &= self.other --- 470,474 ---- pass ! def test_intersection_update(self): try: self.set &= self.other *************** *** 477,481 **** pass ! def checkIntersection(self): try: self.other & self.set --- 477,481 ---- pass ! def test_intersection(self): try: self.other & self.set *************** *** 489,493 **** pass ! def checkSymDifferenceUpdate(self): try: self.set ^= self.other --- 489,493 ---- pass ! def test_sym_difference_update(self): try: self.set ^= self.other *************** *** 496,500 **** pass ! def checkSymDifference(self): try: self.other ^ self.set --- 496,500 ---- pass ! def test_sym_difference(self): try: self.other ^ self.set *************** *** 508,512 **** pass ! def checkDifferenceUpdate(self): try: self.set -= self.other --- 508,512 ---- pass ! def test_difference_update(self): try: self.set -= self.other *************** *** 515,519 **** pass ! def checkDifference(self): try: self.other - self.set --- 515,519 ---- pass ! def test_difference(self): try: self.other - self.set *************** *** 552,556 **** class TestCopying(unittest.TestCase): ! def checkCopy(self): dup = self.set.copy() dup_list = list(dup); dup_list.sort() --- 552,556 ---- class TestCopying(unittest.TestCase): ! def test_copy(self): dup = self.set.copy() dup_list = list(dup); dup_list.sort() *************** *** 560,564 **** assert dup_list[i] is set_list[i], "Non-identical items after copy" ! def checkDeepCopy(self): dup = copy.deepcopy(self.set) dup_list = list(dup); dup_list.sort() --- 560,564 ---- assert dup_list[i] is set_list[i], "Non-identical items after copy" ! def test_deep_copy(self): dup = copy.deepcopy(self.set) dup_list = list(dup); dup_list.sort() *************** *** 602,626 **** def makeAllTests(): suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestBasicOpsEmpty, 'check')) ! suite.addTest(unittest.makeSuite(TestBasicOpsSingleton, 'check')) ! suite.addTest(unittest.makeSuite(TestBasicOpsTuple, 'check')) ! suite.addTest(unittest.makeSuite(TestBasicOpsTriple, 'check')) ! suite.addTest(unittest.makeSuite(TestBinaryOps, 'check')) ! suite.addTest(unittest.makeSuite(TestUpdateOps, 'check')) ! suite.addTest(unittest.makeSuite(TestMutate, 'check')) ! suite.addTest(unittest.makeSuite(TestFreeze, 'check')) ! suite.addTest(unittest.makeSuite(TestSubsetEqualEmpty, 'check')) ! suite.addTest(unittest.makeSuite(TestSubsetEqualNonEmpty, 'check')) ! suite.addTest(unittest.makeSuite(TestSubsetEmptyNonEmpty, 'check')) ! suite.addTest(unittest.makeSuite(TestSubsetPartial, 'check')) ! suite.addTest(unittest.makeSuite(TestSubsetNonOverlap, 'check')) ! suite.addTest(unittest.makeSuite(TestOnlySetsNumeric, 'check')) ! suite.addTest(unittest.makeSuite(TestOnlySetsDict, 'check')) ! suite.addTest(unittest.makeSuite(TestOnlySetsOperator, 'check')) ! suite.addTest(unittest.makeSuite(TestCopyingEmpty, 'check')) ! suite.addTest(unittest.makeSuite(TestCopyingSingleton, 'check')) ! suite.addTest(unittest.makeSuite(TestCopyingTriple, 'check')) ! suite.addTest(unittest.makeSuite(TestCopyingTuple, 'check')) ! suite.addTest(unittest.makeSuite(TestCopyingNested, 'check')) return suite --- 602,626 ---- def makeAllTests(): suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestBasicOpsEmpty)) ! suite.addTest(unittest.makeSuite(TestBasicOpsSingleton)) ! suite.addTest(unittest.makeSuite(TestBasicOpsTuple)) ! suite.addTest(unittest.makeSuite(TestBasicOpsTriple)) ! suite.addTest(unittest.makeSuite(TestBinaryOps)) ! suite.addTest(unittest.makeSuite(TestUpdateOps)) ! suite.addTest(unittest.makeSuite(TestMutate)) ! suite.addTest(unittest.makeSuite(TestFreeze)) ! suite.addTest(unittest.makeSuite(TestSubsetEqualEmpty)) ! suite.addTest(unittest.makeSuite(TestSubsetEqualNonEmpty)) ! suite.addTest(unittest.makeSuite(TestSubsetEmptyNonEmpty)) ! suite.addTest(unittest.makeSuite(TestSubsetPartial)) ! suite.addTest(unittest.makeSuite(TestSubsetNonOverlap)) ! suite.addTest(unittest.makeSuite(TestOnlySetsNumeric)) ! suite.addTest(unittest.makeSuite(TestOnlySetsDict)) ! suite.addTest(unittest.makeSuite(TestOnlySetsOperator)) ! suite.addTest(unittest.makeSuite(TestCopyingEmpty)) ! suite.addTest(unittest.makeSuite(TestCopyingSingleton)) ! suite.addTest(unittest.makeSuite(TestCopyingTriple)) ! suite.addTest(unittest.makeSuite(TestCopyingTuple)) ! suite.addTest(unittest.makeSuite(TestCopyingNested)) return suite From fdrake@users.sourceforge.net Fri May 25 17:21:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 25 May 2001 09:21:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libposixpath.tex,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv12610/Doc/lib Modified Files: libposixpath.tex Log Message: Add a version annotation for splitdrive(); old, but as long as I managed to end up with the information, it is better recorded than lost. Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** libposixpath.tex 2000/10/26 21:38:23 1.17 --- libposixpath.tex 2001/05/25 16:21:00 1.18 *************** *** 182,185 **** --- 182,186 ---- \var{drive} will always be the empty string. In all cases, \code{\var{drive} + \var{tail}} will be the same as \var{path}. + \versionadded{1.3} \end{funcdesc} From fdrake@users.sourceforge.net Fri May 25 17:21:24 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Fri, 25 May 2001 09:21:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libposixpath.tex,1.17,1.17.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv12759/Doc/lib Modified Files: Tag: release21-maint libposixpath.tex Log Message: Add a version annotation for splitdrive(); old, but as long as I managed to end up with the information, it is better recorded than lost. Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.17 retrieving revision 1.17.4.1 diff -C2 -r1.17 -r1.17.4.1 *** libposixpath.tex 2000/10/26 21:38:23 1.17 --- libposixpath.tex 2001/05/25 16:21:22 1.17.4.1 *************** *** 182,185 **** --- 182,186 ---- \var{drive} will always be the empty string. In all cases, \code{\var{drive} + \var{tail}} will be the same as \var{path}. + \versionadded{1.3} \end{funcdesc} From tim_one@users.sourceforge.net Sat May 26 06:28:43 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 25 May 2001 22:28:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects listobject.c,2.92,2.93 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv21433/python/dist/src/Objects Modified Files: listobject.c Log Message: roundupsize() and friends: fiddle over-allocation strategy for list resizing. Accurate timings are impossible on my Win98SE box, but this is obviously faster even on this box for reasonable list.append() cases. I give credit for this not to the resizing strategy but to getting rid of integer multiplication and divsion (in favor of shifting) when computing the rounded-up size. For unreasonable list.append() cases, Win98SE now displays linear behavior for one-at-time appends up to a list with about 35 million elements. Then it dies with a MemoryError, due to fatally fragmented *address space* (there's plenty of VM available, but by this point Win9X has broken user space into many distinct heaps none of which has enough contiguous space left to resize the list, and for whatever reason Win9x isn't coalescing the dead heaps). Before the patch it got a MemoryError for the same reason, but once the list reached about 2 million elements. Haven't yet tried on Win2K but have high hopes extreme list.append() will be much better behaved now (NT & Win2K didn't fragment address space, but suffered obvious quadratic-time behavior before as lists got large). For other systems I'm relying on common sense: replacing integer * and / by << and >> can't plausibly hurt, the number of function calls hasn't changed, and the total operation count for reasonably small lists is about the same (while the operations are cheaper now). Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.92 retrieving revision 2.93 diff -C2 -r2.92 -r2.93 *** listobject.c 2001/02/12 22:06:02 2.92 --- listobject.c 2001/05/26 05:28:40 2.93 *************** *** 10,24 **** #endif - #define ROUNDUP(n, PyTryBlock) \ - ((((n)+(PyTryBlock)-1)/(PyTryBlock))*(PyTryBlock)) - static int roundupsize(int n) { ! if (n < 500) ! return ROUNDUP(n, 10); ! else ! return ROUNDUP(n, 100); ! } #define NRESIZE(var, type, nitems) PyMem_RESIZE(var, type, roundupsize(nitems)) --- 10,47 ---- #endif static int roundupsize(int n) { ! unsigned int nbits = 0; ! unsigned int n2 = (unsigned int)n >> 5; ! ! /* Round up: ! * If n < 256, to a multiple of 8. ! * If n < 2048, to a multiple of 64. ! * If n < 16384, to a multiple of 512. ! * If n < 131072, to a multiple of 4096. ! * If n < 1048576, to a multiple of 32768. ! * If n < 8388608, to a multiple of 262144. ! * If n < 67108864, to a multiple of 2097152. ! * If n < 536870912, to a multiple of 16777216. ! * ... ! * If n < 2**(5+3*i), to a multiple of 2**(3*i). ! * ! * This over-allocates proportional to the list size, making room ! * for additional growth. The over-allocation is mild, but is ! * enough to give linear-time amortized behavior over a long ! * sequence of appends() in the presence of a poorly-performing ! * system realloc() (which is a reality, e.g., across all flavors ! * of Windows, with Win9x behavior being particularly bad -- and ! * we've still got address space fragmentation problems on Win9x ! * even with this scheme, although it requires much longer lists to ! * provoke them than it used to). ! */ ! do { ! n2 >>= 3; ! nbits += 3; ! } while (n2); ! return ((n >> nbits) + 1) << nbits; ! } #define NRESIZE(var, type, nitems) PyMem_RESIZE(var, type, roundupsize(nitems)) From tim_one@users.sourceforge.net Sat May 26 06:50:05 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Fri, 25 May 2001 22:50:05 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects listobject.c,2.93,2.94 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv31220/python/dist/src/Objects Modified Files: listobject.c Log Message: Cruft cleanup: removed the #ifdef'ery in support of compiling to allow multi-argument list.append(1, 2, 3) (as opposed to .append((1,2,3))). Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.93 retrieving revision 2.94 diff -C2 -r2.93 -r2.94 *** listobject.c 2001/05/26 05:28:40 2.93 --- listobject.c 2001/05/26 05:50:03 2.94 *************** *** 577,599 **** } - /* Define NO_STRICT_LIST_APPEND to enable multi-argument append() */ - - #ifndef NO_STRICT_LIST_APPEND - #define PyArg_ParseTuple_Compat1 PyArg_ParseTuple - #else - #define PyArg_ParseTuple_Compat1(args, format, ret) \ - ( \ - PyTuple_GET_SIZE(args) > 1 ? (*ret = args, 1) : \ - PyTuple_GET_SIZE(args) == 1 ? (*ret = PyTuple_GET_ITEM(args, 0), 1) : \ - PyArg_ParseTuple(args, format, ret) \ - ) - #endif - - static PyObject * listappend(PyListObject *self, PyObject *args) { PyObject *v; ! if (!PyArg_ParseTuple_Compat1(args, "O:append", &v)) return NULL; return ins(self, (int) self->ob_size, v); --- 577,585 ---- } static PyObject * listappend(PyListObject *self, PyObject *args) { PyObject *v; ! if (!PyArg_ParseTuple(args, "O:append", &v)) return NULL; return ins(self, (int) self->ob_size, v); *************** *** 1362,1366 **** PyObject *v; ! if (!PyArg_ParseTuple_Compat1(args, "O:index", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { --- 1348,1352 ---- PyObject *v; ! if (!PyArg_ParseTuple(args, "O:index", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { *************** *** 1382,1386 **** PyObject *v; ! if (!PyArg_ParseTuple_Compat1(args, "O:count", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { --- 1368,1372 ---- PyObject *v; ! if (!PyArg_ParseTuple(args, "O:count", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { *************** *** 1400,1404 **** PyObject *v; ! if (!PyArg_ParseTuple_Compat1(args, "O:remove", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { --- 1386,1390 ---- PyObject *v; ! if (!PyArg_ParseTuple(args, "O:remove", &v)) return NULL; for (i = 0; i < self->ob_size; i++) { From thomas@xs4all.net Sat May 26 10:49:58 2001 From: thomas@xs4all.net (Thomas Wouters) Date: Sat, 26 May 2001 11:49:58 +0200 Subject: [Python-checkins] CVS: python/dist/src/Objects listobject.c,2.93,2.94 In-Reply-To: ; from tim_one@users.sourceforge.net on Fri, May 25, 2001 at 10:50:05PM -0700 References: Message-ID: <20010526114958.X690@xs4all.nl> On Fri, May 25, 2001 at 10:50:05PM -0700, Tim Peters wrote: > Update of /cvsroot/python/python/dist/src/Objects > In directory usw-pr-cvs1:/tmp/cvs-serv31220/python/dist/src/Objects > > Modified Files: > listobject.c > Log Message: > Cruft cleanup: removed the #ifdef'ery in support of compiling to allow > multi-argument list.append(1, 2, 3) (as opposed to .append((1,2,3))). Shouldn't this get a place in the NEWS/Changes file ? -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From tim_one@users.sourceforge.net Sat May 26 20:37:56 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 26 May 2001 12:37:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects listobject.c,2.94,2.95 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv18842/python/dist/src/Objects Modified Files: listobject.c Log Message: Change list.extend() error msgs and NEWS to reflect that list.extend() now takes any iterable argument, not only sequences. NEEDS DOC CHANGES -- but I don't think we settled on a concise way to say this stuff. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.94 retrieving revision 2.95 diff -C2 -r2.94 -r2.95 *** listobject.c 2001/05/26 05:50:03 2.94 --- listobject.c 2001/05/26 19:37:54 2.95 *************** *** 645,649 **** list_inplace_concat(PyListObject *self, PyObject *other) { ! other = PySequence_Fast(other, "argument to += must be a sequence"); if (!other) return NULL; --- 645,649 ---- list_inplace_concat(PyListObject *self, PyObject *other) { ! other = PySequence_Fast(other, "argument to += must be iterable"); if (!other) return NULL; *************** *** 665,669 **** return NULL; ! b = PySequence_Fast(b, "list.extend() argument must be a sequence"); if (!b) return NULL; --- 665,669 ---- return NULL; ! b = PySequence_Fast(b, "list.extend() argument must be iterable"); if (!b) return NULL; From tim_one@users.sourceforge.net Sat May 26 20:37:56 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sat, 26 May 2001 12:37:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.175,1.176 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv18842/python/dist/src/Misc Modified Files: NEWS Log Message: Change list.extend() error msgs and NEWS to reflect that list.extend() now takes any iterable argument, not only sequences. NEEDS DOC CHANGES -- but I don't think we settled on a concise way to say this stuff. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.175 retrieving revision 1.176 diff -C2 -r1.175 -r1.176 *** NEWS 2001/05/22 16:00:10 1.175 --- NEWS 2001/05/26 19:37:54 1.176 *************** *** 101,105 **** list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API) max(), min() ! .join() method of strings 'x in y' and 'x not in y' (PySequence_Contains() in C API) operator.countOf() (PySequence_Count() in C API) --- 101,106 ---- list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API) max(), min() ! join() method of strings ! extend() method of lists 'x in y' and 'x not in y' (PySequence_Contains() in C API) operator.countOf() (PySequence_Count() in C API) From tim.one@home.com Sat May 26 20:46:39 2001 From: tim.one@home.com (Tim Peters) Date: Sat, 26 May 2001 15:46:39 -0400 Subject: [Python-checkins] CVS: python/dist/src/Objects listobject.c,2.93,2.94 In-Reply-To: <20010526114958.X690@xs4all.nl> Message-ID: >> Modified Files: >> listobject.c >> Log Message: >> Cruft cleanup: removed the #ifdef'ery in support of compiling to allow >> multi-argument list.append(1, 2, 3) (as opposed to .append((1,2,3))). [Thomas Wouters] > Shouldn't this get a place in the NEWS/Changes file ? Didn't think so. NO_STRICT_LIST_APPEND was never documented, neither officially nor mentioned in NEWS when it was added (~14 months ago). From thomas@xs4all.net Sat May 26 20:51:45 2001 From: thomas@xs4all.net (Thomas Wouters) Date: Sat, 26 May 2001 21:51:45 +0200 Subject: [Python-checkins] CVS: python/dist/src/Objects listobject.c,2.93,2.94 In-Reply-To: ; from tim.one@home.com on Sat, May 26, 2001 at 03:46:39PM -0400 References: <20010526114958.X690@xs4all.nl> Message-ID: <20010526215145.Z676@xs4all.nl> On Sat, May 26, 2001 at 03:46:39PM -0400, Tim Peters wrote: > Didn't think so. NO_STRICT_LIST_APPEND was never documented, neither > officially nor mentioned in NEWS when it was added (~14 months ago). Hmm, didn't Guido mention it at least once on c.l.py ? *I* thought it was the official way to make the transition, anyway :) A small note that it now no longer exists could save some people a few hours of frustration, after all. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From jackjansen@users.sourceforge.net Sat May 26 21:01:44 2001 From: jackjansen@users.sourceforge.net (Jack Jansen) Date: Sat, 26 May 2001 13:01:44 -0700 Subject: [Python-checkins] CVS: python/dist/src/Mac/Tools/IDE PyConsole.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory usw-pr-cvs1:/tmp/cvs-serv26394/Python/Mac/Tools/IDE Modified Files: PyConsole.py Log Message: When reading from stdin (with the dialog box) use any partial line on stdout as the prompt. This makes raw_input() and print "xxx", ; sys.stdin.readline() work a bit more palatable. Index: PyConsole.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyConsole.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** PyConsole.py 2001/05/17 12:36:35 1.4 --- PyConsole.py 2001/05/26 20:01:41 1.5 *************** *** 341,346 **** def readline(self): import EasyDialogs sys.stdout.flush() ! rv = EasyDialogs.AskString("") if rv is None: return "" --- 341,353 ---- def readline(self): import EasyDialogs + # A trick to make the input dialog box a bit more palatable + if hasattr(sys.stdout, '_buf'): + prompt = sys.stdout._buf + else: + prompt = "" + if not prompt: + prompt = "Stdin input:" sys.stdout.flush() ! rv = EasyDialogs.AskString(prompt) if rv is None: return "" From tim.one@home.com Sat May 26 21:11:07 2001 From: tim.one@home.com (Tim Peters) Date: Sat, 26 May 2001 16:11:07 -0400 Subject: [Python-checkins] CVS: python/dist/src/Objects listobject.c,2.93,2.94 In-Reply-To: <20010526215145.Z676@xs4all.nl> Message-ID: >> Didn't think so. NO_STRICT_LIST_APPEND was never documented, neither >> officially nor mentioned in NEWS when it was added (~14 months ago). > Hmm, didn't Guido mention it at least once on c.l.py ? *I* thought it > was the official way to make the transition, anyway :) A small note > that it now no longer exists could save some people a few hours of > frustration, after all. Why argue about it? I obviously don't think it's needed. If you think it is, last I looked you had check-in privileges too <0.9 wink>. From tim_one@users.sourceforge.net Sun May 27 08:39:24 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 27 May 2001 00:39:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.176,1.177 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv12990/python/dist/src/Misc Modified Files: NEWS Log Message: Implement an old idea of Christian Tismer's: use polynomial division instead of multiplication to generate the probe sequence. The idea is recorded in Python-Dev for Dec 2000, but that version is prone to rare infinite loops. The value is in getting *all* the bits of the hash code to participate; and, e.g., this speeds up querying every key in a dict with keys [i << 16 for i in range(20000)] by a factor of 500. Should be equally valuable in any bad case where the high-order hash bits were getting ignored. Also wrote up some of the motivations behind Python's ever-more-subtle hash table strategy. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.176 retrieving revision 1.177 diff -C2 -r1.176 -r1.177 *** NEWS 2001/05/26 19:37:54 1.176 --- NEWS 2001/05/27 07:39:22 1.177 *************** *** 117,120 **** --- 117,128 ---- values mutated the dicts. Making the code bulletproof slowed it down. + - Collisions in dicts now use polynomial division instead of multiplication + to generate the probe sequence, following an idea of Christian Tismer's. + This allows all bits of the hash code to come into play. It should have + little or no effect on speed in ordinary cases, but can help dramatically + in bad cases. For example, looking up every key in a dict d with + d.keys() = [i << 16 for i in range(20000)] is approximately 500x faster + now. + Library From tim_one@users.sourceforge.net Sun May 27 08:39:24 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Sun, 27 May 2001 00:39:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.95,2.96 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv12990/python/dist/src/Objects Modified Files: dictobject.c Log Message: Implement an old idea of Christian Tismer's: use polynomial division instead of multiplication to generate the probe sequence. The idea is recorded in Python-Dev for Dec 2000, but that version is prone to rare infinite loops. The value is in getting *all* the bits of the hash code to participate; and, e.g., this speeds up querying every key in a dict with keys [i << 16 for i in range(20000)] by a factor of 500. Should be equally valuable in any bad case where the high-order hash bits were getting ignored. Also wrote up some of the motivations behind Python's ever-more-subtle hash table strategy. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.95 retrieving revision 2.96 diff -C2 -r2.95 -r2.96 *** dictobject.c 2001/05/24 16:56:35 2.95 --- dictobject.c 2001/05/27 07:39:22 2.96 *************** *** 32,35 **** --- 32,87 ---- via brute force program (hint: any poly that has an even number of 1 bits cannot work; ditto any poly with low bit 0; exploit those). + + Some major subtleties: Most hash schemes depend on having a "good" hash + function, in the sense of simulating randomness. Python doesn't: some of + its hash functions are trivial, such as hash(i) == i for ints i (excepting + i == -1, because -1 is the "error occurred" return value from tp_hash). + + This isn't necessarily bad! To the contrary, that our hash tables are powers + of 2 in size, and that we take the low-order bits as the initial table index, + means that there are no collisions at all for dicts indexed by a contiguous + range of ints. This is "better than random" behavior, and that's very + desirable. + + On the other hand, when collisions occur, the tendency to fill contiguous + slices of the hash table makes a good collision resolution strategy crucial; + e.g., linear probing is right out. + + Reimer Behrends contributed the idea of using a polynomial-based approach, + using repeated multiplication by x in GF(2**n) where a polynomial is chosen + such that x is a primitive root. This visits every table location exactly + once, and the sequence of locations probed is highly non-linear. + + The same is also largely true of quadratic probing for power-of-2 tables, of + the specific + + (i + comb(1, 2)) mod size + (i + comb(2, 2)) mod size + (i + comb(3, 2)) mod size + (i + comb(4, 2)) mod size + ... + (i + comb(j, 2)) mod size + + flavor. The polynomial approach "scrambles" the probe indices better, but + more importantly allows to get *some* additional bits of the hash code into + play via computing the initial increment, thus giving a weak form of double + hashing. Quadratic probing cannot be extended that way (the first probe + offset must be 1, the second 3, the third 6, etc). + + Christian Tismer later contributed the idea of using polynomial division + instead of multiplication. The problem is that the multiplicative method + can't get *all* the bits of the hash code into play without expensive + computations that slow down the initial index and/or initial increment + computation. For a set of keys like [i << 16 for i in range(20000)], under + the multiplicative method the initial index and increment were the same for + all keys, so every key followed exactly the same probe sequence, and so + this degenerated into a (very slow) linear search. The division method uses + all the bits of the hash code naturally in the increment, although it *may* + visit locations more than once until such time as all the high bits of the + increment have been shifted away. It's also impossible to tell in advance + whether incr is congruent to 0 modulo poly, so each iteration of the loop has + to guard against incr becoming 0. These are minor costs, as we usually don't + get into the probe loop, and when we do we usually get out on its first + iteration. */ *************** *** 205,209 **** { register int i; ! register unsigned incr; register dictentry *freeslot; register unsigned int mask = mp->ma_size-1; --- 257,261 ---- { register int i; ! register unsigned int incr; register dictentry *freeslot; register unsigned int mask = mp->ma_size-1; *************** *** 245,255 **** /* Derive incr from hash, just to make it more arbitrary. Note that incr must not be 0, or we will get into an infinite loop.*/ ! incr = (hash ^ ((unsigned long)hash >> 3)) & mask; ! if (!incr) ! incr = mask; /* In the loop, me_key == dummy is by far (factor of 100s) the least likely outcome, so test for that last. */ for (;;) { ! ep = &ep0[(i+incr)&mask]; if (ep->me_key == NULL) { if (restore_error) --- 297,308 ---- /* Derive incr from hash, just to make it more arbitrary. Note that incr must not be 0, or we will get into an infinite loop.*/ ! incr = hash ^ ((unsigned long)hash >> 3); ! /* In the loop, me_key == dummy is by far (factor of 100s) the least likely outcome, so test for that last. */ for (;;) { ! if (!incr) ! incr = 1; /* and incr will never be 0 again */ ! ep = &ep0[(i + incr) & mask]; if (ep->me_key == NULL) { if (restore_error) *************** *** 283,290 **** else if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; ! /* Cycle through GF(2^n)-{0} */ ! incr <<= 1; ! if (incr > mask) ! incr ^= mp->ma_poly; /* clears the highest bit */ } } --- 336,343 ---- else if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; ! /* Cycle through GF(2**n). */ ! if (incr & 1) ! incr ^= mp->ma_poly; /* clears the lowest bit */ ! incr >>= 1; } } *************** *** 304,308 **** { register int i; ! register unsigned incr; register dictentry *freeslot; register unsigned int mask = mp->ma_size-1; --- 357,361 ---- { register int i; ! register unsigned int incr; register dictentry *freeslot; register unsigned int mask = mp->ma_size-1; *************** *** 335,345 **** /* Derive incr from hash, just to make it more arbitrary. Note that incr must not be 0, or we will get into an infinite loop.*/ ! incr = (hash ^ ((unsigned long)hash >> 3)) & mask; ! if (!incr) ! incr = mask; /* In the loop, me_key == dummy is by far (factor of 100s) the least likely outcome, so test for that last. */ for (;;) { ! ep = &ep0[(i+incr)&mask]; if (ep->me_key == NULL) return freeslot == NULL ? ep : freeslot; --- 388,399 ---- /* Derive incr from hash, just to make it more arbitrary. Note that incr must not be 0, or we will get into an infinite loop.*/ ! incr = hash ^ ((unsigned long)hash >> 3); ! /* In the loop, me_key == dummy is by far (factor of 100s) the least likely outcome, so test for that last. */ for (;;) { ! if (!incr) ! incr = 1; /* and incr will never be 0 again */ ! ep = &ep0[(i + incr) & mask]; if (ep->me_key == NULL) return freeslot == NULL ? ep : freeslot; *************** *** 351,358 **** if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; ! /* Cycle through GF(2^n)-{0} */ ! incr <<= 1; ! if (incr > mask) ! incr ^= mp->ma_poly; /* clears the highest bit */ } } --- 405,412 ---- if (ep->me_key == dummy && freeslot == NULL) freeslot = ep; ! /* Cycle through GF(2**n). */ ! if (incr & 1) ! incr ^= mp->ma_poly; /* clears the lowest bit */ ! incr >>= 1; } } From twouters@users.sourceforge.net Mon May 28 14:04:35 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Mon, 28 May 2001 06:04:35 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects tupleobject.c,2.48,2.48.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv7407/Objects Modified Files: Tag: release21-maint tupleobject.c Log Message: _PyTuple_Resize: take into account the empty tuple. There can be only one. Instead of raising a SystemError, just create a new tuple of the desired size. This fixes (at least) SF bug #420343. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.48 retrieving revision 2.48.4.1 diff -C2 -r2.48 -r2.48.4.1 *** tupleobject.c 2001/01/18 00:00:53 2.48 --- tupleobject.c 2001/05/28 13:04:33 2.48.4.1 *************** *** 500,505 **** v = (PyTupleObject *) *pv; ! if (v == NULL || !PyTuple_Check(v) || v->ob_refcnt != 1 || ! last_is_sticky) { *pv = 0; Py_XDECREF(v); --- 500,505 ---- v = (PyTupleObject *) *pv; ! if (v == NULL || !PyTuple_Check(v) || last_is_sticky || ! (v->ob_size != 0 && v->ob_refcnt != 1)) { *pv = 0; Py_XDECREF(v); *************** *** 510,513 **** --- 510,522 ---- if (sizediff == 0) return 0; + + if (v->ob_size == 0) { + /* Empty tuples are often shared, so we should never + resize them in-place even if we do own the only + (current) reference */ + Py_DECREF(v); + *pv = PyTuple_New(newsize); + return 0; + } /* XXX UNREF/NEWREF interface should be more symmetrical */ From twouters@users.sourceforge.net Mon May 28 14:11:04 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Mon, 28 May 2001 06:11:04 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects tupleobject.c,2.49,2.50 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8644/Objects Modified Files: tupleobject.c Log Message: _PyTuple_Resize: take into account the empty tuple. There can be only one. Instead of raising a SystemError, just create a new tuple of the desired size. This fixes (at least) SF bug #420343. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -r2.49 -r2.50 *** tupleobject.c 2001/05/15 20:12:59 2.49 --- tupleobject.c 2001/05/28 13:11:02 2.50 *************** *** 501,506 **** v = (PyTupleObject *) *pv; ! if (v == NULL || !PyTuple_Check(v) || v->ob_refcnt != 1 || ! last_is_sticky) { *pv = 0; Py_XDECREF(v); --- 501,506 ---- v = (PyTupleObject *) *pv; ! if (v == NULL || !PyTuple_Check(v) || last_is_sticky || ! (v->ob_size != 0 && v->ob_refcnt != 1)) { *pv = 0; Py_XDECREF(v); *************** *** 511,514 **** --- 511,523 ---- if (sizediff == 0) return 0; + + if (v->ob_size == 0) { + /* Empty tuples are often shared, so we should never + resize them in-place even if we do own the only + (current) reference */ + Py_DECREF(v); + *pv = PyTuple_New(newsize); + return 0; + } /* XXX UNREF/NEWREF interface should be more symmetrical */ From tim_one@users.sourceforge.net Mon May 28 23:30:10 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 28 May 2001 15:30:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects abstract.c,2.68,2.69 tupleobject.c,2.50,2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv8967/python/dist/src/Objects Modified Files: abstract.c tupleobject.c Log Message: Cruft cleanup: Removed the unused last_is_sticky argument from the internal _PyTuple_Resize(). Index: abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.68 retrieving revision 2.69 diff -C2 -r2.68 -r2.69 *** abstract.c 2001/05/05 21:05:01 2.68 --- abstract.c 2001/05/28 22:30:08 2.69 *************** *** 1221,1225 **** else n += 100; ! if (_PyTuple_Resize(&result, n, 0) != 0) { Py_DECREF(item); goto Fail; --- 1221,1225 ---- else n += 100; ! if (_PyTuple_Resize(&result, n) != 0) { Py_DECREF(item); goto Fail; *************** *** 1231,1235 **** /* Cut tuple back if guess was too large. */ if (j < n && ! _PyTuple_Resize(&result, j, 0) != 0) goto Fail; --- 1231,1235 ---- /* Cut tuple back if guess was too large. */ if (j < n && ! _PyTuple_Resize(&result, j) != 0) goto Fail; Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -r2.50 -r2.51 *** tupleobject.c 2001/05/28 13:11:02 2.50 --- tupleobject.c 2001/05/28 22:30:08 2.51 *************** *** 489,497 **** as creating a new tuple object and destroying the old one, only more efficiently. In any case, don't use this if the tuple may already be ! known to some other part of the code. The last_is_sticky is not used ! and must always be false. */ int ! _PyTuple_Resize(PyObject **pv, int newsize, int last_is_sticky) { register PyTupleObject *v; --- 489,496 ---- as creating a new tuple object and destroying the old one, only more efficiently. In any case, don't use this if the tuple may already be ! known to some other part of the code. */ int ! _PyTuple_Resize(PyObject **pv, int newsize) { register PyTupleObject *v; *************** *** 501,505 **** v = (PyTupleObject *) *pv; ! if (v == NULL || !PyTuple_Check(v) || last_is_sticky || (v->ob_size != 0 && v->ob_refcnt != 1)) { *pv = 0; --- 500,504 ---- v = (PyTupleObject *) *pv; ! if (v == NULL || !PyTuple_Check(v) || (v->ob_size != 0 && v->ob_refcnt != 1)) { *pv = 0; From tim_one@users.sourceforge.net Mon May 28 23:30:10 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 28 May 2001 15:30:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Include tupleobject.h,2.24,2.25 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory usw-pr-cvs1:/tmp/cvs-serv8967/python/dist/src/Include Modified Files: tupleobject.h Log Message: Cruft cleanup: Removed the unused last_is_sticky argument from the internal _PyTuple_Resize(). Index: tupleobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/tupleobject.h,v retrieving revision 2.24 retrieving revision 2.25 diff -C2 -r2.24 -r2.25 *** tupleobject.h 2000/09/01 23:29:26 2.24 --- tupleobject.h 2001/05/28 22:30:07 2.25 *************** *** 34,38 **** extern DL_IMPORT(int) PyTuple_SetItem(PyObject *, int, PyObject *); extern DL_IMPORT(PyObject *) PyTuple_GetSlice(PyObject *, int, int); ! extern DL_IMPORT(int) _PyTuple_Resize(PyObject **, int, int); /* Macro, trading safety for speed */ --- 34,38 ---- extern DL_IMPORT(int) PyTuple_SetItem(PyObject *, int, PyObject *); extern DL_IMPORT(PyObject *) PyTuple_GetSlice(PyObject *, int, int); ! extern DL_IMPORT(int) _PyTuple_Resize(PyObject **, int); /* Macro, trading safety for speed */ From tim_one@users.sourceforge.net Mon May 28 23:30:10 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 28 May 2001 15:30:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Modules _tkinter.c,1.115,1.116 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory usw-pr-cvs1:/tmp/cvs-serv8967/python/dist/src/Modules Modified Files: _tkinter.c Log Message: Cruft cleanup: Removed the unused last_is_sticky argument from the internal _PyTuple_Resize(). Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -r1.115 -r1.116 *** _tkinter.c 2000/10/29 00:44:43 1.115 --- _tkinter.c 2001/05/28 22:30:08 1.116 *************** *** 1852,1856 **** context->maxsize = maxsize; ! return _PyTuple_Resize(&context->tuple, maxsize, 0) >= 0; } --- 1852,1856 ---- context->maxsize = maxsize; ! return _PyTuple_Resize(&context->tuple, maxsize) >= 0; } *************** *** 1936,1940 **** return NULL; ! if (_PyTuple_Resize(&context.tuple, context.size, 0)) return NULL; --- 1936,1940 ---- return NULL; ! if (_PyTuple_Resize(&context.tuple, context.size)) return NULL; From tim_one@users.sourceforge.net Mon May 28 23:30:10 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 28 May 2001 15:30:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.208,2.209 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv8967/python/dist/src/Python Modified Files: bltinmodule.c Log Message: Cruft cleanup: Removed the unused last_is_sticky argument from the internal _PyTuple_Resize(). Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.208 retrieving revision 2.209 diff -C2 -r2.208 -r2.209 *** bltinmodule.c 2001/05/21 08:07:05 2.208 --- bltinmodule.c 2001/05/28 22:30:08 2.209 *************** *** 2330,2334 **** } ! if (_PyTuple_Resize(&result, j, 0) < 0) return NULL; --- 2330,2334 ---- } ! if (_PyTuple_Resize(&result, j) < 0) return NULL; From tim_one@users.sourceforge.net Mon May 28 23:30:10 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 28 May 2001 15:30:10 -0700 Subject: [Python-checkins] CVS: python/dist/src/Misc NEWS,1.177,1.178 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory usw-pr-cvs1:/tmp/cvs-serv8967/python/dist/src/Misc Modified Files: NEWS Log Message: Cruft cleanup: Removed the unused last_is_sticky argument from the internal _PyTuple_Resize(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.177 retrieving revision 1.178 diff -C2 -r1.177 -r1.178 *** NEWS 2001/05/27 07:39:22 1.177 --- NEWS 2001/05/28 22:30:07 1.178 *************** *** 156,159 **** --- 156,165 ---- compiler (under Windows), thanks to Stephen Hansen. + C API + + - Removed the unused last_is_sticky argument from the internal + _PyTuple_Resize(). If this affects you, you were cheating. + + What's New in Python 2.1 (final)? ================================= From tim.one@home.com Tue May 29 00:51:07 2001 From: tim.one@home.com (Tim Peters) Date: Mon, 28 May 2001 19:51:07 -0400 Subject: [Python-checkins] CVS: python/dist/src/Objects tupleobject.c,2.49,2.50 In-Reply-To: Message-ID: [Thomas Wouters] > Modified Files: > tupleobject.c > Log Message: > > _PyTuple_Resize: take into account the empty tuple. There can be only one. > Instead of raising a SystemError, just create a new tuple of the desired > size. > > This fixes (at least) SF bug #420343. > > Index: tupleobject.c > =================================================================== > ... > + if (v->ob_size == 0) { > + /* Empty tuples are often shared, so we should never > + resize them in-place even if we do own the only > + (current) reference */ > + Py_DECREF(v); > + *pv = PyTuple_New(newsize); > + return 0; > + } Almost, but not quite right: PyTuple_New() can fail, so the return should be return *pv ? 0 : -1; instead. Else the caller will believe a failing call succeeded, and go on to wreak havoc with the NULL pointer stored into *pv. From tim_one@users.sourceforge.net Tue May 29 05:27:03 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 28 May 2001 21:27:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib linecache.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv25825/python/dist/src/Lib Modified Files: linecache.py Log Message: Patch from Gordon McMillan. updatecache(): When using imputil, sys.path may contain things other than strings. Ignore such things instead of blowing up. Hard to say whether this is a bugfix or a feature ... Index: linecache.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/linecache.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** linecache.py 2001/01/24 06:27:27 1.7 --- linecache.py 2001/05/29 04:27:01 1.8 *************** *** 70,82 **** stat = os.stat(fullname) except os.error, msg: ! # Try looking through the module search path basename = os.path.split(filename)[1] for dirname in sys.path: ! fullname = os.path.join(dirname, basename) try: ! stat = os.stat(fullname) ! break ! except os.error: pass else: # No luck --- 70,89 ---- stat = os.stat(fullname) except os.error, msg: ! # Try looking through the module search path. basename = os.path.split(filename)[1] for dirname in sys.path: ! # When using imputil, sys.path may contain things other than ! # strings; ignore them when it happens. try: ! fullname = os.path.join(dirname, basename) ! except (TypeError, AttributeError): ! # Not sufficiently string-like to do anything useful with. pass + else: + try: + stat = os.stat(fullname) + break + except os.error: + pass else: # No luck From tim_one@users.sourceforge.net Tue May 29 07:06:56 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 28 May 2001 23:06:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_urllib2.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv5025/python/dist/src/Lib/test Modified Files: test_urllib2.py Log Message: Whitespace normalization. Index: test_urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib2.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_urllib2.py 2001/05/09 15:50:18 1.1 --- test_urllib2.py 2001/05/29 06:06:54 1.2 *************** *** 15,17 **** buf = f.read() f.close() - --- 15,16 ---- From tim_one@users.sourceforge.net Tue May 29 07:06:56 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Mon, 28 May 2001 23:06:56 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib codecs.py,1.18,1.19 pty.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv5025/python/dist/src/Lib Modified Files: codecs.py pty.py Log Message: Whitespace normalization. Index: codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codecs.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** codecs.py 2001/05/16 09:41:45 1.18 --- codecs.py 2001/05/29 06:06:54 1.19 *************** *** 575,579 **** m[v] = None return m ! ### Tests --- 575,579 ---- m[v] = None return m ! ### Tests Index: pty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pty.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** pty.py 2001/05/13 09:01:06 1.10 --- pty.py 2001/05/29 06:06:54 1.11 *************** *** 17,21 **** # leaves a damaged module object for tty in sys.modules, and the import # of tty here then appears to work despite that the tty imported is junk. ! import termios del termios --- 17,21 ---- # leaves a damaged module object for tty in sys.modules, and the import # of tty here then appears to work despite that the tty imported is junk. ! import termios del termios From twouters@users.sourceforge.net Tue May 29 08:58:47 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Tue, 29 May 2001 00:58:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects tupleobject.c,2.51,2.52 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv25043/Objects Modified Files: tupleobject.c Log Message: _PyTuple_Resize: guard against PyTuple_New() returning NULL, using Tim's suggestion (modulo style). Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -r2.51 -r2.52 *** tupleobject.c 2001/05/28 22:30:08 2.51 --- tupleobject.c 2001/05/29 07:58:45 2.52 *************** *** 517,521 **** Py_DECREF(v); *pv = PyTuple_New(newsize); ! return 0; } --- 517,521 ---- Py_DECREF(v); *pv = PyTuple_New(newsize); ! return *pv == NULL ? -1 : 0; } From twouters@users.sourceforge.net Tue May 29 09:05:03 2001 From: twouters@users.sourceforge.net (Thomas Wouters) Date: Tue, 29 May 2001 01:05:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects tupleobject.c,2.48.4.1,2.48.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv26240/Objects Modified Files: Tag: release21-maint tupleobject.c Log Message: _PyTuple_Resize: guard against PyTuple_New() returning NULL, using Tim's suggestion (modulo style). Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.48.4.1 retrieving revision 2.48.4.2 diff -C2 -r2.48.4.1 -r2.48.4.2 *** tupleobject.c 2001/05/28 13:04:33 2.48.4.1 --- tupleobject.c 2001/05/29 08:05:01 2.48.4.2 *************** *** 517,521 **** Py_DECREF(v); *pv = PyTuple_New(newsize); ! return 0; } --- 517,521 ---- Py_DECREF(v); *pv = PyTuple_New(newsize); ! return *pv == NULL ? -1 : 0; } From fdrake@users.sourceforge.net Tue May 29 16:13:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 08:13:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.123,1.124 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv11732/api Modified Files: api.tex Log Message: Do not start API descriptions with "Does the same, but ..." -- actually state *which* other function the current one is like, even if the descriptions are adjacent. Revise the _PyTuple_Resize() description to reflect the removal of the third parameter. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -r1.123 -r1.124 *** api.tex 2001/05/21 15:56:55 1.123 --- api.tex 2001/05/29 15:13:00 1.124 *************** *** 3219,3223 **** \begin{cfuncdesc}{PyObject*}{PyTuple_GET_ITEM}{PyObject *p, int pos} ! Does the same, but does no checking of its arguments. \end{cfuncdesc} --- 3219,3224 ---- \begin{cfuncdesc}{PyObject*}{PyTuple_GET_ITEM}{PyObject *p, int pos} ! Like \cfunction{PyTuple_GetItem()}, but does no checking of its ! arguments. \end{cfuncdesc} *************** *** 3237,3257 **** \begin{cfuncdesc}{void}{PyTuple_SET_ITEM}{PyObject *p, int pos, PyObject *o} ! Does the same, but does no error checking, and should \emph{only} be used to fill in brand new tuples. \strong{Note:} This function ``steals'' a reference to \var{o}. \end{cfuncdesc} ! \begin{cfuncdesc}{int}{_PyTuple_Resize}{PyObject **p, ! int newsize, int last_is_sticky} Can be used to resize a tuple. \var{newsize} will be the new length of the tuple. Because tuples are \emph{supposed} to be immutable, this should only be used if there is only one reference to the object. Do \emph{not} use this if the tuple may already be known to some other ! part of the code. The tuple will always grow or shrink at the end. The ! \var{last_is_sticky} flag is not used and should always be false. Think ! of this as destroying the old tuple and creating a new one, only more ! efficiently. Returns \code{0} on success and \code{-1} on failure (in ! which case a \exception{MemoryError} or \exception{SystemError} will be ! raised). \end{cfuncdesc} --- 3238,3260 ---- \begin{cfuncdesc}{void}{PyTuple_SET_ITEM}{PyObject *p, int pos, PyObject *o} ! Like \cfunction{PyTuple_SetItem()}, but does no error checking, and should \emph{only} be used to fill in brand new tuples. \strong{Note:} This function ``steals'' a reference to \var{o}. \end{cfuncdesc} ! \begin{cfuncdesc}{int}{_PyTuple_Resize}{PyObject **p, int newsize} Can be used to resize a tuple. \var{newsize} will be the new length of the tuple. Because tuples are \emph{supposed} to be immutable, this should only be used if there is only one reference to the object. Do \emph{not} use this if the tuple may already be known to some other ! part of the code. The tuple will always grow or shrink at the end. ! Think of this as destroying the old tuple and creating a new one, only ! more efficiently. Returns \code{0} on success. Client code should ! never assume that the resulting value of \code{*\var{p}} will be the ! same as before calling this function. If the object referenced by ! \code{*\var{p}} is replaced, the original \code{*\var{p}} is ! destroyed. On failure, returns \code{-1} and sets \code{*\var{p}} to ! \NULL, and raises \exception{MemoryError} or \exception{SystemError}. ! \versionchanged[Removed unused third parameter, \var{last_is_sticky}]{2.2} \end{cfuncdesc} From fdrake@users.sourceforge.net Tue May 29 16:25:53 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 08:25:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools refcounts.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv14781/tools Modified Files: refcounts.py Log Message: If the input line does not contain enough fields, raise a meaningful error. Index: refcounts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/refcounts.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** refcounts.py 2000/04/10 18:24:26 1.2 --- refcounts.py 2001/05/29 15:25:51 1.3 *************** *** 33,36 **** --- 33,38 ---- continue parts = string.split(line, ":", 4) + if len(parts) != 5: + raise ValueError("Not enough fields in " + `line`) function, type, arg, refcount, comment = parts if refcount == "null": From fdrake@users.sourceforge.net Tue May 29 16:34:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 08:34:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api refcounts.dat,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv16570/api Modified Files: refcounts.dat Log Message: Removed information on the old third parameter to _PyTuple_Resize(). Added information on PyIter_Check(), PyIter_Next(), PyObject_Unicode(), PyString_AsDecodedObject(), PyString_AsEncodedObject(), and PyThreadState_GetDict(). Index: refcounts.dat =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/refcounts.dat,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** refcounts.dat 2001/01/28 06:39:35 1.23 --- refcounts.dat 2001/05/29 15:34:06 1.24 *************** *** 364,367 **** --- 364,372 ---- PyInterpreterState_New:PyInterpreterState*::: + PyIter_Check:int:o:0: + + PyIter_Next:PyObject*::+1: + PyIter_Next:PyObject*:o:0: + PyList_Append:int::: PyList_Append:PyObject*:list:0: *************** *** 729,732 **** --- 734,740 ---- PyObject_Type:PyObject*:o:0: + PyObject_Unicode:PyObject*::+1: + PyObject_Unicode:PyObject*:o:0: + PyParser_SimpleParseFile:struct _node*::: PyParser_SimpleParseFile:FILE*:fp:: *************** *** 847,850 **** --- 855,868 ---- PyString_AS_STRING:PyObject*:string:0: + PyString_AsDecodedObject:PyObject*::+1: + PyString_AsDecodedObject:PyObject*:str:0: + PyString_AsDecodedObject:const char*:encoding:: + PyString_AsDecodedObject:const char*:errors:: + + PyString_AsEncodedObject:PyObject*::+1: + PyString_AsEncodedObject:PyObject*:str:0: + PyString_AsEncodedObject:const char*:encoding:: + PyString_AsEncodedObject:const char*:errors:: + PyString_AsString:char*::: PyString_AsString:PyObject*:string:0: *************** *** 918,921 **** --- 936,941 ---- PyThreadState_Get:PyThreadState*::: + PyThreadState_GetDict:PyObject*::0: + PyThreadState_New:PyThreadState*::: PyThreadState_New:PyInterpreterState*:interp:: *************** *** 1330,1334 **** _PyTuple_Resize:PyTupleObject**:p:+1: _PyTuple_Resize:int:new:: - _PyTuple_Resize:int:last_is_sticky:: _Py_c_diff:Py_complex::: --- 1350,1353 ---- From fdrake@users.sourceforge.net Tue May 29 16:37:47 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 08:37:47 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libasyncore.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv17500/lib Modified Files: libasyncore.tex Log Message: The parameter to the listen() method is not optional, but was marked as optional in the documentation. This closes SF bug #427985. Index: libasyncore.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasyncore.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** libasyncore.tex 2001/04/09 15:57:06 1.7 --- libasyncore.tex 2001/05/29 15:37:45 1.8 *************** *** 137,141 **** \end{methoddesc} ! \begin{methoddesc}{listen}{\optional{backlog}} Listen for connections made to the socket. The \var{backlog} argument specifies the maximum number of queued connections --- 137,141 ---- \end{methoddesc} ! \begin{methoddesc}{listen}{backlog} Listen for connections made to the socket. The \var{backlog} argument specifies the maximum number of queued connections From fdrake@users.sourceforge.net Tue May 29 16:39:26 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 08:39:26 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libasyncore.tex,1.7,1.7.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv17980/lib Modified Files: Tag: release21-maint libasyncore.tex Log Message: The parameter to the listen() method is not optional, but was marked as optional in the documentation. This closes SF bug #427985. Index: libasyncore.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasyncore.tex,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -r1.7 -r1.7.2.1 *** libasyncore.tex 2001/04/09 15:57:06 1.7 --- libasyncore.tex 2001/05/29 15:39:24 1.7.2.1 *************** *** 137,141 **** \end{methoddesc} ! \begin{methoddesc}{listen}{\optional{backlog}} Listen for connections made to the socket. The \var{backlog} argument specifies the maximum number of queued connections --- 137,141 ---- \end{methoddesc} ! \begin{methoddesc}{listen}{backlog} Listen for connections made to the socket. The \var{backlog} argument specifies the maximum number of queued connections From fdrake@users.sourceforge.net Tue May 29 16:44:29 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 08:44:29 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref4.tex,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv19337/ref Modified Files: ref4.tex Log Message: Fix typo reported in SF bug #427783. Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** ref4.tex 2001/03/23 14:05:16 1.26 --- ref4.tex 2001/05/29 15:44:27 1.27 *************** *** 81,85 **** \module{__builtin__}\refbimodindex{__builtin__}). The built-in namespace associated with the execution of a code block is actually ! found by looking up the name \code{__builtins__} is its global namespace; this should be a dictionary or a module (in the latter case its dictionary is used). Normally, the \code{__builtins__} namespace --- 81,85 ---- \module{__builtin__}\refbimodindex{__builtin__}). The built-in namespace associated with the execution of a code block is actually ! found by looking up the name \code{__builtins__} in its global namespace; this should be a dictionary or a module (in the latter case its dictionary is used). Normally, the \code{__builtins__} namespace From fdrake@users.sourceforge.net Tue May 29 16:45:03 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 08:45:03 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref4.tex,1.26,1.26.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv19495/ref Modified Files: Tag: release21-maint ref4.tex Log Message: Fix typo reported in SF bug #427783. Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.26 retrieving revision 1.26.2.1 diff -C2 -r1.26 -r1.26.2.1 *** ref4.tex 2001/03/23 14:05:16 1.26 --- ref4.tex 2001/05/29 15:45:01 1.26.2.1 *************** *** 81,85 **** \module{__builtin__}\refbimodindex{__builtin__}). The built-in namespace associated with the execution of a code block is actually ! found by looking up the name \code{__builtins__} is its global namespace; this should be a dictionary or a module (in the latter case its dictionary is used). Normally, the \code{__builtins__} namespace --- 81,85 ---- \module{__builtin__}\refbimodindex{__builtin__}). The built-in namespace associated with the execution of a code block is actually ! found by looking up the name \code{__builtins__} in its global namespace; this should be a dictionary or a module (in the latter case its dictionary is used). Normally, the \code{__builtins__} namespace From fdrake@users.sourceforge.net Tue May 29 17:02:38 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 09:02:38 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.66,1.67 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv23660/ref Modified Files: ref3.tex Log Message: Bring the notes on the relationship between __cmp__(), __eq__(), and __hash__() up to date (re: use of objects which define these methods as dictionary keys). This closes SF bug #427698. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -r1.66 -r1.67 *** ref3.tex 2001/05/14 16:04:22 1.66 --- ref3.tex 2001/05/29 16:02:35 1.67 *************** *** 1011,1018 **** \begin{methoddesc}[object]{__cmp__}{self, other} Called by comparison operations if rich comparison (see above) is not ! defined. Should return a negative integer if ! \code{self < other}, zero if \code{self == other}, a positive integer if ! \code{self > other}. If no \method{__cmp__()} operation is defined, class ! instances are compared by object identity (``address''). (Note: the restriction that exceptions are not propagated by \method{__cmp__()} has been removed in Python 1.5.) --- 1011,1022 ---- \begin{methoddesc}[object]{__cmp__}{self, other} Called by comparison operations if rich comparison (see above) is not ! defined. Should return a negative integer if \code{self < other}, ! zero if \code{self == other}, a positive integer if \code{self > ! other}. If no \method{__cmp__()}, \method{__eq__()} or ! \method{__ne__()} operation is defined, class instances are compared ! by object identity (``address''). See also the description of ! \method{__hash__()} for some important notes on creating objects which ! support custom comparison operations and are usable as dictionary ! keys. (Note: the restriction that exceptions are not propagated by \method{__cmp__()} has been removed in Python 1.5.) *************** *** 1036,1045 **** objects. If a class does not define a \method{__cmp__()} method it should not define a \method{__hash__()} operation either; if it defines ! \method{__cmp__()} but not \method{__hash__()} its instances will not be ! usable as dictionary keys. If a class defines mutable objects and ! implements a \method{__cmp__()} method it should not implement ! \method{__hash__()}, since the dictionary implementation requires that ! a key's hash value is immutable (if the object's hash value changes, it ! will be in the wrong hash bucket). \withsubitem{(object method)}{\ttindex{__cmp__()}} \end{methoddesc} --- 1040,1050 ---- objects. If a class does not define a \method{__cmp__()} method it should not define a \method{__hash__()} operation either; if it defines ! \method{__cmp__()} or \method{__eq__()} but not \method{__hash__()}, ! its instances will not be usable as dictionary keys. If a class ! defines mutable objects and implements a \method{__cmp__()} or ! \method{__eq__()} method, it should not implement \method{__hash__()}, ! since the dictionary implementation requires that a key's hash value ! is immutable (if the object's hash value changes, it will be in the ! wrong hash bucket). \withsubitem{(object method)}{\ttindex{__cmp__()}} \end{methoddesc} From fdrake@users.sourceforge.net Tue May 29 17:06:23 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 09:06:23 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex,1.64.2.1,1.64.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory usw-pr-cvs1:/tmp/cvs-serv24667/ref Modified Files: Tag: release21-maint ref3.tex Log Message: Bring the notes on the relationship between __cmp__(), __eq__(), and __hash__() up to date (re: use of objects which define these methods as dictionary keys). This closes SF bug #427698. Migrated comments about supporting __contains__() and the use of the "in" operator from the development branch. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.64.2.1 retrieving revision 1.64.2.2 diff -C2 -r1.64.2.1 -r1.64.2.2 *** ref3.tex 2001/05/14 16:04:57 1.64.2.1 --- ref3.tex 2001/05/29 16:06:21 1.64.2.2 *************** *** 1011,1018 **** \begin{methoddesc}[object]{__cmp__}{self, other} Called by comparison operations if rich comparison (see above) is not ! defined. Should return a negative integer if ! \code{self < other}, zero if \code{self == other}, a positive integer if ! \code{self > other}. If no \method{__cmp__()} operation is defined, class ! instances are compared by object identity (``address''). (Note: the restriction that exceptions are not propagated by \method{__cmp__()} has been removed in Python 1.5.) --- 1011,1022 ---- \begin{methoddesc}[object]{__cmp__}{self, other} Called by comparison operations if rich comparison (see above) is not ! defined. Should return a negative integer if \code{self < other}, ! zero if \code{self == other}, a positive integer if \code{self > ! other}. If no \method{__cmp__()}, \method{__eq__()} or ! \method{__ne__()} operation is defined, class instances are compared ! by object identity (``address''). See also the description of ! \method{__hash__()} for some important notes on creating objects which ! support custom comparison operations and are usable as dictionary ! keys. (Note: the restriction that exceptions are not propagated by \method{__cmp__()} has been removed in Python 1.5.) *************** *** 1036,1045 **** objects. If a class does not define a \method{__cmp__()} method it should not define a \method{__hash__()} operation either; if it defines ! \method{__cmp__()} but not \method{__hash__()} its instances will not be ! usable as dictionary keys. If a class defines mutable objects and ! implements a \method{__cmp__()} method it should not implement ! \method{__hash__()}, since the dictionary implementation requires that ! a key's hash value is immutable (if the object's hash value changes, it ! will be in the wrong hash bucket). \withsubitem{(object method)}{\ttindex{__cmp__()}} \end{methoddesc} --- 1040,1050 ---- objects. If a class does not define a \method{__cmp__()} method it should not define a \method{__hash__()} operation either; if it defines ! \method{__cmp__()} or \method{__eq__()} but not \method{__hash__()}, ! its instances will not be usable as dictionary keys. If a class ! defines mutable objects and implements a \method{__cmp__()} or ! \method{__eq__()} method, it should not implement \method{__hash__()}, ! since the dictionary implementation requires that a key's hash value ! is immutable (if the object's hash value changes, it will be in the ! wrong hash bucket). \withsubitem{(object method)}{\ttindex{__cmp__()}} \end{methoddesc} *************** *** 1136,1140 **** \method{__mul__()}, \method{__rmul__()} and \method{__imul__()} described below; they should not define \method{__coerce__()} or other numerical ! operators. \withsubitem{(mapping object method)}{ \ttindex{keys()} --- 1141,1148 ---- \method{__mul__()}, \method{__rmul__()} and \method{__imul__()} described below; they should not define \method{__coerce__()} or other numerical ! operators. It is recommended that both mappings and sequences ! implement the \method{__contains__}, to allow efficient use of the ! \code{in} operator; for mappings, \code{in} should be equivalent of ! \method{has_key()}; for sequences, it should search through the values. \withsubitem{(mapping object method)}{ \ttindex{keys()} *************** *** 1145,1149 **** \ttindex{clear()} \ttindex{copy()} ! \ttindex{update()}} \withsubitem{(sequence object method)}{ \ttindex{append()} --- 1153,1158 ---- \ttindex{clear()} \ttindex{copy()} ! \ttindex{update()} ! \ttindex{__contains__()}} \withsubitem{(sequence object method)}{ \ttindex{append()} *************** *** 1160,1164 **** \ttindex{__mul__()} \ttindex{__rmul__()} ! \ttindex{__imul__()}} \withsubitem{(numeric object method)}{\ttindex{__coerce__()}} --- 1169,1174 ---- \ttindex{__mul__()} \ttindex{__rmul__()} ! \ttindex{__imul__()} ! \ttindex{__contains__()}} \withsubitem{(numeric object method)}{\ttindex{__coerce__()}} From fdrake@users.sourceforge.net Tue May 29 17:10:09 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 09:10:09 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools mkhowto,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv26052/tools Modified Files: mkhowto Log Message: Hack to make this play nicer with *old* versions of Python: os.path.abspath() was not available in Python 1.5.1. (Yes, a user actually tried to use this with that version of Python!) Index: mkhowto =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkhowto,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** mkhowto 2001/05/09 04:03:16 1.25 --- mkhowto 2001/05/29 16:10:07 1.26 *************** *** 47,50 **** --- 47,60 ---- + if not hasattr(os.path, "abspath"): + def abspath(path): + """Return an absolute path.""" + if not os.path.isabs(path): + path = os.path.join(os.getcwd(), path) + return os.path.normpath(path) + + os.path.abspath = abspath + + MYDIR = os.path.abspath(sys.path[0]) TOPDIR = os.path.dirname(MYDIR) From jhylton@users.sourceforge.net Tue May 29 17:23:28 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Tue, 29 May 2001 09:23:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python ceval.c,2.244,2.245 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv29220 Modified Files: ceval.c Log Message: Fix bug reported by Tim Peters on python-dev: Keyword arguments passed to builtin functions that don't take them are ignored. >>> {}.clear(x=2) >>> instead of >>> {}.clear(x=2) Traceback (most recent call last): File "", line 1, in ? TypeError: clear() takes no keyword arguments Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.244 retrieving revision 2.245 diff -C2 -r2.244 -r2.245 *** ceval.c 2001/05/18 20:53:14 2.244 --- ceval.c 2001/05/29 16:23:26 2.245 *************** *** 1971,1986 **** if (PyCFunction_Check(func)) { int flags = PyCFunction_GET_FLAGS(func); ! if (flags == METH_VARARGS) { PyObject *callargs; callargs = load_args(&stack_pointer, na); x = call_cfunction(func, callargs, NULL); Py_XDECREF(callargs); ! } else if (flags == 0) { x = fast_cfunction(func, &stack_pointer, na); - } else { - x = do_call(func, &stack_pointer, - na, nk); - } } else { if (PyMethod_Check(func) --- 1971,1985 ---- if (PyCFunction_Check(func)) { int flags = PyCFunction_GET_FLAGS(func); ! if (flags > 1 || nk != 0) ! x = do_call(func, &stack_pointer, ! na, nk); ! else if (flags == METH_VARARGS) { PyObject *callargs; callargs = load_args(&stack_pointer, na); x = call_cfunction(func, callargs, NULL); Py_XDECREF(callargs); ! } else if (flags == 0) x = fast_cfunction(func, &stack_pointer, na); } else { if (PyMethod_Check(func) From jhylton@users.sourceforge.net Tue May 29 17:26:18 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Tue, 29 May 2001 09:26:18 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_call.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv29930 Added Files: test_call.py Log Message: Variety of test cases for call to builtin functions --- NEW FILE: test_call.py --- import unittest from test_support import run_unittest # The test cases here cover several paths through the function calling # code. They depend on the METH_XXX flag that is used to define a C # function, which can't be verified from Python. If the METH_XXX decl # for a C function changes, these tests may not cover the right paths. class CFunctionCalls(unittest.TestCase): def test_varargs0(self): self.assertRaises(TypeError, {}.has_key) def test_varargs1(self): {}.has_key(0) def test_varargs2(self): self.assertRaises(TypeError, {}.has_key, 0, 1) def test_varargs0_ext(self): try: {}.has_key(*()) except TypeError: pass def test_varargs1_ext(self): {}.has_key(*(0,)) def test_varargs2_ext(self): try: {}.has_key(*(1, 2)) except TypeError: pass else: raise RuntimeError def test_varargs0_kw(self): self.assertRaises(TypeError, {}.has_key, x=2) def test_varargs1_kw(self): self.assertRaises(TypeError, {}.has_key, x=2) def test_varargs2_kw(self): self.assertRaises(TypeError, {}.has_key, x=2, y=2) def test_oldargs0_0(self): {}.keys() def test_oldargs0_1(self): self.assertRaises(TypeError, {}.keys, 0) def test_oldargs0_2(self): self.assertRaises(TypeError, {}.keys, 0, 1) def test_oldargs0_0_ext(self): {}.keys(*()) def test_oldargs0_1_ext(self): try: {}.keys(*(0,)) except TypeError: pass else: raise RuntimeError def test_oldargs0_2_ext(self): try: {}.keys(*(1, 2)) except TypeError: pass else: raise RuntimeError def test_oldargs0_0_kw(self): try: {}.keys(x=2) except TypeError: pass else: raise RuntimeError def test_oldargs0_1_kw(self): self.assertRaises(TypeError, {}.keys, x=2) def test_oldargs0_2_kw(self): self.assertRaises(TypeError, {}.keys, x=2, y=2) def test_oldargs1_0(self): self.assertRaises(TypeError, {}.update) def test_oldargs1_1(self): {}.update({}) def test_oldargs1_2(self): self.assertRaises(TypeError, {}.update, {}, 1) def test_oldargs1_0_ext(self): try: {}.update(*()) except TypeError: pass else: raise RuntimeError def test_oldargs1_1_ext(self): {}.update(*({},)) def test_oldargs1_2_ext(self): try: {}.update(*({}, 2)) except TypeError: pass else: raise RuntimeError def test_oldargs1_0_kw(self): self.assertRaises(TypeError, {}.update, x=2) def test_oldargs1_1_kw(self): self.assertRaises(TypeError, {}.update, {}, x=2) def test_oldargs1_2_kw(self): self.assertRaises(TypeError, {}.update, x=2, y=2) run_unittest(CFunctionCalls) From jhylton@users.sourceforge.net Tue May 29 17:26:22 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Tue, 29 May 2001 09:26:22 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_call,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv29958 Added Files: test_call Log Message: Variety of test cases for call to builtin functions --- NEW FILE: test_call --- test_call From fdrake@users.sourceforge.net Tue May 29 17:54:24 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 09:54:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test/output test_call,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory usw-pr-cvs1:/tmp/cvs-serv3244/output Removed Files: test_call Log Message: The one-line output files are no longer needed, so do not keep them. --- test_call DELETED --- From fdrake@users.sourceforge.net Tue May 29 18:10:53 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 10:10:53 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test regrtest.py,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv6317 Modified Files: regrtest.py Log Message: runtest(): When generating output, if the result is a single line with the name of the test, only write the output file if it already exists (and tell the user to consider removing it). This avoids the generation of unnecessary turds. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -r1.35 -r1.36 *** regrtest.py 2001/05/22 18:28:25 1.35 --- regrtest.py 2001/05/29 17:10:51 1.36 *************** *** 231,235 **** try: if generate: ! cfp = open(outputfile, "w") elif verbose: cfp = sys.stdout --- 231,235 ---- try: if generate: ! cfp = StringIO.StringIO() elif verbose: cfp = sys.stdout *************** *** 274,277 **** --- 274,295 ---- return 0 else: + if generate: + output = cfp.getvalue() + if output == test + "\n": + if os.path.exists(outputfile): + # Write it since it already exists (and the contents + # may have changed), but let the user know it isn't + # needed: + fp = open(outputfile, "w") + fp.write(output) + fp.close() + print "output file", outputfile, \ + "is no longer needed; consider removing it" + # else: + # We don't need it, so don't create it. + else: + fp = open(outputfile, "w") + fp.write(output) + fp.close() return 1 From jhylton@users.sourceforge.net Tue May 29 18:13:17 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Tue, 29 May 2001 10:13:17 -0700 Subject: [Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.91,2.92 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory usw-pr-cvs1:/tmp/cvs-serv6860 Modified Files: unicodeobject.c Log Message: fix bogus indentation Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.91 retrieving revision 2.92 diff -C2 -r2.91 -r2.92 *** unicodeobject.c 2001/05/21 20:30:15 2.91 --- unicodeobject.c 2001/05/29 17:13:15 2.92 *************** *** 530,534 **** if (errors == NULL) { if (strcmp(encoding, "utf-8") == 0) ! return PyUnicode_AsUTF8String(unicode); else if (strcmp(encoding, "latin-1") == 0) return PyUnicode_AsLatin1String(unicode); --- 530,534 ---- if (errors == NULL) { if (strcmp(encoding, "utf-8") == 0) ! return PyUnicode_AsUTF8String(unicode); else if (strcmp(encoding, "latin-1") == 0) return PyUnicode_AsLatin1String(unicode); From jhylton@users.sourceforge.net Tue May 29 18:37:07 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Tue, 29 May 2001 10:37:07 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python getargs.c,2.58,2.59 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv11389 Modified Files: getargs.c Log Message: Internal refactoring of convertsimple() and friends. Note that lots of code was re-indented. Replace two-step of convertsimple() and convertsimple1() with convertsimple() and helper converterr(), which is called to format error messages when convertsimple() fails. The old code did all the real work in convertsimple1(), but deferred error message formatting to conversimple(). The result was paying the price of a second function call on every call just to format error messages in the failure cases. Factor out of the buffer-handling code in convertsimple() and package it as convertbuffer(). Add two macros to ease readability of Unicode coversions, UNICODE_DEFAULT_ENCODING() and CONV_UNICODE, an error string. The convertsimple() routine had awful indentation problems, primarily because there were two tabs between the case line and the body of the case statements. This patch reformats the entire function to have a single tab between case line and case body, which makes the code easier to read (and consistent with ceval). The introduction of converterr() exacerbated the problem and prompted this fix. Also, eliminate non-standard whitespace after opening paren and before closing paren in a few if statements. (This checkin is part of SF patch 426072.) Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -r2.58 -r2.59 *** getargs.c 2001/05/18 21:03:40 2.58 --- getargs.c 2001/05/29 17:37:05 2.59 *************** *** 26,30 **** int *, char *, int); static char *convertsimple(PyObject *, char **, va_list *, char *); ! static char *convertsimple1(PyObject *, char **, va_list *); static int vgetargskeywords(PyObject *, PyObject *, --- 26,30 ---- int *, char *, int); static char *convertsimple(PyObject *, char **, va_list *, char *); ! static int convertbuffer(PyObject *, void **p, char **); [...1202 lines suppressed...] + { + PyBufferProcs *pb = arg->ob_type->tp_as_buffer; + int count; + if (pb == NULL || + pb->bf_getreadbuffer == NULL || + pb->bf_getsegcount == NULL) { + *errmsg = "string or read-only buffer"; + return -1; + } + if ((*pb->bf_getsegcount)(arg, NULL) != 1) { + *errmsg = "string or single-segment read-only buffer"; + return -1; + } + if ((count = (*pb->bf_getreadbuffer)(arg, 0, p)) < 0) { + *errmsg = "(unspecified)"; + } + return count; + } /* Support for keyword arguments donated by From jhylton@users.sourceforge.net Tue May 29 18:46:21 2001 From: jhylton@users.sourceforge.net (Jeremy Hylton) Date: Tue, 29 May 2001 10:46:21 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python getargs.c,2.59,2.60 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv13431 Modified Files: getargs.c Log Message: Change cascaded if stmts to switch stmt in vgetargs1(). In the default branch, keep three ifs that are used if level == 0, the most common case. Note that first if here is a slight optimization for the 'O' format. Second part of SF patch 426072. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.59 retrieving revision 2.60 diff -C2 -r2.59 -r2.60 *** getargs.c 2001/05/29 17:37:05 2.59 --- getargs.c 2001/05/29 17:46:19 2.60 *************** *** 81,84 **** --- 81,85 ---- int max = 0; int level = 0; + int endfmt = 0; char *formatsave = format; int i, len; *************** *** 87,122 **** assert(compat || (args != (PyObject*)NULL)); ! for (;;) { int c = *format++; ! if (c == '(' /* ')' */) { if (level == 0) max++; level++; ! } ! else if (/* '(' */ c == ')') { if (level == 0) ! Py_FatalError(/* '(' */ ! "excess ')' in getargs format"); else level--; - } - else if (c == '\0') break; ! else if (c == ':') { fname = format; break; ! } ! else if (c == ';') { message = format; break; } - else if (level != 0) - ; /* Pass */ - else if (c == 'e') - ; /* Pass */ - else if (isalpha(c)) - max++; - else if (c == '|') - min = max; } --- 88,128 ---- assert(compat || (args != (PyObject*)NULL)); ! while (endfmt == 0) { int c = *format++; ! switch (c) { ! case '(': if (level == 0) max++; level++; ! break; ! case ')': if (level == 0) ! Py_FatalError("excess ')' in getargs format"); else level--; break; ! case '\0': ! endfmt = 1; ! break; ! case ':': fname = format; + endfmt = 1; break; ! case ';': message = format; + endfmt = 1; + break; + default: + if (level == 0) { + if (c == 'O') + max++; + else if (isalpha(c)) { + if (c != 'e') /* skip encoded */ + max++; + } else if (c == '|') + min = max; + } break; } } From fdrake@users.sourceforge.net Tue May 29 19:13:08 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 11:13:08 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libos.tex,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv19710/lib Modified Files: libos.tex Log Message: readlink() description: Added note that the return value may be either absolute or relative. remove(), rename() descriptions: Give more information about the cross- platform behavior of these functions, so single-platform developers can be aware of the potential issues when writing portable code. This closes SF patch #426598. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -r1.53 -r1.54 *** libos.tex 2000/10/19 05:33:46 1.53 --- libos.tex 2001/05/29 18:13:06 1.54 *************** *** 651,662 **** \begin{funcdesc}{readlink}{path} Return a string representing the path to which the symbolic link ! points. Availability: \UNIX{}. \end{funcdesc} \begin{funcdesc}{remove}{path} ! Remove the file \var{path}. See \function{rmdir()} below to remove a ! directory. This is identical to the \function{unlink()} function ! documented below. Availability: Macintosh, \UNIX{}, Windows. \end{funcdesc} --- 651,668 ---- \begin{funcdesc}{readlink}{path} Return a string representing the path to which the symbolic link ! points. The result may be either an absolute or relative pathname; if ! it is relative, it may be converted to an absolute pathname using ! \code{os.path.join(os.path.dirname(\var{path}), \var{result})}. Availability: \UNIX{}. \end{funcdesc} \begin{funcdesc}{remove}{path} ! Remove the file \var{path}. If \var{path} is a directory, ! \exception{OSError} is raised; see \function{rmdir()} below to remove ! a directory. This is identical to the \function{unlink()} function ! documented below. On Windows, attempting to remove a file that is in ! use causes an exception to be raised; on \UNIX, the directory entry is ! removed but the storage allocated to the file is not made available ! until the original file is no longer in use. Availability: Macintosh, \UNIX{}, Windows. \end{funcdesc} *************** *** 675,679 **** \begin{funcdesc}{rename}{src, dst} ! Rename the file or directory \var{src} to \var{dst}. Availability: Macintosh, \UNIX{}, Windows. \end{funcdesc} --- 681,694 ---- \begin{funcdesc}{rename}{src, dst} ! Rename the file or directory \var{src} to \var{dst}. If \var{dst} is ! a directory, \exception{OSError} will be raised. On \UNIX, if ! \var{dst} exists and is a file, it will be removed silently if the ! user has permission. The operation may fail on some \UNIX{} flavors ! is \var{src} and \var{dst} are on different filesystems. If ! successful, the renaming will be an atomic operation (this is a ! \POSIX{} requirement). On Windows, if \var{dst} already exists, ! \exception{OSError} will be raised even if it is a file; there may be ! no way to implement an atomic rename when \var{dst} names an existing ! file. Availability: Macintosh, \UNIX{}, Windows. \end{funcdesc} From fdrake@users.sourceforge.net Tue May 29 19:14:28 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 11:14:28 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libos.tex,1.53,1.53.4.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv20058/lib Modified Files: Tag: release21-maint libos.tex Log Message: readlink() description: Added note that the return value may be either absolute or relative. remove(), rename() descriptions: Give more information about the cross- platform behavior of these functions, so single-platform developers can be aware of the potential issues when writing portable code. This closes SF patch #426598. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.53 retrieving revision 1.53.4.1 diff -C2 -r1.53 -r1.53.4.1 *** libos.tex 2000/10/19 05:33:46 1.53 --- libos.tex 2001/05/29 18:14:26 1.53.4.1 *************** *** 651,662 **** \begin{funcdesc}{readlink}{path} Return a string representing the path to which the symbolic link ! points. Availability: \UNIX{}. \end{funcdesc} \begin{funcdesc}{remove}{path} ! Remove the file \var{path}. See \function{rmdir()} below to remove a ! directory. This is identical to the \function{unlink()} function ! documented below. Availability: Macintosh, \UNIX{}, Windows. \end{funcdesc} --- 651,668 ---- \begin{funcdesc}{readlink}{path} Return a string representing the path to which the symbolic link ! points. The result may be either an absolute or relative pathname; if ! it is relative, it may be converted to an absolute pathname using ! \code{os.path.join(os.path.dirname(\var{path}), \var{result})}. Availability: \UNIX{}. \end{funcdesc} \begin{funcdesc}{remove}{path} ! Remove the file \var{path}. If \var{path} is a directory, ! \exception{OSError} is raised; see \function{rmdir()} below to remove ! a directory. This is identical to the \function{unlink()} function ! documented below. On Windows, attempting to remove a file that is in ! use causes an exception to be raised; on \UNIX, the directory entry is ! removed but the storage allocated to the file is not made available ! until the original file is no longer in use. Availability: Macintosh, \UNIX{}, Windows. \end{funcdesc} *************** *** 675,679 **** \begin{funcdesc}{rename}{src, dst} ! Rename the file or directory \var{src} to \var{dst}. Availability: Macintosh, \UNIX{}, Windows. \end{funcdesc} --- 681,694 ---- \begin{funcdesc}{rename}{src, dst} ! Rename the file or directory \var{src} to \var{dst}. If \var{dst} is ! a directory, \exception{OSError} will be raised. On \UNIX, if ! \var{dst} exists and is a file, it will be removed silently if the ! user has permission. The operation may fail on some \UNIX{} flavors ! is \var{src} and \var{dst} are on different filesystems. If ! successful, the renaming will be an atomic operation (this is a ! \POSIX{} requirement). On Windows, if \var{dst} already exists, ! \exception{OSError} will be raised even if it is a file; there may be ! no way to implement an atomic rename when \var{dst} names an existing ! file. Availability: Macintosh, \UNIX{}, Windows. \end{funcdesc} From fdrake@users.sourceforge.net Tue May 29 19:51:43 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 11:51:43 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.124,1.125 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv28558/api Modified Files: api.tex Log Message: Users of PySequence_GET_FAST() should get the length of the sequence using PySequence_Size(), not PyObject_Size(): the later considers the mapping methods as well as the sequence methods, which is not needed here. Either should be equally fast in this case, but PySequence_Size() offers a better conceptual match. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -r1.124 -r1.125 *** api.tex 2001/05/29 15:13:00 1.124 --- api.tex 2001/05/29 18:51:41 1.125 *************** *** 2017,2021 **** returned by \cfunction{PySequence_Fast()}, and that \var{i} is within bounds. The caller is expected to get the length of the sequence by ! calling \cfunction{PyObject_Size()} on \var{o}, since lists and tuples are guaranteed to always return their true length. \end{cfuncdesc} --- 2017,2021 ---- returned by \cfunction{PySequence_Fast()}, and that \var{i} is within bounds. The caller is expected to get the length of the sequence by ! calling \cfunction{PySequence_Size()} on \var{o}, since lists and tuples are guaranteed to always return their true length. \end{cfuncdesc} From fdrake@users.sourceforge.net Tue May 29 19:53:13 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 11:53:13 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex,1.117.2.2,1.117.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory usw-pr-cvs1:/tmp/cvs-serv28872/api Modified Files: Tag: release21-maint api.tex Log Message: Users of PySequence_GET_FAST() should get the length of the sequence using PySequence_Size(), not PyObject_Size(): the later considers the mapping methods as well as the sequence methods, which is not needed here. Either should be equally fast in this case, but PySequence_Size() offers a better conceptual match. Index: api.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/api.tex,v retrieving revision 1.117.2.2 retrieving revision 1.117.2.3 diff -C2 -r1.117.2.2 -r1.117.2.3 *** api.tex 2001/05/21 15:58:54 1.117.2.2 --- api.tex 2001/05/29 18:53:11 1.117.2.3 *************** *** 2017,2021 **** returned by \cfunction{PySequence_Fast()}, and that \var{i} is within bounds. The caller is expected to get the length of the sequence by ! calling \cfunction{PyObject_Size()} on \var{o}, since lists and tuples are guaranteed to always return their true length. \end{cfuncdesc} --- 2017,2021 ---- returned by \cfunction{PySequence_Fast()}, and that \var{i} is within bounds. The caller is expected to get the length of the sequence by ! calling \cfunction{PySequence_Size()} on \var{o}, since lists and tuples are guaranteed to always return their true length. \end{cfuncdesc} From fdrake@users.sourceforge.net Tue May 29 20:53:48 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 12:53:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/tools node2label.pl,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory usw-pr-cvs1:/tmp/cvs-serv11492/tools Modified Files: node2label.pl Log Message: New solution to the "Someone stuck a colon in that filename!" problem: Allow colons in the labels used for internal references, but do not expose them when generating filename. Index: node2label.pl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/node2label.pl,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** node2label.pl 2000/04/03 04:15:46 1.10 --- node2label.pl 2001/05/29 19:53:46 1.11 *************** *** 11,17 **** # sort so that we get a consistent assignment for nodes with multiple labels foreach $label (sort keys %external_labels) { ! $key = $external_labels{$label}; ! $key =~ s|^/||; ! $nodes{$key} = $label; } --- 11,24 ---- # sort so that we get a consistent assignment for nodes with multiple labels foreach $label (sort keys %external_labels) { ! # ! # If the label can't be used as a filename on non-Unix platforms, ! # skip it. Such labels may be used internally within the documentation, ! # but will never be used for filename generation. ! # ! if ($label =~ /^([-.a-zA-Z0-9]+)$/) { ! $key = $external_labels{$label}; ! $key =~ s|^/||; ! $nodes{$key} = $label; ! } } From tim_one@users.sourceforge.net Tue May 29 22:14:34 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 29 May 2001 14:14:34 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_operations.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv30147/python/dist/src/Lib/test Modified Files: test_operations.py Log Message: BadDictKey test: The output file expected "raising error" to be printed exactly once. But the test code can't know that, as the number of times __cmp__ is called depends on internal details of the dict implementation. This is especially nasty because the __hash__ method returns the address of the class object, so the hash codes seen by the dict can vary across runs, causing the dict to use a different probe order across runs. I just happened to see this test fail about 1 run in 7 today, but only under a release build and when passing -O to Python. So, changed the test to be predictable across runs. Index: test_operations.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_operations.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** test_operations.py 2001/05/23 23:33:57 1.4 --- test_operations.py 2001/05/29 21:14:32 1.5 *************** *** 12,15 **** --- 12,17 ---- class BadDictKey: + already_printed_raising_error = 0 + def __hash__(self): return hash(self.__class__) *************** *** 17,21 **** def __cmp__(self, other): if isinstance(other, self.__class__): ! print "raising error" raise RuntimeError, "gotcha" return other --- 19,30 ---- def __cmp__(self, other): if isinstance(other, self.__class__): ! if not BadDictKey.already_printed_raising_error: ! # How many times __cmp__ gets called depends on the hash ! # code and the internals of the dict implementation; we ! # know it will be called at least once, but that's it. ! # already_printed_raising_error makes sure the expected- ! # output file prints the msg at most once. ! BadDictKey.already_printed_raising_error = 1 ! print "raising error" raise RuntimeError, "gotcha" return other From tim_one@users.sourceforge.net Tue May 29 23:18:11 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 29 May 2001 15:18:11 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_complex.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory usw-pr-cvs1:/tmp/cvs-serv11489/python/dist/src/Lib/test Modified Files: test_complex.py Log Message: This division test was too stringent in its accuracy expectations for random inputs: if you ran the test 100 times, you could expect it to report a bogus failure. So loosened its expectations. Also changed the way failing tests are printed, so that when run under regrtest.py we get enough info to reproduce the failure. Index: test_complex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_complex.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** test_complex.py 2001/03/18 08:21:56 1.1 --- test_complex.py 2001/05/29 22:18:09 1.2 *************** *** 6,10 **** nerrors = 0 ! def check_close_real(x, y, eps=1e-12): """Return true iff floats x and y "are close\"""" # put the one with larger magnitude second --- 6,10 ---- nerrors = 0 ! def check_close_real(x, y, eps=1e-9): """Return true iff floats x and y "are close\"""" # put the one with larger magnitude second *************** *** 18,22 **** return abs((x-y)/y) < eps ! def check_close(x, y, eps=1e-12): """Return true iff complexes x and y "are close\"""" return check_close_real(x.real, y.real, eps) and \ --- 18,22 ---- return abs((x-y)/y) < eps ! def check_close(x, y, eps=1e-9): """Return true iff complexes x and y "are close\"""" return check_close_real(x.real, y.real, eps) and \ *************** *** 31,40 **** if not check_close(q, y): nerrors += 1 ! print `z`, "/", `x`, "==", `q`, "but expected", `y` if y != 0: q = z / y if not check_close(q, x): nerrors += 1 ! print `z`, "/", `y`, "==", `q`, "but expected", `x` simple_real = [float(i) for i in range(-5, 6)] --- 31,40 ---- if not check_close(q, y): nerrors += 1 ! print "%r / %r == %r but expected %r" % (z, x, q, y) if y != 0: q = z / y if not check_close(q, x): nerrors += 1 ! print "%r / %r == %r but expected %r" % (z, y, q, x) simple_real = [float(i) for i in range(-5, 6)] From fdrake@users.sourceforge.net Wed May 30 05:59:02 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 21:59:02 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libhtmlparser.tex,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18298/lib Added Files: libhtmlparser.tex Log Message: Michel Pelletier : Documentation for the HTMLParser module, with small changes by FLD. --- NEW FILE: libhtmlparser.tex --- \section{\module{HTMLParser} --- Simple HTML and XHTML parser} \declaremodule{standard}{HTMLParser} \modulesynopsis{A simple parser that can handle HTML and XHTML.} This module defines a class \class{HTMLParser} which serves as the basis for parsing text files formatted in HTML\index{HTML} (HyperText Mark-up Language) and XHTML.\index{XHTML} \begin{classdesc}{HTMLParser}{} The \class{HTMLParser} class is instantiated without arguments. An HTMLParser instance is fed HTML data and calls handler functions when tags begin and end. The \class{HTMLParser} class is meant to be overridden by the user to provide a desired behavior. \end{classdesc} \class{HTMLParser} instances have the following methods: \begin{methoddesc}{reset}{} Reset the instance. Loses all unprocessed data. This is called implicitly at instantiation time. \end{methoddesc} \begin{methoddesc}{feed}{data} Feed some text to the parser. It is processed insofar as it consists of complete elements; incomplete data is buffered until more data is fed or \method{close()} is called. \end{methoddesc} \begin{methoddesc}{close}{} Force processing of all buffered data as if it were followed by an end-of-file mark. This method may be redefined by a derived class to define additional processing at the end of the input, but the redefined version should always call the \class{HTMLParser} base class method \method{close()}. \end{methoddesc} \begin{methoddesc}{getpos}{} Return current line number and offset. \end{methoddesc} \begin{methoddesc}{get_starttag_text}{} Return the text of the most recently opened start tag. This should not normally be needed for structured processing, but may be useful in dealing with HTML ``as deployed'' or for re-generating input with minimal changes (whitespace between attributes can be preserved, etc.). \end{methoddesc} \begin{methoddesc}{handle_starttag}{tag, attrs} This method is called to handle the start of a tag. It is intended to be overridden by a derived class; the base class implementation does nothing. The \var{tag} argument is the name of the tag converted to lower case. The \var{attrs} argument is a list of \code{(\var{name}, \var{value})} pairs containing the attributes found inside the tag's \code{<>} brackets. The \var{name} will be translated to lower case and double quotes and backslashes in the \var{value} have been interpreted. For instance, for the tag \code{
}, this method would be called as \samp{handle_starttag('a', [('href', 'http://www.cwi.nl/')])}. \end{methoddesc} \begin{methoddesc}{handle_startendtag}{tag, attrs} Similar to \method{handle_starttag()}, but called when the parser encounters an XHTML-style empty tag (\code{}). This method may be overridden by subclasses which require this particular lexical information; the default implementation simple calls \method{handle_starttag()} and \method{handle_endtag()}. \end{methoddesc} \begin{methoddesc}{handle_endtag}{tag} This method is called to handle the end tag of an element. It is intended to be overridden by a derived class; the base class implementation does nothing. The \var{tag} argument is the name of the tag converted to lower case. \end{methoddesc} \begin{methoddesc}{handle_data}{data} This method is called to process arbitrary data. It is intended to be overridden by a derived class; the base class implementation does nothing. \end{methoddesc} \begin{methoddesc}{handle_charref}{name} This method is called to process a character reference of the form \samp{\&\#\var{ref};}. It is intended to be overridden by a derived class; the base class implementation does nothing. \end{methoddesc} \begin{methoddesc}{handle_entityref}{name} This method is called to process a general entity reference of the form \samp{\&\var{name};} where \var{name} is an general entity reference. It is intended to be overridden by a derived class; the base class implementation does nothing. \end{methoddesc} \begin{methoddesc}{handle_comment}{data} This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the \samp{} delimiters, but not the delimiters themselves. For example, the comment \samp{} will cause this method to be called with the argument \code{'text'}. It is intended to be overridden by a derived class; the base class implementation does nothing. \end{methoddesc} \begin{methoddesc}{handle_decl}{decl} Method called when an SGML declaration is read by the parser. The \var{decl} parameter will be the entire contents of the declaration inside the \code{} markup.It is intended to be overridden by a derived class; the base class implementation does nothing. \end{methoddesc} \subsection{Example HTML Parser \label{htmlparser-example}} As a basic example, below is a very basic HTML parser that uses the \class{HTMLParser} class to print out tags as they are encountered: \begin{verbatim} from HTMLParser import HTMLParser class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): print "Encountered the beginning of a %s tag" % tag def handle_endtag(self, tag): print "Encountered the end of a %s tag" % tag \end{verbatim} From fdrake@users.sourceforge.net Wed May 30 05:59:52 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 21:59:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc Makefile.deps,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory usw-pr-cvs1:/tmp/cvs-serv18417 Modified Files: Makefile.deps Log Message: Added entry for HTMLParser documentation. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -r1.65 -r1.66 *** Makefile.deps 2001/04/13 04:50:01 1.65 --- Makefile.deps 2001/05/30 04:59:50 1.66 *************** *** 113,116 **** --- 113,117 ---- lib/libnntplib.tex \ lib/liburlparse.tex \ + lib/libhtmlparser.tex \ lib/libhtmllib.tex \ lib/libsgmllib.tex \ From fdrake@users.sourceforge.net Wed May 30 05:59:52 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Tue, 29 May 2001 21:59:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib lib.tex,1.185,1.186 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv18417/lib Modified Files: lib.tex Log Message: Added entry for HTMLParser documentation. Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.185 retrieving revision 1.186 diff -C2 -r1.185 -r1.186 *** lib.tex 2001/04/07 05:42:14 1.185 --- lib.tex 2001/05/30 04:59:50 1.186 *************** *** 235,238 **** --- 235,239 ---- \input{markup} % Structured Markup Processing Tools + \input{libhtmlparser} \input{libsgmllib} \input{libhtmllib} From tim_one@users.sourceforge.net Wed May 30 07:09:52 2001 From: tim_one@users.sourceforge.net (Tim Peters) Date: Tue, 29 May 2001 23:09:52 -0700 Subject: [Python-checkins] CVS: python/dist/src/Python errors.c,2.62,2.63 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory usw-pr-cvs1:/tmp/cvs-serv28509/python/dist/src/Python Modified Files: errors.c Log Message: PyErr_Occurred(): Use PyThreadState_GET(), which saves a tiny function call in release builds. Suggested by Martin v. Loewis. I'm half tempted to macroize PyErr_Occurred too, as the whole thing could collapse to just _PyThreadState_Current->curexc_type Index: errors.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/errors.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -r2.62 -r2.63 *** errors.c 2001/03/06 12:12:02 2.62 --- errors.c 2001/05/30 06:09:50 2.63 *************** *** 76,80 **** PyErr_Occurred(void) { ! PyThreadState *tstate = PyThreadState_Get(); return tstate->curexc_type; --- 76,80 ---- PyErr_Occurred(void) { ! PyThreadState *tstate = PyThreadState_GET(); return tstate->curexc_type; From montanaro@users.sourceforge.net Thu May 31 19:03:24 2001 From: montanaro@users.sourceforge.net (Skip Montanaro) Date: Thu, 31 May 2001 11:03:24 -0700 Subject: [Python-checkins] CVS: python/dist/src/Lib httplib.py,1.34,1.34.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory usw-pr-cvs1:/tmp/cvs-serv12485 Modified Files: Tag: release21-maint httplib.py Log Message: expand __all__ to include a bunch of names that should have been there before. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.34 retrieving revision 1.34.2.1 diff -C2 -r1.34 -r1.34.2.1 *** httplib.py 2001/04/13 14:57:08 1.34 --- httplib.py 2001/05/31 18:03:22 1.34.2.1 *************** *** 75,79 **** from StringIO import StringIO ! __all__ = ["HTTP"] HTTP_PORT = 80 --- 75,84 ---- from StringIO import StringIO ! __all__ = ["HTTP", "HTTPResponse", "HTTPConnection", "HTTPSConnection", ! "HTTPException", "NotConnected", "UnknownProtocol", ! "UnknownTransferEncoding", "IllegalKeywordArgument", ! "UnimplementedFileMode", "IncompleteRead", ! "ImproperConnectionState", "CannotSendRequest", "CannotSendHeader", ! "ResponseNotReady", "BadStatusLine", "error"] HTTP_PORT = 80 From fdrake@users.sourceforge.net Thu May 31 21:24:09 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 31 May 2001 13:24:09 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libthreading.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv11469/lib Modified Files: libthreading.tex Log Message: Some general cleanup of the threading module documentation, including fixing the reference to Thread.getDeamon() (should be isDaemon()). This closes SF bug #429070. Index: libthreading.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libthreading.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** libthreading.tex 1999/04/23 20:07:02 1.7 --- libthreading.tex 2001/05/31 20:24:07 1.8 *************** *** 69,75 **** \end{funcdesc} ! \begin{classdesc}{Thread}{} A class that represents a thread of control. This class can be safely subclassed in a limited fashion. ! \end{classdesc} Detailed interfaces for the objects are documented below. --- 69,75 ---- \end{funcdesc} ! \begin{classdesc*}{Thread}{} A class that represents a thread of control. This class can be safely subclassed in a limited fashion. ! \end{classdesc*} Detailed interfaces for the objects are documented below. *************** *** 445,449 **** daemon threads are left. The initial value is inherited from the creating thread. The flag can be set with the \method{setDaemon()} ! method and retrieved with the \method{getDaemon()} method. There is a ``main thread'' object; this corresponds to the --- 445,449 ---- daemon threads are left. The initial value is inherited from the creating thread. The flag can be set with the \method{setDaemon()} ! method and retrieved with the \method{isDaemon()} method. There is a ``main thread'' object; this corresponds to the *************** *** 465,488 **** This constructor should always be called with keyword arguments. Arguments are: ! \var{group} ! Should be \code{None}; reserved for future extension when a ! \class{ThreadGroup} class is implemented. ! ! \var{target} ! Callable object to be invoked by the \method{run()} method. ! Defaults to \code{None}, meaning nothing is called. ! ! \var{name} ! The thread name. By default, a unique name is constructed of the form ! ``Thread-\var{N}'' where \var{N} is a small decimal number. ! ! \var{args} ! Argument tuple for the target invocation. Defaults to \code{()}. ! ! \var{kwargs} ! Keyword argument dictionary for the target invocation. ! Defaults to \code{\{\}}. If the subclass overrides the constructor, it must make sure to invoke the base class constructor (\code{Thread.__init__()}) --- 465,486 ---- This constructor should always be called with keyword arguments. Arguments are: + + \var{group} should be \code{None}; reserved for future extension when + a \class{ThreadGroup} class is implemented. + + \var{target} is the callable object to be invoked by the + \method{run()} method. Defaults to \code{None}, meaning nothing is + called. + + \var{name} is the thread name. By default, a unique name is + constructed of the form ``Thread-\var{N}'' where \var{N} is a small + decimal number. ! \var{args} is the argument tuple for the target invocation. Defaults ! to \code{()}. + \var{kwargs} is a dictionary of keyword arguments for the target + invocation. Defaults to \code{\{\}}. + If the subclass overrides the constructor, it must make sure to invoke the base class constructor (\code{Thread.__init__()}) *************** *** 490,495 **** \end{classdesc} - - \begin{methoddesc}{start}{} Start the thread's activity. --- 488,491 ---- *************** *** 500,505 **** \end{methoddesc} - - \begin{methoddesc}{run}{} Method representing the thread's activity. --- 496,499 ---- *************** *** 512,516 **** \end{methoddesc} - \begin{methoddesc}{join}{\optional{timeout}} Wait until the thread terminates. --- 506,509 ---- *************** *** 532,537 **** \end{methoddesc} - - \begin{methoddesc}{getName}{} Return the thread's name. --- 525,528 ---- *************** *** 566,568 **** threads are left. \end{methoddesc} - --- 557,558 ---- From fdrake@users.sourceforge.net Thu May 31 21:24:39 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 31 May 2001 13:24:39 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libthreading.tex,1.7,1.7.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv11550/lib Modified Files: Tag: release21-maint libthreading.tex Log Message: Some general cleanup of the threading module documentation, including fixing the reference to Thread.getDeamon() (should be isDaemon()). This closes SF bug #429070. Index: libthreading.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libthreading.tex,v retrieving revision 1.7 retrieving revision 1.7.12.1 diff -C2 -r1.7 -r1.7.12.1 *** libthreading.tex 1999/04/23 20:07:02 1.7 --- libthreading.tex 2001/05/31 20:24:37 1.7.12.1 *************** *** 69,75 **** \end{funcdesc} ! \begin{classdesc}{Thread}{} A class that represents a thread of control. This class can be safely subclassed in a limited fashion. ! \end{classdesc} Detailed interfaces for the objects are documented below. --- 69,75 ---- \end{funcdesc} ! \begin{classdesc*}{Thread}{} A class that represents a thread of control. This class can be safely subclassed in a limited fashion. ! \end{classdesc*} Detailed interfaces for the objects are documented below. *************** *** 445,449 **** daemon threads are left. The initial value is inherited from the creating thread. The flag can be set with the \method{setDaemon()} ! method and retrieved with the \method{getDaemon()} method. There is a ``main thread'' object; this corresponds to the --- 445,449 ---- daemon threads are left. The initial value is inherited from the creating thread. The flag can be set with the \method{setDaemon()} ! method and retrieved with the \method{isDaemon()} method. There is a ``main thread'' object; this corresponds to the *************** *** 465,488 **** This constructor should always be called with keyword arguments. Arguments are: ! \var{group} ! Should be \code{None}; reserved for future extension when a ! \class{ThreadGroup} class is implemented. ! ! \var{target} ! Callable object to be invoked by the \method{run()} method. ! Defaults to \code{None}, meaning nothing is called. ! ! \var{name} ! The thread name. By default, a unique name is constructed of the form ! ``Thread-\var{N}'' where \var{N} is a small decimal number. ! ! \var{args} ! Argument tuple for the target invocation. Defaults to \code{()}. ! ! \var{kwargs} ! Keyword argument dictionary for the target invocation. ! Defaults to \code{\{\}}. If the subclass overrides the constructor, it must make sure to invoke the base class constructor (\code{Thread.__init__()}) --- 465,486 ---- This constructor should always be called with keyword arguments. Arguments are: + + \var{group} should be \code{None}; reserved for future extension when + a \class{ThreadGroup} class is implemented. + + \var{target} is the callable object to be invoked by the + \method{run()} method. Defaults to \code{None}, meaning nothing is + called. + + \var{name} is the thread name. By default, a unique name is + constructed of the form ``Thread-\var{N}'' where \var{N} is a small + decimal number. ! \var{args} is the argument tuple for the target invocation. Defaults ! to \code{()}. + \var{kwargs} is a dictionary of keyword arguments for the target + invocation. Defaults to \code{\{\}}. + If the subclass overrides the constructor, it must make sure to invoke the base class constructor (\code{Thread.__init__()}) *************** *** 490,495 **** \end{classdesc} - - \begin{methoddesc}{start}{} Start the thread's activity. --- 488,491 ---- *************** *** 500,505 **** \end{methoddesc} - - \begin{methoddesc}{run}{} Method representing the thread's activity. --- 496,499 ---- *************** *** 512,516 **** \end{methoddesc} - \begin{methoddesc}{join}{\optional{timeout}} Wait until the thread terminates. --- 506,509 ---- *************** *** 532,537 **** \end{methoddesc} - - \begin{methoddesc}{getName}{} Return the thread's name. --- 525,528 ---- *************** *** 566,568 **** threads are left. \end{methoddesc} - --- 557,558 ---- From fdrake@users.sourceforge.net Thu May 31 21:27:20 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 31 May 2001 13:27:20 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libos.tex,1.53.4.1,1.53.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv12202/lib Modified Files: Tag: release21-maint libos.tex Log Message: Document os.getenv(). This closes SF bug #429059. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.53.4.1 retrieving revision 1.53.4.2 diff -C2 -r1.53.4.1 -r1.53.4.2 *** libos.tex 2001/05/29 18:14:26 1.53.4.1 --- libos.tex 2001/05/31 20:27:18 1.53.4.2 *************** *** 167,170 **** --- 167,177 ---- \end{funcdesc} + \begin{funcdesc}{getenv}{varname\optional{, value}} + Return the value of the environment variable \var{varname} if it + exists, or \var{value} if it doesn't. \var{value} defaults to + \code{None}. + Availability: most flavors of \UNIX{}, Windows. + \end{funcdesc} + \begin{funcdesc}{putenv}{varname, value} \index{environment variables!setting} From fdrake@users.sourceforge.net Thu May 31 21:27:48 2001 From: fdrake@users.sourceforge.net (Fred L. Drake) Date: Thu, 31 May 2001 13:27:48 -0700 Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libos.tex,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory usw-pr-cvs1:/tmp/cvs-serv12347/lib Modified Files: libos.tex Log Message: Document os.getenv(). This closes SF bug #429059. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -r1.54 -r1.55 *** libos.tex 2001/05/29 18:13:06 1.54 --- libos.tex 2001/05/31 20:27:46 1.55 *************** *** 167,170 **** --- 167,177 ---- \end{funcdesc} + \begin{funcdesc}{getenv}{varname\optional{, value}} + Return the value of the environment variable \var{varname} if it + exists, or \var{value} if it doesn't. \var{value} defaults to + \code{None}. + Availability: most flavors of \UNIX{}, Windows. + \end{funcdesc} + \begin{funcdesc}{putenv}{varname, value} \index{environment variables!setting}