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