From fdrake@weyr.cnri.reston.va.us Wed Dec 1 18:42:00 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 1 Dec 1999 13:42:00 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libundoc.tex Message-ID: <199912011842.NAA13373@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libundoc.tex Log Message: Update link to PythonWare library page. From fdrake@weyr.cnri.reston.va.us Wed Dec 1 18:44:10 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 1 Dec 1999 13:44:10 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libundoc.tex Message-ID: <199912011844.NAA13404@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libundoc.tex Log Message: Update link to PythonWare library page. From bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Wed Dec 1 19:01:12 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) (Barry A. Warsaw) Date: Wed, 1 Dec 1999 14:01:12 -0500 (EST) Subject: [Python-checkins] CVS log messages with diffs References: <199911161700.MAA02716@eric.cnri.reston.va.us> <14389.31511.706588.20840@anthem.cnri.reston.va.us> Message-ID: <14405.28792.184298.298597@anthem.cnri.reston.va.us> >>>>> "BAW" == Barry A Warsaw writes: BAW> There was a suggestion to start augmenting the checkin emails BAW> to include the diffs of the checkin. This would let you keep BAW> a current snapshot of the tree without having to do a direct BAW> `cvs update'. The voting has stopped, with the "yeah" vote slightly head of the "nay" vote. We'll go with context diffs, and we'll be implementing Greg Stein's approach with the xml-checkins list: truncating diffs to H number of lines at the top and T number of lines at the bottom, so as not to overwhelm incoming email. I'll try to get this going sometime today (no promises). You'll likely see a number of tests coming through python-checkins in the meantime. I'll send a message out when it's done. -Barry From bwarsaw@cnri.reston.va.us Wed Dec 1 22:34:43 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 1 Dec 1999 17:34:43 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.7,1.8 Message-ID: <199912012234.RAA01747@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Misc In directory anthem:/home/bwarsaw/projects/python/Misc Modified Files: ccpy-style.el Log Message: Minor change to test new CVS reporting [...-40 lines suppressed...] From bwarsaw@cnri.reston.va.us Wed Dec 1 22:39:00 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 1 Dec 1999 17:39:00 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.8,1.9 Message-ID: <199912012239.RAA01775@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Misc In directory anthem:/home/bwarsaw/projects/python/Misc Modified Files: ccpy-style.el Log Message: Minor change to test new CVS reporting From guido@CNRI.Reston.VA.US Wed Dec 1 22:43:03 1999 From: guido@CNRI.Reston.VA.US (Guido van Rossum) Date: Wed, 01 Dec 1999 17:43:03 -0500 Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.7,1.8 In-Reply-To: Your message of "Wed, 01 Dec 1999 17:34:43 EST." <199912012234.RAA01747@anthem.cnri.reston.va.us> References: <199912012234.RAA01747@anthem.cnri.reston.va.us> Message-ID: <199912012243.RAA10832@eric.cnri.reston.va.us> > Update of /projects/cvsroot/python/dist/src/Misc > In directory anthem:/home/bwarsaw/projects/python/Misc > > Modified Files: > ccpy-style.el > Log Message: > Minor change to test new CVS reporting > > > [...-40 lines suppressed...] Sounds like it didn't do quite what you expected? --Guido van Rossum (home page: http://www.python.org/~guido/) From bwarsaw@cnri.reston.va.us Wed Dec 1 22:43:05 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 1 Dec 1999 17:43:05 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.9,1.10 Message-ID: <199912012243.RAA01803@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Misc In directory anthem:/home/bwarsaw/projects/python/Misc Modified Files: ccpy-style.el Log Message: Minor change to test new CVS reporting Error code 1 occurred during diff From bwarsaw@cnri.reston.va.us Wed Dec 1 23:30:48 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 1 Dec 1999 18:30:48 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.19,1.20 Message-ID: <199912012330.SAA02151@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Misc In directory anthem:/home/bwarsaw/projects/python/Misc Modified Files: ccpy-style.el Log Message: more trivial stuff to test CVS -- should be the last? Error code 1 occurred during diff From bwarsaw@cnri.reston.va.us Wed Dec 1 23:40:04 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 1 Dec 1999 18:40:04 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.23,1.24 Message-ID: <199912012340.SAA02235@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Misc In directory anthem:/home/bwarsaw/projects/python/Misc Modified Files: ccpy-style.el Log Message: Last try, think I got it now. Index: ccpy-style.el =================================================================== RCS file: /projects/cvsroot/python/dist/src/Misc/ccpy-style.el,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** ccpy-style.el 1999/12/01 23:38:27 1.23 --- ccpy-style.el 1999/12/01 23:40:01 1.24 *************** *** 15,19 **** ;; ). - ;; To use, make sure this file is on your Emacs load-path, and simply ;; add this to your .emacs file: --- 15,18 ---- From bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Thu Dec 2 04:24:03 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) (Barry A. Warsaw) Date: Wed, 1 Dec 1999 23:24:03 -0500 (EST) Subject: [Python-checkins] CVS log messages with diffs References: <199911161700.MAA02716@eric.cnri.reston.va.us> <14389.31511.706588.20840@anthem.cnri.reston.va.us> Message-ID: <14405.62563.345566.500106@anthem.cnri.reston.va.us> Okay folks, I think I've got the diff thing working now. The trick (for you CVS heads) was that you can't do a `cvs diff' while you're executing a loginfo script. Lock contention (repeat after me: "I Love CVS!"). Anyway, let's see how you all like it. Note that based on a suggestion by Greg Stein, seconded by GvR, I do not send out the entire diff of every file (which could potentially be huge). I send out 20 lines from the head of the diff and 20 lines from the tail, and suppress everything inbetween. Those numbers can be easily tweaked, and I'm not sure what the ideal is. Let's see what the emails look like when stuff starts getting checked in. Enjoy, -Barry From fdrake@weyr.cnri.reston.va.us Fri Dec 3 17:13:59 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 12:13:59 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libarray.tex Message-ID: <199912031713.MAA13379@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libarray.tex Log Message: Correct the documentation for the byteswap method; error pointed out by Bernhard Reiter . Clarified that the repr of array objects is guaranteed to work given "from array import array", not that it was always guaranteed to work regardless of the namespace. Added references to NumPy and the NumPy manual, indicating that an additional array type is provided there. From fdrake@weyr.cnri.reston.va.us Fri Dec 3 17:15:33 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 12:15:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules arraymodule.c,2.35,2.36 Message-ID: <199912031715.MAA13412@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: arraymodule.c Log Message: Correct the docstring for byteswap(); error noted by Bernhard Reiter . Added a check that no parameters were passed to byteswap(); previously allowed any parameters you happened to pass. Index: arraymodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.35 retrieving revision 2.36 diff -u -C2 -r2.35 -r2.36 *** arraymodule.c 1999/08/27 20:33:52 2.35 --- arraymodule.c 1999/12/03 17:15:30 2.36 *************** *** 760,763 **** --- 760,767 ---- char *p; int i; + + if (!PyArg_ParseTuple(args, ":byteswap")) + return NULL; + switch (self->ob_descr->itemsize) { case 1: *************** *** 806,813 **** static char byteswap_doc [] = ! "byteswap(x)\n\ \n\ ! Byteswap all items of the array. This is only supported for integer\n\ ! values of x, which determines the size of the blocks swapped."; static PyObject * --- 810,817 ---- static char byteswap_doc [] = ! "byteswap()\n\ \n\ ! Byteswap all items of the array. If the items in the array are not 1, 2,\n\ ! 4, or 8 bytes in size, RuntimeError is raised."; static PyObject * *************** *** 1140,1144 **** {"append", (PyCFunction)array_append, 0, append_doc}, {"buffer_info", (PyCFunction)array_buffer_info, 0, buffer_info_doc}, ! {"byteswap", (PyCFunction)array_byteswap, 0, byteswap_doc}, /* {"count", (method)array_count},*/ {"fromfile", (PyCFunction)array_fromfile, 0, fromfile_doc}, --- 1144,1149 ---- {"append", (PyCFunction)array_append, 0, append_doc}, {"buffer_info", (PyCFunction)array_buffer_info, 0, buffer_info_doc}, ! {"byteswap", (PyCFunction)array_byteswap, METH_VARARGS, ! byteswap_doc}, /* {"count", (method)array_count},*/ {"fromfile", (PyCFunction)array_fromfile, 0, fromfile_doc}, From fdrake@weyr.cnri.reston.va.us Fri Dec 3 18:12:30 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 13:12:30 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libnis.tex Message-ID: <199912031812.NAA13722@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libnis.tex Log Message: Removed unnecessary XXX comment. From fdrake@weyr.cnri.reston.va.us Fri Dec 3 19:13:37 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 14:13:37 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/ext ext.tex Message-ID: <199912031913.OAA14164@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/ext In directory weyr:/home/fdrake/projects/python/Doc-152p1/ext Modified Files: Tag: release152p1-patches ext.tex Log Message: Added some explanation about the difference initializing modules that are part of an embedding application. Lack of clarity pointed out by Steven Work in a message buried deep in my inbox. From fdrake@weyr.cnri.reston.va.us Fri Dec 3 19:52:50 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 14:52:50 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libos.tex Message-ID: <199912031952.OAA14391@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libos.tex Log Message: Fixed typo and expanded list of functions that return a process status code; fix & suggestion by Gerry Wiener . From fdrake@weyr.cnri.reston.va.us Fri Dec 3 22:00:34 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 17:00:34 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex Message-ID: <199912032200.RAA15506@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/tut In directory weyr:/home/fdrake/projects/python/Doc-152p1/tut Modified Files: Tag: release152p1-patches tut.tex Log Message: Try to clarify the "pass by value" explanation in the text, not just the footnote. Roger Irwin reported confusion, and I know this has come up before. From guido@CNRI.Reston.VA.US Mon Dec 6 14:51:08 1999 From: guido@CNRI.Reston.VA.US (Guido van Rossum) Date: Mon, 6 Dec 1999 09:51:08 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib posixfile.py,1.11,1.12 Message-ID: <199912061451.JAA18806@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: posixfile.py Log Message: According to Craig H Rowland, openbsd2 is yet another BSD variant that uses the BSD version of the lock structure. Sigh, @!%$. Index: posixfile.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/posixfile.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** posixfile.py 1999/02/23 04:14:32 1.11 --- posixfile.py 1999/12/06 14:51:05 1.12 *************** *** 179,182 **** --- 179,183 ---- import sys, os if sys.platform in ('netbsd1', + 'openbsd2', 'freebsd2', 'freebsd3', 'bsdos2', 'bsdos3', 'bsdos4'): *************** *** 194,197 **** --- 195,199 ---- if '?' in how: if sys.platform in ('netbsd1', + 'openbsd2', 'freebsd2', 'freebsd3', 'bsdos2', 'bsdos3', 'bsdos4'): From bwarsaw@CNRI.Reston.VA.US Mon Dec 6 02:46:52 1999 From: bwarsaw@CNRI.Reston.VA.US (Barry A. Warsaw) Date: Sun, 5 Dec 1999 21:46:52 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/i18n pygettext.py,1.4,1.5 Message-ID: <199912060246.VAA08410@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/i18n In directory anthem:/home/bwarsaw/projects/python/Tools/i18n Modified Files: pygettext.py Log Message: Added \" to escapes so embedded escaped double quotes are handled correctly. Patch suggested by Mads Kiilerich . Index: pygettext.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/i18n/pygettext.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** pygettext.py 1999/11/03 18:47:52 1.4 --- pygettext.py 1999/12/06 02:46:49 1.5 *************** *** 138,141 **** --- 138,142 ---- escapes[ord('\r')] = '\\r' escapes[ord('\n')] = '\\n' + escapes[ord('\"')] = '\\"' def escape(s): From fdrake@weyr.cnri.reston.va.us Tue Dec 7 15:13:33 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 7 Dec 1999 10:13:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libtime.tex Message-ID: <199912071513.KAA06649@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libtime.tex Log Message: Added note explaining why the seconds field allows as many as 62 seconds in a minute. Confusion noted by Manus Hand . From fdrake@weyr.cnri.reston.va.us Tue Dec 7 20:01:52 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 7 Dec 1999 15:01:52 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex Message-ID: <199912072001.PAA08640@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/ref In directory weyr:/home/fdrake/projects/python/Doc-152p1/ref Modified Files: Tag: release152p1-patches ref3.tex Log Message: Follow up on Barry's confusion about bit numbering; use bitmasks instead of bit numbers to describe the bits of the co_flags. From guido@cnri.reston.va.us Tue Dec 7 21:30:33 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Dec 1999 16:30:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.94,1.95 Message-ID: <199912072130.QAA25590@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/projects/python/develop/guido/src/Modules Modified Files: socketmodule.c Log Message: OpenSSL support. This is based on patches for a version of SSLeay by Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by Laszlo Kovacs of HP. Both have kindly given permission to include the patches in the Python distribution. Final formatting by GvR. Index: socketmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -r1.94 -r1.95 *** socketmodule.c 1999/11/04 18:22:29 1.94 --- socketmodule.c 1999/12/07 21:30:30 1.95 *************** *** 32,35 **** --- 32,37 ---- /* Socket module */ + /* SSL support based on patches by Brian E Gallew and Laszlo Kovacs */ + /* This module provides an interface to Berkeley socket IPC. *************** *** 57,60 **** --- 59,63 ---- - socket.inet_aton(IP address) -> 32-bit packed IP representation - socket.inet_ntoa(packed IP) -> IP address string + - socket.ssl(socket, keyfile, certfile) -> new ssl object - an Internet socket address is a pair (hostname, port) where hostname can be anything recognized by gethostbyname() *************** *** 191,194 **** --- 194,205 ---- #endif + #ifdef USE_SSL + #include "rsa.h" + #include "crypto.h" + #include "x509.h" + #include "pem.h" + #include "ssl.h" + #include "err.h" + #endif /* USE_SSL */ /* Here we have some hacks to choose between K&R or ANSI style function *************** *** 254,257 **** --- 265,272 ---- static PyObject *PySocket_Error; + #ifdef USE_SSL + static PyObject *SSLErrorObject; + #endif /* USE_SSL */ + /* Convenience function to raise an error according to errno *************** *** 325,329 **** --- 340,367 ---- } PySocketSockObject; + #ifdef USE_SSL + + typedef struct { + PyObject_HEAD + PySocketSockObject *Socket; /* Socket on which we're layered */ + PyObject *x_attr; /* Attributes dictionary */ + SSL_CTX* ctx; + SSL* ssl; + X509* server_cert; + BIO* sbio; + char server[256]; + char issuer[256]; + + } SSLObject; + + staticforward PyTypeObject SSL_Type; + staticforward int SSL_setattr(SSLObject *self, char *name, PyObject *v); + staticforward PyObject *SSL_SSLwrite(SSLObject *self, PyObject *args); + staticforward PyObject *SSL_SSLread(SSLObject *self, PyObject *args); + + #define SSLObject_Check(v) ((v)->ob_type == &SSL_Type) + #endif /* USE_SSL */ + /* A forward reference to the Socktype type object. The Socktype variable contains pointers to various functions, *************** *** 1875,1878 **** --- 1913,2152 ---- } + + #ifdef USE_SSL + + /* This is a C function to be called for new object initialization */ + static SSLObject * + BUILD_FUNC_DEF_3(newSSLObject, + PySocketSockObject *,Sock, char*,key_file, char*,cert_file) + { + SSLObject *self; + char *str; + + #if 0 + meth=SSLv23_client_method(); + meth=SSLv3_client_method(); + meth=SSLv2_client_method(); + #endif + + self = PyObject_NEW(SSLObject, &SSL_Type); /* Create new object */ + if (self == NULL){ + PyErr_SetObject(SSLErrorObject, + PyString_FromString("newSSLObject error")); + return NULL; + } + memset(self->server, NULL, sizeof(char) * 256); + memset(self->issuer, NULL, sizeof(char) * 256); + + self->x_attr = PyDict_New(); + self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ + if (self->ctx == NULL) { + PyErr_SetObject(SSLErrorObject, + PyString_FromString("SSL_CTX_new error")); + PyMem_DEL(self); + return NULL; + } + + if ( (key_file && !cert_file) || (!key_file && cert_file) ) + { + PyErr_SetObject(SSLErrorObject, + PyString_FromString( + "Both the key & certificate files must be specified")); + PyMem_DEL(self); + return NULL; + } + + if (key_file && cert_file) + { + if (SSL_CTX_use_PrivateKey_file(self->ctx, key_file, + SSL_FILETYPE_PEM) < 1) + { + PyErr_SetObject(SSLErrorObject, + PyString_FromString( + "SSL_CTX_use_PrivateKey_file error")); + PyMem_DEL(self); + return NULL; + } + + if (SSL_CTX_use_certificate_chain_file(self->ctx, + cert_file) < 1) + { + PyErr_SetObject(SSLErrorObject, + PyString_FromString( + "SSL_CTX_use_certificate_chain_file error")); + PyMem_DEL(self); + return NULL; + } + } + + SSL_CTX_set_verify(self->ctx, + SSL_VERIFY_NONE, NULL); /* set verify lvl */ + self->ssl = SSL_new(self->ctx); /* New ssl struct */ + SSL_set_fd(self->ssl, Sock->sock_fd); /* Set the socket for SSL */ + SSL_set_connect_state(self->ssl); + + if ((SSL_connect(self->ssl)) == -1) { + /* Actually negotiate SSL connection */ + PyErr_SetObject(SSLErrorObject, + PyString_FromString("SSL_connect error")); + PyMem_DEL(self); + return NULL; + } + self->ssl->debug = 1; + + if ((self->server_cert = SSL_get_peer_certificate(self->ssl))) { + X509_NAME_oneline(X509_get_subject_name(self->server_cert), + self->server, 256); + X509_NAME_oneline(X509_get_issuer_name(self->server_cert), + self->issuer, 256); + } + self->x_attr = NULL; + self->Socket = Sock; + Py_INCREF(self->Socket); + return self; + } + + /* This is the Python function called for new object initialization */ + static PyObject * + BUILD_FUNC_DEF_2(PySocket_ssl, PyObject *, self, PyObject *, args) + { + SSLObject *rv; + PySocketSockObject *Sock; + char *key_file; + char *cert_file; + + if (!PyArg_ParseTuple(args, "O!zz", + &PySocketSock_Type, (PyObject*)&Sock, + &key_file, &cert_file) ) + return NULL; + + rv = newSSLObject(Sock, key_file, cert_file); + if ( rv == NULL ) + return NULL; + return (PyObject *)rv; + } + + static char ssl_doc[] = + "ssl(socket, keyfile, certfile) -> sslobject"; + + static PyObject * + BUILD_FUNC_DEF_2(SSL_server, SSLObject *, self, PyObject *, args) + { + return PyString_FromString(self->server); + } + + static PyObject * + BUILD_FUNC_DEF_2(SSL_issuer, SSLObject *, self, PyObject *, args) + { + return PyString_FromString(self->issuer); + } + + + /* SSL object methods */ + + static PyMethodDef SSLMethods[] = { + { "write", (PyCFunction)SSL_SSLwrite, 1 }, + { "read", (PyCFunction)SSL_SSLread, 1 }, + { "server", (PyCFunction)SSL_server, 1 }, + { "issuer", (PyCFunction)SSL_issuer, 1 }, + { NULL, NULL} + }; + + static void SSL_dealloc(SSLObject *self) + { + if (self->server_cert) /* Possible not to have one? */ + X509_free (self->server_cert); + SSL_CTX_free(self->ctx); + SSL_free(self->ssl); + Py_XDECREF(self->x_attr); + Py_XDECREF(self->Socket); + PyMem_DEL(self); + } + + static PyObject *SSL_getattr(SSLObject *self, char *name) + { + return Py_FindMethod(SSLMethods, (PyObject *)self, name); + } + + staticforward PyTypeObject SSL_Type = { + PyObject_HEAD_INIT(&PyType_Type) + 0, /*ob_size*/ + "SSL", /*tp_name*/ + sizeof(SSLObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)SSL_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + (getattrfunc)SSL_getattr, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + }; + + + + static PyObject *SSL_SSLwrite(SSLObject *self, PyObject *args) + { + char *data; + int len = 0; + + if (!PyArg_ParseTuple(args, "s|i", &data, &len)) + return NULL; + + if (!len) + len = strlen(data); + + len = SSL_write(self->ssl, data, len); + return PyInt_FromLong((long)len); + } + + static PyObject *SSL_SSLread(SSLObject *self, PyObject *args) + { + PyObject *buf; + int count = 0; + int len = 1024; + int res; + + PyArg_ParseTuple(args, "|i", &len); + + if (!(buf = PyString_FromStringAndSize((char *) 0, len))) + return NULL; /* Error object should already be set */ + + count = SSL_read(self->ssl, PyString_AsString(buf), len); + res = SSL_get_error(self->ssl, count); + + switch (res) { + case 0: /* Good return value! */ + break; + case 6: + PyErr_SetString(SSLErrorObject, "EOF"); + Py_DECREF(buf); + return NULL; + break; + case 5: + default: + return PyErr_SetFromErrno(SSLErrorObject); + break; + } + + fflush(stderr); + + if (count < 0) { + Py_DECREF(buf); + return PyErr_SetFromErrno(SSLErrorObject); + } + + if (count != len && _PyString_Resize(&buf, count) < 0) + return NULL; + return buf; + } + + #endif /* USE_SSL */ + + /* List of functions exported by this module. */ *************** *** 1894,1897 **** --- 2168,2174 ---- {"inet_aton", PySocket_inet_aton, 0, inet_aton_doc}, {"inet_ntoa", PySocket_inet_ntoa, 0, inet_ntoa_doc}, + #ifdef USE_SSL + {"ssl", PySocket_ssl, 1, ssl_doc}, + #endif /* USE_SSL */ {NULL, NULL} /* Sentinel */ }; *************** *** 1982,1986 **** #endif /* PYOS_OS2 */ - /* Initialize this module. * This is called when the first 'import socket' is done, --- 2259,2262 ---- *************** *** 2020,2023 **** --- 2296,2300 ---- inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format\n\ inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)\n\ + ssl() -- secure socket layer support (only available if configured)\n\ \n\ (*) not available on all platforms!)\n\ *************** *** 2093,2096 **** --- 2370,2385 ---- if (PySocket_Error == NULL) return; + #ifdef USE_SSL + SSL_load_error_strings(); + SSLeay_add_ssl_algorithms(); + SSLErrorObject = PyErr_NewException("socket.sslerror", NULL, NULL); + if (SSLErrorObject == NULL) + return; + PyDict_SetItemString(d, "sslerror", SSLErrorObject); + Py_INCREF(&SSL_Type); + if (PyDict_SetItemString(d, "SSLType", + (PyObject *)&SSL_Type) != 0) + return; + #endif /* USE_SSL */ PyDict_SetItemString(d, "error", PySocket_Error); PySocketSock_Type.ob_type = &PyType_Type; From guido@cnri.reston.va.us Tue Dec 7 21:35:22 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Dec 1999 16:35:22 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib httplib.py,1.12,1.13 Message-ID: <199912072135.QAA25621@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: httplib.py Log Message: OpenSSL support. This is based on patches for a version of SSLeay by Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by Laszlo Kovacs of HP. Both have kindly given permission to include the patches in the Python distribution. Final formatting by GvR. Index: httplib.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/httplib.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** httplib.py 1998/01/19 22:25:24 1.12 --- httplib.py 1999/12/07 21:35:20 1.13 *************** *** 29,43 **** """ import socket import string import mimetools HTTP_VERSION = 'HTTP/1.0' HTTP_PORT = 80 class HTTP: """This class manages a connection to an HTTP server.""" ! ! def __init__(self, host = '', port = 0): """Initialize a new instance. --- 29,74 ---- """ + import os import socket import string import mimetools + try: + from cStringIO import StringIO + except: + from StringIO import StringIO + HTTP_VERSION = 'HTTP/1.0' HTTP_PORT = 80 + HTTPS_PORT = 443 + + class FakeSocket: + def __init__(self, sock, ssl): + self.__sock = sock + self.__ssl = ssl + return + + def makefile(self, mode): # hopefully, never have to write + msgbuf = "" + while 1: + try: + msgbuf = msgbuf + self.__ssl.read() + except socket.sslerror, msg: + break + return StringIO(msgbuf) + + def send(self, stuff, flags = 0): + return self.__ssl.write(stuff) + + def recv(self, len = 1024, flags = 0): + return self.__ssl.read(len) + + def __getattr__(self, attr): + return getattr(self.__sock, attr) class HTTP: """This class manages a connection to an HTTP server.""" ! ! def __init__(self, host = '', port = 0, **x509): """Initialize a new instance. *************** *** 47,54 **** """ self.debuglevel = 0 self.file = None if host: self.connect(host, port) ! def set_debuglevel(self, debuglevel): """Set the debug output level. --- 78,87 ---- """ + self.key_file = x509.get('key_file') + self.cert_file = x509.get('cert_file') self.debuglevel = 0 self.file = None if host: self.connect(host, port) ! def set_debuglevel(self, debuglevel): """Set the debug output level. *************** *** 59,66 **** """ self.debuglevel = debuglevel ! def connect(self, host, port = 0): """Connect to a host on a given port. ! Note: This method is automatically invoked by __init__, if a host is specified during instantiation. --- 92,99 ---- """ self.debuglevel = debuglevel ! def connect(self, host, port = 0): """Connect to a host on a given port. ! Note: This method is automatically invoked by __init__, if a host is specified during instantiation. *************** *** 78,87 **** if self.debuglevel > 0: print 'connect:', (host, port) self.sock.connect(host, port) ! def send(self, str): """Send `str' to the server.""" if self.debuglevel > 0: print 'send:', `str` self.sock.send(str) ! def putrequest(self, request, selector): """Send a request to the server. --- 111,120 ---- if self.debuglevel > 0: print 'connect:', (host, port) self.sock.connect(host, port) ! def send(self, str): """Send `str' to the server.""" if self.debuglevel > 0: print 'send:', `str` self.sock.send(str) ! def putrequest(self, request, selector): """Send a request to the server. *************** *** 95,99 **** str = '%s %s %s\r\n' % (request, selector, HTTP_VERSION) self.send(str) ! def putheader(self, header, *args): """Send a request header line to the server. --- 128,132 ---- str = '%s %s %s\r\n' % (request, selector, HTTP_VERSION) self.send(str) ! def putheader(self, header, *args): """Send a request header line to the server. *************** *** 104,115 **** str = '%s: %s\r\n' % (header, string.joinfields(args,'\r\n\t')) self.send(str) ! def endheaders(self): """Indicate that the last header line has been sent to the server.""" self.send('\r\n') ! def getreply(self): """Get a reply from the server. ! Returns a tuple consisting of: - server response code (e.g. '200' if all goes well) --- 137,148 ---- str = '%s: %s\r\n' % (header, string.joinfields(args,'\r\n\t')) self.send(str) ! def endheaders(self): """Indicate that the last header line has been sent to the server.""" self.send('\r\n') ! def getreply(self): """Get a reply from the server. ! Returns a tuple consisting of: - server response code (e.g. '200' if all goes well) *************** *** 137,141 **** self.headers = mimetools.Message(self.file, 0) return errcode, errmsg, self.headers ! def getfile(self): """Get a file object from which to receive data from the HTTP server. --- 170,174 ---- self.headers = mimetools.Message(self.file, 0) return errcode, errmsg, self.headers ! def getfile(self): """Get a file object from which to receive data from the HTTP server. *************** *** 146,150 **** """ return self.file ! def close(self): """Close the connection to the HTTP server.""" --- 179,183 ---- """ return self.file ! def close(self): """Close the connection to the HTTP server.""" *************** *** 156,159 **** --- 189,217 ---- self.sock = None + if hasattr(socket, "ssl"): + class HTTPS(HTTP): + """This class allows communication via SSL.""" + + def connect(self, host, port = 0): + """Connect to a host on a given port. + + Note: This method is automatically invoked by __init__, + if a host is specified during instantiation. + + """ + if not port: + i = string.find(host, ':') + if i >= 0: + host, port = host[:i], host[i+1:] + try: port = string.atoi(port) + except string.atoi_error: + raise socket.error, "nonnumeric port" + if not port: port = HTTPS_PORT + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + if self.debuglevel > 0: print 'connect:', (host, port) + sock.connect(host, port) + ssl = socket.ssl(sock, self.key_file, self.cert_file) + self.sock = FakeSocket(sock, ssl) + def test(): *************** *** 171,174 **** --- 229,233 ---- for o, a in opts: if o == '-d': dl = dl + 1 + print "testing HTTP..." host = 'www.python.org' selector = '/' *************** *** 188,191 **** --- 247,270 ---- print print h.getfile().read() + if hasattr(socket, "ssl"): + print "-"*40 + print "testing HTTPS..." + host = 'synergy.as.cmu.edu' + selector = '/~geek/' + if args[0:]: host = args[0] + if args[1:]: selector = args[1] + h = HTTPS() + h.set_debuglevel(dl) + h.connect(host) + h.putrequest('GET', selector) + h.endheaders() + errcode, errmsg, headers = h.getreply() + print 'errcode =', errcode + print 'errmsg =', errmsg + print + if headers: + for header in headers.headers: print string.strip(header) + print + print h.getfile().read() From guido@cnri.reston.va.us Tue Dec 7 21:37:20 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Dec 1999 16:37:20 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.88,1.89 Message-ID: <199912072137.QAA25644@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: urllib.py Log Message: OpenSSL support. This is based on patches for a version of SSLeay by Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by Laszlo Kovacs of HP. Both have kindly given permission to include the patches in the Python distribution. Final formatting by GvR. Index: urllib.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/urllib.py,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -r1.88 -r1.89 *** urllib.py 1999/08/18 17:40:33 1.88 --- urllib.py 1999/12/07 21:37:17 1.89 *************** *** 28,32 **** ! __version__ = '1.11' # XXX This version is not always updated :-( MAXFTPCACHE = 10 # Trim the ftp cache beyond this size --- 28,32 ---- ! __version__ = '1.12' # XXX This version is not always updated :-( MAXFTPCACHE = 10 # Trim the ftp cache beyond this size *************** *** 82,90 **** # Constructor ! def __init__(self, proxies=None): if proxies is None: proxies = getproxies() assert hasattr(proxies, 'has_key'), "proxies must be a mapping" self.proxies = proxies server_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-agent', server_version)] --- 82,92 ---- # Constructor ! def __init__(self, proxies=None, **x509): if proxies is None: proxies = getproxies() assert hasattr(proxies, 'has_key'), "proxies must be a mapping" self.proxies = proxies + self.key_file = x509.get('key_file') + self.cert_file = x509.get('cert_file') server_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-agent', server_version)] *************** *** 145,148 **** --- 147,151 ---- url = (host, fullurl) # Signal special case to open_*() name = 'open_' + type + self.type = type if '-' in name: # replace - with _ *************** *** 295,298 **** --- 298,337 ---- raise IOError, ('http error', errcode, errmsg, headers) + # Use HTTPS protocol + if hasattr(socket, "ssl"): + def open_https(self, url): + import httplib + if type(url) is type(""): + host, selector = splithost(url) + user_passwd, host = splituser(host) + else: + host, selector = url + urltype, rest = splittype(selector) + if string.lower(urltype) == 'https': + realhost, rest = splithost(rest) + user_passwd, realhost = splituser(realhost) + if user_passwd: + selector = "%s://%s%s" % (urltype, realhost, rest) + print "proxy via https:", host, selector + if not host: raise IOError, ('https error', 'no host given') + if user_passwd: + import base64 + auth = string.strip(base64.encodestring(user_passwd)) + else: + auth = None + h = httplib.HTTPS(host, 0, + key_file=self.key_file, + cert_file=self.cert_file) + h.putrequest('GET', selector) + if auth: h.putheader('Authorization: Basic %s' % auth) + for args in self.addheaders: apply(h.putheader, args) + h.endheaders() + errcode, errmsg, headers = h.getreply() + fp = h.getfile() + if errcode == 200: + return addinfourl(fp, headers, url) + else: + return self.http_error(url, fp, errcode, errmsg, headers) + # Use Gopher protocol def open_gopher(self, url): *************** *** 478,482 **** scheme, realm = match.groups() if string.lower(scheme) == 'basic': ! return self.retry_http_basic_auth(url, realm, data) def retry_http_basic_auth(self, url, realm, data): --- 517,522 ---- scheme, realm = match.groups() if string.lower(scheme) == 'basic': ! name = 'retry_' + self.type + '_basic_auth' ! return getattr(self,name)(url, realm) def retry_http_basic_auth(self, url, realm, data): *************** *** 489,492 **** --- 529,542 ---- newurl = 'http://' + host + selector return self.open(newurl, data) + + def retry_https_basic_auth(self, url, realm): + host, selector = splithost(url) + i = string.find(host, '@') + 1 + host = host[i:] + user, passwd = self.get_user_passwd(host, realm, i) + if not (user or passwd): return None + host = user + ':' + passwd + '@' + host + newurl = '//' + host + selector + return self.open_https(newurl) def get_user_passwd(self, host, realm, clear_cache = 0): *************** *** 631,636 **** self.read = self.fp.read self.readline = self.fp.readline ! self.readlines = self.fp.readlines ! self.fileno = self.fp.fileno def __repr__(self): return '<%s at %s whose fp = %s>' % (self.__class__.__name__, --- 681,686 ---- self.read = self.fp.read self.readline = self.fp.readline ! if hasattr(self.fp, "readlines"): self.readlines = self.fp.readlines ! if hasattr(self.fp, "fileno"): self.fileno = self.fp.fileno def __repr__(self): return '<%s at %s whose fp = %s>' % (self.__class__.__name__, *************** *** 1016,1019 **** --- 1066,1071 ---- 'http://www.python.org/index.html', ] + if hasattr(URLopener, "open_https"): + args.append('https://synergy.as.cmu.edu/~geek/') try: for url in args: From guido@cnri.reston.va.us Tue Dec 7 21:47:12 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Dec 1999 16:47:12 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules Setup.in,1.88,1.89 Message-ID: <199912072147.QAA25724@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/projects/python/develop/guido/src/Modules Modified Files: Setup.in Log Message: OpenSSL support. This is based on patches for a version of SSLeay by Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by Laszlo Kovacs of HP. Both have kindly given permission to include the patches in the Python distribution. Final formatting by GvR. Index: Setup.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/Setup.in,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -r1.88 -r1.89 *** Setup.in 1999/03/24 19:03:56 1.88 --- Setup.in 1999/12/07 21:47:09 1.89 *************** *** 146,153 **** pwd pwdmodule.c # pwd(3) grp grpmodule.c # grp(3) select selectmodule.c # select(2); not on ancient System V socket socketmodule.c # socket(2); not on ancient System V #_socket socketmodule.c # socket(2); use this one for BeOS sockets ! errno errnomodule.c # posix (UNIX) errno values # The crypt module is now disabled by default because it breaks builds --- 146,159 ---- pwd pwdmodule.c # pwd(3) grp grpmodule.c # grp(3) + errno errnomodule.c # posix (UNIX) errno values select selectmodule.c # select(2); not on ancient System V socket socketmodule.c # socket(2); not on ancient System V #_socket socketmodule.c # socket(2); use this one for BeOS sockets ! ! # Socket module compiled with SSL support; you must edit the SSL variable: ! #SSL=/usr/local/ssl ! #socket socketmodule.c \ ! # -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ ! # -L$(SSL)/lib -lssl -lcrypto # The crypt module is now disabled by default because it breaks builds From fdrake@weyr.cnri.reston.va.us Thu Dec 9 21:13:10 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 9 Dec 1999 16:13:10 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.115,2.116 Message-ID: <199912092113.QAA22913@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Added support for abort(), ctermid(), tmpfile(), tempnam(), tmpnam(), and TMP_MAX. Converted all functions that used PyArg_Parse() or PyArg_NoArgs() to use PyArg_ParseTuple() and specified all function names using the :name syntax in the format strings, to allow better error messages when TypeError is raised for parameter type mismatches. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.115 retrieving revision 2.116 diff -u -C2 -r2.115 -r2.116 *** posixmodule.c 1999/10/19 13:29:23 2.115 --- posixmodule.c 1999/12/09 21:13:07 2.116 *************** *** 432,442 **** static PyObject * ! posix_int(args, func) PyObject *args; int (*func) Py_FPROTO((int)); { int fd; int res; ! if (!PyArg_Parse(args, "i", &fd)) return NULL; [...1720 lines suppressed...] #endif + #ifdef HAVE_TEMPNAM + {"tempnam", posix_tempnam, METH_VARARGS, posix_tempnam__doc__}, + #endif + #ifdef HAVE_TMPNAM + {"tmpnam", posix_tmpnam, METH_VARARGS, posix_tmpnam__doc__}, + #endif + {"abort", posix_abort, METH_VARARGS, posix_abort__doc__}, {NULL, NULL} /* Sentinel */ }; *************** *** 3426,3429 **** --- 3586,3592 ---- if (ins(d, "X_OK", (long)X_OK)) return -1; #endif + #ifdef TMP_MAX + if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1; + #endif #ifdef WNOHANG if (ins(d, "WNOHANG", (long)WNOHANG)) return -1; From fdrake@weyr.cnri.reston.va.us Thu Dec 9 22:03:29 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 9 Dec 1999 17:03:29 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src configure,1.100,1.101 configure.in,1.108,1.109 config.h.in,2.45,2.46 Message-ID: <199912092203.RAA23412@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory weyr:/home/fdrake/projects/python Modified Files: configure configure.in config.h.in Log Message: Added support for ctermid, tempnam, tmpfile, tmpnam, and tmpnam_r. Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.100 retrieving revision 1.101 diff -u -C2 -r1.100 -r1.101 *** configure 1999/11/16 15:57:37 1.100 --- configure 1999/12/09 22:03:25 1.101 *************** *** 3190,3194 **** # checks for library functions ! for ac_func in alarm chown clock dlopen execv flock fork \ fsync fdatasync ftime ftruncate \ getpeername getpgrp getpid getpwent gettimeofday getwd \ --- 3190,3194 ---- # checks for library functions ! for ac_func in alarm chown clock ctermid ctermid_r dlopen execv flock fork \ fsync fdatasync ftime ftruncate \ [...1190 lines suppressed...] #include --- 4640,4644 ---- else cat > conftest.$ac_ext < *************** *** 4658,4662 **** } EOF ! if { (eval echo configure:4661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull --- 4659,4663 ---- } EOF ! if { (eval echo configure:4662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.108 retrieving revision 1.109 diff -u -C2 -r1.108 -r1.109 *** configure.in 1999/11/16 15:57:37 1.108 --- configure.in 1999/12/09 22:03:25 1.109 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.108 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.109 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 680,684 **** # checks for library functions ! AC_CHECK_FUNCS(alarm chown clock dlopen execv flock fork \ fsync fdatasync ftime ftruncate \ getpeername getpgrp getpid getpwent gettimeofday getwd \ --- 680,684 ---- # checks for library functions ! AC_CHECK_FUNCS(alarm chown clock ctermid ctermid_r dlopen execv flock fork \ fsync fdatasync ftime ftruncate \ getpeername getpgrp getpid getpwent gettimeofday getwd \ *************** *** 686,690 **** select setgid setlocale setuid setsid setpgid setpgrp setvbuf \ sigaction siginterrupt sigrelse strftime strptime symlink \ ! tcgetpgrp tcsetpgrp timegm times truncate uname waitpid) # check for long file support functions --- 686,691 ---- select setgid setlocale setuid setsid setpgid setpgrp setvbuf \ sigaction siginterrupt sigrelse strftime strptime symlink \ ! tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ ! truncate uname waitpid) # check for long file support functions Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.45 retrieving revision 2.46 diff -u -C2 -r2.45 -r2.46 *** config.h.in 1999/11/16 15:55:56 2.45 --- config.h.in 1999/12/09 22:03:25 2.46 *************** *** 216,219 **** --- 216,225 ---- #undef HAVE_CLOCK + /* Define if you have the ctermid function. */ + #undef HAVE_CTERMID + + /* Define if you have the ctermid_r function. */ + #undef HAVE_CTERMID_R + /* Define if you have the dlopen function. */ #undef HAVE_DLOPEN *************** *** 375,378 **** --- 381,387 ---- #undef HAVE_TCSETPGRP + /* Define if you have the tempnam function. */ + #undef HAVE_TEMPNAM + /* Define if you have the timegm function. */ #undef HAVE_TIMEGM *************** *** 380,383 **** --- 389,401 ---- /* Define if you have the times function. */ #undef HAVE_TIMES + + /* Define if you have the tmpfile function. */ + #undef HAVE_TMPFILE + + /* Define if you have the tmpnam function. */ + #undef HAVE_TMPNAM + + /* Define if you have the tmpnam_r function. */ + #undef HAVE_TMPNAM_R /* Define if you have the truncate function. */ From fdrake@weyr.cnri.reston.va.us Thu Dec 9 22:11:46 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 9 Dec 1999 17:11:46 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libos.tex Message-ID: <199912092211.RAA23643@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libos.tex Log Message: Document the new stuff in the os module. From guido@cnri.reston.va.us Fri Dec 10 15:12:13 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Dec 1999 10:12:13 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules almodule.c,1.21,1.22 Message-ID: <199912101512.KAA09516@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/projects/python/develop/guido/src/Modules Modified Files: almodule.c Log Message: The call to PyArg_ParseTuple in al_Connect had one too few arguments. This fixes PR#157. Index: almodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/almodule.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** almodule.c 1998/08/31 14:14:09 1.21 --- almodule.c 1999/12/10 15:12:11 1.22 *************** *** 1546,1550 **** PyObject *propobj = NULL; ! if (!PyArg_ParseTuple(args, "ii|O!", &source, &dest, &propobj)) return NULL; if (propobj != NULL) { --- 1546,1550 ---- PyObject *propobj = NULL; ! if (!PyArg_ParseTuple(args, "ii|O!", &source, &dest, &PyList_Type, &propobj)) return NULL; if (propobj != NULL) { From fdrake@weyr.cnri.reston.va.us Mon Dec 13 16:23:38 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 13 Dec 1999 11:23:38 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src config.h.in,2.46,2.47 configure.in,1.109,1.110 configure,1.101,1.102 Message-ID: <199912131623.LAA17249@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory weyr:/home/fdrake/projects/python Modified Files: config.h.in configure.in configure Log Message: Added detection for getgroups(), fpathconf(), pathconf(), confstr(), and sysconf(). Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.46 retrieving revision 2.47 diff -C2 -r2.46 -r2.47 *** config.h.in 1999/12/09 22:03:25 2.46 --- config.h.in 1999/12/13 16:23:34 2.47 *************** *** 270,273 **** --- 270,276 ---- #undef HAVE_GETPEERNAME + /* Define if you have the getgroups function. */ + #undef HAVE_GETGROUPS + /* Define if you have the getpgrp function. */ #undef HAVE_GETPGRP *************** *** 284,287 **** --- 287,302 ---- /* Define if you have the getwd function. */ #undef HAVE_GETWD + + /* Define if you have the fpathconf function. */ + #undef HAVE_FPATHCONF + + /* Define if you have the pathconf function. */ + #undef HAVE_PATHCONF + + /* Define if you have the confstr function. */ + #undef HAVE_CONFSTR + + /* Define if you have the sysconf function. */ + #undef HAVE_SYSCONF /* Define if you have the hypot function. */ Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -r1.109 -r1.110 *** configure.in 1999/12/09 22:03:25 1.109 --- configure.in 1999/12/13 16:23:34 1.110 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.109 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.110 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 680,689 **** # checks for library functions ! AC_CHECK_FUNCS(alarm chown clock ctermid ctermid_r dlopen execv flock fork \ ! fsync fdatasync ftime ftruncate \ ! getpeername getpgrp getpid getpwent gettimeofday getwd \ ! kill link lstat mkfifo mktime nice pause plock pthread_init putenv readlink \ select setgid setlocale setuid setsid setpgid setpgrp setvbuf \ ! sigaction siginterrupt sigrelse strftime strptime symlink \ tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname waitpid) --- 680,690 ---- # checks for library functions ! AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \ ! flock fork fsync fdatasync fpathconf ftime ftruncate \ ! getgroups getpeername getpgrp getpid getpwent gettimeofday getwd \ ! kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \ ! putenv readlink \ select setgid setlocale setuid setsid setpgid setpgrp setvbuf \ ! sigaction siginterrupt sigrelse strftime strptime symlink sysconf \ tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname waitpid) Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -r1.101 -r1.102 *** configure 1999/12/09 22:03:25 1.101 --- configure 1999/12/13 16:23:35 1.102 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.108 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.109 [...1204 lines suppressed...] #include --- 4641,4645 ---- else cat > conftest.$ac_ext < *************** *** 4659,4663 **** } EOF ! if { (eval echo configure:4662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull --- 4660,4664 ---- } EOF ! if { (eval echo configure:4663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull From fdrake@weyr.cnri.reston.va.us Mon Dec 13 16:37:28 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 13 Dec 1999 11:37:28 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.116,2.117 Message-ID: <199912131637.LAA17318@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Added bindings for getgroups(), fpathconf(), pathconf(), confstr(), and sysconf(). *Lots* of tables to define names used by *conf*(); explanation to go in message to python-dev list. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.116 retrieving revision 2.117 diff -C2 -r2.116 -r2.117 *** posixmodule.c 1999/12/09 21:13:07 2.116 --- posixmodule.c 1999/12/13 16:37:25 2.117 *************** *** 1723,1726 **** --- 1723,1772 ---- + #ifdef HAVE_GETGROUPS + static char posix_getgroups__doc__[] = "\ + getgroups() -> list of group IDs\n\ + Return list of supplemental group IDs for the process."; + + static PyObject * + posix_getgroups(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + + if (PyArg_ParseTuple(args, ":getgroups")) { + #ifdef NGROUPS_MAX + #define MAX_GROUPS NGROUPS_MAX + #else + /* defined to be 16 on Solaris7, so this should be a small number */ + #define MAX_GROUPS 64 + #endif + gid_t grouplist[MAX_GROUPS]; + int n; + + n = getgroups(MAX_GROUPS, grouplist); + if (n < 0) + posix_error(); + else { + result = PyList_New(n); + if (result != NULL) { + PyObject *o; + int i; + for (i = 0; i < n; ++i) { + o = PyInt_FromLong((long)grouplist[i]); + if (o == NULL) { + Py_DECREF(result); + result = NULL; + break; + } + PyList_SET_ITEM(result, i, o); + } + } + } + } + return result; + } + #endif + #ifdef HAVE_GETPGRP static char posix_getpgrp__doc__[] = *************** *** 3294,3297 **** --- 3340,4141 ---- + /* This is used for fpathconf(), pathconf(), confstr() and sysconf(). + * It maps strings representing configuration variable names to + * integer values, allowing those functions to be called with the + * magic names instead of poluting the module's namespace with tons of + * rarely-used constants. + */ + struct constdef { + char *name; + long value; + }; + + static struct constdef posix_constants_pathconf[] = { + #ifdef _PC_ASYNC_IO + {"PC_ASYNC_IO", _PC_ASYNC_IO}, + #endif + #ifdef _PC_CHOWN_RESTRICTED + {"PC_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED}, + #endif + #ifdef _PC_FILESIZEBITS + {"PC_FILESIZEBITS", _PC_FILESIZEBITS}, + #endif + #ifdef _PC_LAST + {"PC_LAST", _PC_LAST}, + #endif + #ifdef _PC_LINK_MAX + {"PC_LINK_MAX", _PC_LINK_MAX}, + #endif + #ifdef _PC_MAX_CANON + {"PC_MAX_CANON", _PC_MAX_CANON}, + #endif + #ifdef _PC_MAX_INPUT + {"PC_MAX_INPUT", _PC_MAX_INPUT}, + #endif + #ifdef _PC_NAME_MAX + {"PC_NAME_MAX", _PC_NAME_MAX}, + #endif + #ifdef _PC_NO_TRUNC + {"PC_NO_TRUNC", _PC_NO_TRUNC}, + #endif + #ifdef _PC_PATH_MAX + {"PC_PATH_MAX", _PC_PATH_MAX}, + #endif + #ifdef _PC_PIPE_BUF + {"PC_PIPE_BUF", _PC_PIPE_BUF}, + #endif + #ifdef _PC_PRIO_IO + {"PC_PRIO_IO", _PC_PRIO_IO}, + #endif + #ifdef _PC_SOCK_MAXBUF + {"PC_SOCK_MAXBUF", _PC_SOCK_MAXBUF}, + #endif + #ifdef _PC_SYNC_IO + {"PC_SYNC_IO", _PC_SYNC_IO}, + #endif + #ifdef _PC_VDISABLE + {"PC_VDISABLE", _PC_VDISABLE}, + #endif + }; + + + static int + conv_confname(arg, valuep, table, tablesize) + PyObject *arg; + int *valuep; + struct constdef *table; + size_t tablesize; + { + if (PyInt_Check(arg)) { + *valuep = PyInt_AS_LONG(arg); + return 1; + } + if (PyString_Check(arg)) { + /* look up the value in the table using a binary search */ + int lo = 0; + int hi = tablesize; + int cmp, mid; + char *confname = PyString_AS_STRING(arg); + printf("table: %d entries\n", tablesize); + while (lo < hi) { + mid = (lo + hi) / 2; + printf("%d confname='%s'; other='%s';\n", + mid, confname, table[mid].name); + cmp = strcmp(confname, table[mid].name); + if (cmp < 0) + hi = mid; + else if (cmp > 0) + lo = mid + 1; + else { + *valuep = table[mid].value; + return 1; + } + } + PyErr_SetString(PyExc_ValueError, "unrecognized configuration name"); + } + else + PyErr_SetString(PyExc_TypeError, + "configuration names must be strings or integers"); + return 0; + } + + + #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) + static int + conv_path_confname(arg, valuep) + PyObject *arg; + int *valuep; + { + return conv_confname(arg, valuep, posix_constants_pathconf, + sizeof(posix_constants_pathconf) + / sizeof(struct constdef)); + } + #endif + + #ifdef HAVE_FPATHCONF + static char posix_fpathconf__doc__[] = "\ + fpathconf(fd, name) -> integer\n\ + Return the configuration limit name for the file descriptor fd.\n\ + If there is no limit, return -1."; + + static PyObject * + posix_fpathconf(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + int name, fd; + + if (PyArg_ParseTuple(args, "iO&:fpathconf", &fd, conv_confname, &name)) { + long limit; + + errno = 0; + limit = fpathconf(fd, name); + if (limit == -1 && errno != 0) + posix_error(); + else + result = PyInt_FromLong(limit); + } + return result; + } + #endif + + + #ifdef HAVE_PATHCONF + static char posix_pathconf__doc__[] = "\ + pathconf(path, name) -> integer\n\ + Return the configuration limit name for the file or directory path.\n\ + If there is no limit, return -1."; + + static PyObject * + posix_pathconf(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + int name; + char *path; + + if (PyArg_ParseTuple(args, "sO&:pathconf", &path, + conv_path_confname, &name)) { + long limit; + + errno = 0; + limit = pathconf(path, name); + if (limit == -1 && errno != 0) + if (errno == EINVAL) + /* could be a path or name problem */ + posix_error(); + else + posix_error_with_filename(path); + else + result = PyInt_FromLong(limit); + } + return result; + } + #endif + + #ifdef HAVE_CONFSTR + static struct constdef posix_constants_confstr[] = { + #ifdef _CS_LFS64_CFLAGS + {"CS_LFS64_CFLAGS", _CS_LFS64_CFLAGS}, + #endif + #ifdef _CS_LFS64_LDFLAGS + {"CS_LFS64_LDFLAGS", _CS_LFS64_LDFLAGS}, + #endif + #ifdef _CS_LFS64_LIBS + {"CS_LFS64_LIBS", _CS_LFS64_LIBS}, + #endif + #ifdef _CS_LFS64_LINTFLAGS + {"CS_LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS}, + #endif + #ifdef _CS_LFS_CFLAGS + {"CS_LFS_CFLAGS", _CS_LFS_CFLAGS}, + #endif + #ifdef _CS_LFS_LDFLAGS + {"CS_LFS_LDFLAGS", _CS_LFS_LDFLAGS}, + #endif + #ifdef _CS_LFS_LIBS + {"CS_LFS_LIBS", _CS_LFS_LIBS}, + #endif + #ifdef _CS_LFS_LINTFLAGS + {"CS_LFS_LINTFLAGS", _CS_LFS_LINTFLAGS}, + #endif + #ifdef _CS_PATH + {"CS_PATH", _CS_PATH}, + #endif + #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS + {"CS_XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS}, + #endif + #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS + {"CS_XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS}, + #endif + #ifdef _CS_XBS5_ILP32_OFF32_LIBS + {"CS_XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS}, + #endif + #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS + {"CS_XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS}, + #endif + #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS + {"CS_XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS}, + #endif + #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS + {"CS_XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS}, + #endif + #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS + {"CS_XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS}, + #endif + #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS + {"CS_XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS}, + #endif + #ifdef _CS_XBS5_LP64_OFF64_CFLAGS + {"CS_XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS}, + #endif + #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS + {"CS_XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS}, + #endif + #ifdef _CS_XBS5_LP64_OFF64_LIBS + {"CS_XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS}, + #endif + #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS + {"CS_XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS}, + #endif + #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS + {"CS_XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS}, + #endif + #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS + {"CS_XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS}, + #endif + #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS + {"CS_XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS}, + #endif + #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS + {"CS_XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS}, + #endif + }; + + static int + conv_confstr_confname(arg, valuep) + PyObject *arg; + int *valuep; + { + return conv_confname(arg, valuep, posix_constants_confstr, + sizeof(posix_constants_confstr) + / sizeof(struct constdef)); + } + + static char posix_confstr__doc__[] = "\ + confstr(name) -> string\n\ + Return a string-valued system configuration variable."; + + static PyObject * + posix_confstr(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + int name; + char buffer[64]; + + if (PyArg_ParseTuple(args, "O&:confstr", conv_confstr_confname, &name)) { + int len = confstr(name, buffer, sizeof(buffer)); + + printf("confstr(%d) --> %d, '%s'\n", name, len, buffer); + errno = 0; + if (len == 0) { + if (errno != 0) + posix_error(); + else + result = PyString_FromString(""); + } + else { + if (len >= sizeof(buffer)) { + result = PyString_FromStringAndSize(NULL, len); + if (result != NULL) + confstr(name, PyString_AS_STRING(result), len+1); + } + else + result = PyString_FromString(buffer); + } + } + return result; + } + #endif + + + #ifdef HAVE_SYSCONF + static struct constdef posix_constants_sysconf[] = { + #ifdef _SC_2_CHAR_TERM + {"SC_2_CHAR_TERM", _SC_2_CHAR_TERM}, + #endif + #ifdef _SC_2_C_BIND + {"SC_2_C_BIND", _SC_2_C_BIND}, + #endif + #ifdef _SC_2_C_DEV + {"SC_2_C_DEV", _SC_2_C_DEV}, + #endif + #ifdef _SC_2_C_VERSION + {"SC_2_C_VERSION", _SC_2_C_VERSION}, + #endif + #ifdef _SC_2_FORT_DEV + {"SC_2_FORT_DEV", _SC_2_FORT_DEV}, + #endif + #ifdef _SC_2_FORT_RUN + {"SC_2_FORT_RUN", _SC_2_FORT_RUN}, + #endif + #ifdef _SC_2_LOCALEDEF + {"SC_2_LOCALEDEF", _SC_2_LOCALEDEF}, + #endif + #ifdef _SC_2_SW_DEV + {"SC_2_SW_DEV", _SC_2_SW_DEV}, + #endif + #ifdef _SC_2_UPE + {"SC_2_UPE", _SC_2_UPE}, + #endif + #ifdef _SC_2_VERSION + {"SC_2_VERSION", _SC_2_VERSION}, + #endif + #ifdef _SC_AIO_LISTIO_MAX + {"SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX}, + #endif + #ifdef _SC_AIO_LIST_MAX + {"SC_AIO_LIST_MAX", _SC_AIO_LIST_MAX}, + #endif + #ifdef _SC_AIO_MAX + {"SC_AIO_MAX", _SC_AIO_MAX}, + #endif + #ifdef _SC_AIO_PRIO_DELTA_MAX + {"SC_AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX}, + #endif + #ifdef _SC_ARG_MAX + {"SC_ARG_MAX", _SC_ARG_MAX}, + #endif + #ifdef _SC_ASYNCHRONOUS_IO + {"SC_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO}, + #endif + #ifdef _SC_ATEXIT_MAX + {"SC_ATEXIT_MAX", _SC_ATEXIT_MAX}, + #endif + #ifdef _SC_AVPHYS_PAGES + {"SC_AVPHYS_PAGES", _SC_AVPHYS_PAGES}, + #endif + #ifdef _SC_BC_BASE_MAX + {"SC_BC_BASE_MAX", _SC_BC_BASE_MAX}, + #endif + #ifdef _SC_BC_DIM_MAX + {"SC_BC_DIM_MAX", _SC_BC_DIM_MAX}, + #endif + #ifdef _SC_BC_SCALE_MAX + {"SC_BC_SCALE_MAX", _SC_BC_SCALE_MAX}, + #endif + #ifdef _SC_BC_STRING_MAX + {"SC_BC_STRING_MAX", _SC_BC_STRING_MAX}, + #endif + #ifdef _SC_CHARCLASS_NAME_MAX + {"SC_CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX}, + #endif + #ifdef _SC_CHAR_BIT + {"SC_CHAR_BIT", _SC_CHAR_BIT}, + #endif + #ifdef _SC_CHAR_MAX + {"SC_CHAR_MAX", _SC_CHAR_MAX}, + #endif + #ifdef _SC_CHAR_MIN + {"SC_CHAR_MIN", _SC_CHAR_MIN}, + #endif + #ifdef _SC_CHILD_MAX + {"SC_CHILD_MAX", _SC_CHILD_MAX}, + #endif + #ifdef _SC_CLK_TCK + {"SC_CLK_TCK", _SC_CLK_TCK}, + #endif + #ifdef _SC_COHER_BLKSZ + {"SC_COHER_BLKSZ", _SC_COHER_BLKSZ}, + #endif + #ifdef _SC_COLL_WEIGHTS_MAX + {"SC_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX}, + #endif + #ifdef _SC_DCACHE_ASSOC + {"SC_DCACHE_ASSOC", _SC_DCACHE_ASSOC}, + #endif + #ifdef _SC_DCACHE_BLKSZ + {"SC_DCACHE_BLKSZ", _SC_DCACHE_BLKSZ}, + #endif + #ifdef _SC_DCACHE_LINESZ + {"SC_DCACHE_LINESZ", _SC_DCACHE_LINESZ}, + #endif + #ifdef _SC_DCACHE_SZ + {"SC_DCACHE_SZ", _SC_DCACHE_SZ}, + #endif + #ifdef _SC_DCACHE_TBLKSZ + {"SC_DCACHE_TBLKSZ", _SC_DCACHE_TBLKSZ}, + #endif + #ifdef _SC_DELAYTIMER_MAX + {"SC_DELAYTIMER_MAX", _SC_DELAYTIMER_MAX}, + #endif + #ifdef _SC_EQUIV_CLASS_MAX + {"SC_EQUIV_CLASS_MAX", _SC_EQUIV_CLASS_MAX}, + #endif + #ifdef _SC_EXPR_NEST_MAX + {"SC_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX}, + #endif + #ifdef _SC_FSYNC + {"SC_FSYNC", _SC_FSYNC}, + #endif + #ifdef _SC_GETGR_R_SIZE_MAX + {"SC_GETGR_R_SIZE_MAX", _SC_GETGR_R_SIZE_MAX}, + #endif + #ifdef _SC_GETPW_R_SIZE_MAX + {"SC_GETPW_R_SIZE_MAX", _SC_GETPW_R_SIZE_MAX}, + #endif + #ifdef _SC_ICACHE_ASSOC + {"SC_ICACHE_ASSOC", _SC_ICACHE_ASSOC}, + #endif + #ifdef _SC_ICACHE_BLKSZ + {"SC_ICACHE_BLKSZ", _SC_ICACHE_BLKSZ}, + #endif + #ifdef _SC_ICACHE_LINESZ + {"SC_ICACHE_LINESZ", _SC_ICACHE_LINESZ}, + #endif + #ifdef _SC_ICACHE_SZ + {"SC_ICACHE_SZ", _SC_ICACHE_SZ}, + #endif + #ifdef _SC_INT_MAX + {"SC_INT_MAX", _SC_INT_MAX}, + #endif + #ifdef _SC_INT_MIN + {"SC_INT_MIN", _SC_INT_MIN}, + #endif + #ifdef _SC_IOV_MAX + {"SC_IOV_MAX", _SC_IOV_MAX}, + #endif + #ifdef _SC_JOB_CONTROL + {"SC_JOB_CONTROL", _SC_JOB_CONTROL}, + #endif + #ifdef _SC_LINE_MAX + {"SC_LINE_MAX", _SC_LINE_MAX}, + #endif + #ifdef _SC_LOGIN_NAME_MAX + {"SC_LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX}, + #endif + #ifdef _SC_LOGNAME_MAX + {"SC_LOGNAME_MAX", _SC_LOGNAME_MAX}, + #endif + #ifdef _SC_LONG_BIT + {"SC_LONG_BIT", _SC_LONG_BIT}, + #endif + #ifdef _SC_MAPPED_FILES + {"SC_MAPPED_FILES", _SC_MAPPED_FILES}, + #endif + #ifdef _SC_MAXPID + {"SC_MAXPID", _SC_MAXPID}, + #endif + #ifdef _SC_MB_LEN_MAX + {"SC_MB_LEN_MAX", _SC_MB_LEN_MAX}, + #endif + #ifdef _SC_MEMLOCK + {"SC_MEMLOCK", _SC_MEMLOCK}, + #endif + #ifdef _SC_MEMLOCK_RANGE + {"SC_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE}, + #endif + #ifdef _SC_MEMORY_PROTECTION + {"SC_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION}, + #endif + #ifdef _SC_MESSAGE_PASSING + {"SC_MESSAGE_PASSING", _SC_MESSAGE_PASSING}, + #endif + #ifdef _SC_MQ_OPEN_MAX + {"SC_MQ_OPEN_MAX", _SC_MQ_OPEN_MAX}, + #endif + #ifdef _SC_MQ_PRIO_MAX + {"SC_MQ_PRIO_MAX", _SC_MQ_PRIO_MAX}, + #endif + #ifdef _SC_NGROUPS_MAX + {"SC_NGROUPS_MAX", _SC_NGROUPS_MAX}, + #endif + #ifdef _SC_NL_ARGMAX + {"SC_NL_ARGMAX", _SC_NL_ARGMAX}, + #endif + #ifdef _SC_NL_LANGMAX + {"SC_NL_LANGMAX", _SC_NL_LANGMAX}, + #endif + #ifdef _SC_NL_MSGMAX + {"SC_NL_MSGMAX", _SC_NL_MSGMAX}, + #endif + #ifdef _SC_NL_NMAX + {"SC_NL_NMAX", _SC_NL_NMAX}, + #endif + #ifdef _SC_NL_SETMAX + {"SC_NL_SETMAX", _SC_NL_SETMAX}, + #endif + #ifdef _SC_NL_TEXTMAX + {"SC_NL_TEXTMAX", _SC_NL_TEXTMAX}, + #endif + #ifdef _SC_NPROCESSORS_CONF + {"SC_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF}, + #endif + #ifdef _SC_NPROCESSORS_ONLN + {"SC_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN}, + #endif + #ifdef _SC_NZERO + {"SC_NZERO", _SC_NZERO}, + #endif + #ifdef _SC_OPEN_MAX + {"SC_OPEN_MAX", _SC_OPEN_MAX}, + #endif + #ifdef _SC_PAGESIZE + {"SC_PAGESIZE", _SC_PAGESIZE}, + #endif + #ifdef _SC_PAGE_SIZE + {"SC_PAGE_SIZE", _SC_PAGE_SIZE}, + #endif + #ifdef _SC_PASS_MAX + {"SC_PASS_MAX", _SC_PASS_MAX}, + #endif + #ifdef _SC_PHYS_PAGES + {"SC_PHYS_PAGES", _SC_PHYS_PAGES}, + #endif + #ifdef _SC_PII + {"SC_PII", _SC_PII}, + #endif + #ifdef _SC_PII_INTERNET + {"SC_PII_INTERNET", _SC_PII_INTERNET}, + #endif + #ifdef _SC_PII_INTERNET_DGRAM + {"SC_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM}, + #endif + #ifdef _SC_PII_INTERNET_STREAM + {"SC_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM}, + #endif + #ifdef _SC_PII_OSI + {"SC_PII_OSI", _SC_PII_OSI}, + #endif + #ifdef _SC_PII_OSI_CLTS + {"SC_PII_OSI_CLTS", _SC_PII_OSI_CLTS}, + #endif + #ifdef _SC_PII_OSI_COTS + {"SC_PII_OSI_COTS", _SC_PII_OSI_COTS}, + #endif + #ifdef _SC_PII_OSI_M + {"SC_PII_OSI_M", _SC_PII_OSI_M}, + #endif + #ifdef _SC_PII_SOCKET + {"SC_PII_SOCKET", _SC_PII_SOCKET}, + #endif + #ifdef _SC_PII_XTI + {"SC_PII_XTI", _SC_PII_XTI}, + #endif + #ifdef _SC_POLL + {"SC_POLL", _SC_POLL}, + #endif + #ifdef _SC_PRIORITIZED_IO + {"SC_PRIORITIZED_IO", _SC_PRIORITIZED_IO}, + #endif + #ifdef _SC_PRIORITY_SCHEDULING + {"SC_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING}, + #endif + #ifdef _SC_REALTIME_SIGNALS + {"SC_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS}, + #endif + #ifdef _SC_RE_DUP_MAX + {"SC_RE_DUP_MAX", _SC_RE_DUP_MAX}, + #endif + #ifdef _SC_RTSIG_MAX + {"SC_RTSIG_MAX", _SC_RTSIG_MAX}, + #endif + #ifdef _SC_SAVED_IDS + {"SC_SAVED_IDS", _SC_SAVED_IDS}, + #endif + #ifdef _SC_SCHAR_MAX + {"SC_SCHAR_MAX", _SC_SCHAR_MAX}, + #endif + #ifdef _SC_SCHAR_MIN + {"SC_SCHAR_MIN", _SC_SCHAR_MIN}, + #endif + #ifdef _SC_SELECT + {"SC_SELECT", _SC_SELECT}, + #endif + #ifdef _SC_SEMAPHORES + {"SC_SEMAPHORES", _SC_SEMAPHORES}, + #endif + #ifdef _SC_SEM_NSEMS_MAX + {"SC_SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX}, + #endif + #ifdef _SC_SEM_VALUE_MAX + {"SC_SEM_VALUE_MAX", _SC_SEM_VALUE_MAX}, + #endif + #ifdef _SC_SHARED_MEMORY_OBJECTS + {"SC_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS}, + #endif + #ifdef _SC_SHRT_MAX + {"SC_SHRT_MAX", _SC_SHRT_MAX}, + #endif + #ifdef _SC_SHRT_MIN + {"SC_SHRT_MIN", _SC_SHRT_MIN}, + #endif + #ifdef _SC_SIGQUEUE_MAX + {"SC_SIGQUEUE_MAX", _SC_SIGQUEUE_MAX}, + #endif + #ifdef _SC_SIGRT_MAX + {"SC_SIGRT_MAX", _SC_SIGRT_MAX}, + #endif + #ifdef _SC_SIGRT_MIN + {"SC_SIGRT_MIN", _SC_SIGRT_MIN}, + #endif + #ifdef _SC_SPLIT_CACHE + {"SC_SPLIT_CACHE", _SC_SPLIT_CACHE}, + #endif + #ifdef _SC_SSIZE_MAX + {"SC_SSIZE_MAX", _SC_SSIZE_MAX}, + #endif + #ifdef _SC_STACK_PROT + {"SC_STACK_PROT", _SC_STACK_PROT}, + #endif + #ifdef _SC_STREAM_MAX + {"SC_STREAM_MAX", _SC_STREAM_MAX}, + #endif + #ifdef _SC_SYNCHRONIZED_IO + {"SC_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO}, + #endif + #ifdef _SC_THREADS + {"SC_THREADS", _SC_THREADS}, + #endif + #ifdef _SC_THREAD_ATTR_STACKADDR + {"SC_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR}, + #endif + #ifdef _SC_THREAD_ATTR_STACKSIZE + {"SC_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE}, + #endif + #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS + {"SC_THREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS}, + #endif + #ifdef _SC_THREAD_KEYS_MAX + {"SC_THREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX}, + #endif + #ifdef _SC_THREAD_PRIORITY_SCHEDULING + {"SC_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING}, + #endif + #ifdef _SC_THREAD_PRIO_INHERIT + {"SC_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT}, + #endif + #ifdef _SC_THREAD_PRIO_PROTECT + {"SC_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT}, + #endif + #ifdef _SC_THREAD_PROCESS_SHARED + {"SC_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED}, + #endif + #ifdef _SC_THREAD_SAFE_FUNCTIONS + {"SC_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS}, + #endif + #ifdef _SC_THREAD_STACK_MIN + {"SC_THREAD_STACK_MIN", _SC_THREAD_STACK_MIN}, + #endif + #ifdef _SC_THREAD_THREADS_MAX + {"SC_THREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX}, + #endif + #ifdef _SC_TIMERS + {"SC_TIMERS", _SC_TIMERS}, + #endif + #ifdef _SC_TIMER_MAX + {"SC_TIMER_MAX", _SC_TIMER_MAX}, + #endif + #ifdef _SC_TTY_NAME_MAX + {"SC_TTY_NAME_MAX", _SC_TTY_NAME_MAX}, + #endif + #ifdef _SC_TZNAME_MAX + {"SC_TZNAME_MAX", _SC_TZNAME_MAX}, + #endif + #ifdef _SC_T_IOV_MAX + {"SC_T_IOV_MAX", _SC_T_IOV_MAX}, + #endif + #ifdef _SC_UCHAR_MAX + {"SC_UCHAR_MAX", _SC_UCHAR_MAX}, + #endif + #ifdef _SC_UINT_MAX + {"SC_UINT_MAX", _SC_UINT_MAX}, + #endif + #ifdef _SC_UIO_MAXIOV + {"SC_UIO_MAXIOV", _SC_UIO_MAXIOV}, + #endif + #ifdef _SC_ULONG_MAX + {"SC_ULONG_MAX", _SC_ULONG_MAX}, + #endif + #ifdef _SC_USHRT_MAX + {"SC_USHRT_MAX", _SC_USHRT_MAX}, + #endif + #ifdef _SC_VERSION + {"SC_VERSION", _SC_VERSION}, + #endif + #ifdef _SC_WORD_BIT + {"SC_WORD_BIT", _SC_WORD_BIT}, + #endif + #ifdef _SC_XBS5_ILP32_OFF32 + {"SC_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32}, + #endif + #ifdef _SC_XBS5_ILP32_OFFBIG + {"SC_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG}, + #endif + #ifdef _SC_XBS5_LP64_OFF64 + {"SC_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64}, + #endif + #ifdef _SC_XBS5_LPBIG_OFFBIG + {"SC_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG}, + #endif + #ifdef _SC_XOPEN_CRYPT + {"SC_XOPEN_CRYPT", _SC_XOPEN_CRYPT}, + #endif + #ifdef _SC_XOPEN_ENH_I18N + {"SC_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N}, + #endif + #ifdef _SC_XOPEN_LEGACY + {"SC_XOPEN_LEGACY", _SC_XOPEN_LEGACY}, + #endif + #ifdef _SC_XOPEN_REALTIME + {"SC_XOPEN_REALTIME", _SC_XOPEN_REALTIME}, + #endif + #ifdef _SC_XOPEN_REALTIME_THREADS + {"SC_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS}, + #endif + #ifdef _SC_XOPEN_SHM + {"SC_XOPEN_SHM", _SC_XOPEN_SHM}, + #endif + #ifdef _SC_XOPEN_UNIX + {"SC_XOPEN_UNIX", _SC_XOPEN_UNIX}, + #endif + #ifdef _SC_XOPEN_VERSION + {"SC_XOPEN_VERSION", _SC_XOPEN_VERSION}, + #endif + #ifdef _SC_XOPEN_XCU_VERSION + {"SC_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION}, + #endif + #ifdef _SC_XOPEN_XPG2 + {"SC_XOPEN_XPG2", _SC_XOPEN_XPG2}, + #endif + #ifdef _SC_XOPEN_XPG3 + {"SC_XOPEN_XPG3", _SC_XOPEN_XPG3}, + #endif + #ifdef _SC_XOPEN_XPG4 + {"SC_XOPEN_XPG4", _SC_XOPEN_XPG4}, + #endif + }; + + static int + conv_sysconf_confname(arg, valuep) + PyObject *arg; + int *valuep; + { + return conv_confname(arg, valuep, posix_constants_sysconf, + sizeof(posix_constants_sysconf) + / sizeof(struct constdef)); + } + + static char posix_sysconf__doc__[] = "\ + sysconf(name) -> integer\n\ + Return an integer-valued system configuration variable."; + + static PyObject * + posix_sysconf(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + int name; + + if (PyArg_ParseTuple(args, "O&:sysconf", conv_sysconf_confname, &name)) { + int value; + + errno = 0; + value = sysconf(name); + if (value == -1 && errno != 0) + posix_error(); + else + result = PyInt_FromLong(value); + } + return result; + } + #endif + + static char posix_abort__doc__[] = "\ abort() -> does not return!\n\ *************** *** 3381,3384 **** --- 4225,4231 ---- {"getgid", posix_getgid, METH_VARARGS, posix_getgid__doc__}, #endif /* HAVE_GETGID */ + #ifdef HAVE_GETGROUPS + {"getgroups", posix_getgroups, METH_VARARGS, posix_getgroups__doc__}, + #endif {"getpid", posix_getpid, METH_VARARGS, posix_getpid__doc__}, #ifdef HAVE_GETPGRP *************** *** 3492,3495 **** --- 4339,4354 ---- {"tmpnam", posix_tmpnam, METH_VARARGS, posix_tmpnam__doc__}, #endif + #ifdef HAVE_CONFSTR + {"confstr", posix_confstr, METH_VARARGS, posix_confstr__doc__}, + #endif + #ifdef HAVE_SYSCONF + {"sysconf", posix_sysconf, METH_VARARGS, posix_sysconf__doc__}, + #endif + #ifdef HAVE_FPATHCONF + {"fpathconf", posix_fpathconf, METH_VARARGS, posix_fpathconf__doc__}, + #endif + #ifdef HAVE_PATHCONF + {"pathconf", posix_pathconf, METH_VARARGS, posix_pathconf__doc__}, + #endif {"abort", posix_abort, METH_VARARGS, posix_abort__doc__}, {NULL, NULL} /* Sentinel */ *************** *** 3586,3589 **** --- 4445,4451 ---- if (ins(d, "X_OK", (long)X_OK)) return -1; #endif + #ifdef NGROUPS_MAX + if (ins(d, "NGROUPS_MAX", (long)NGROUPS_MAX)) return -1; + #endif #ifdef TMP_MAX if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1; *************** *** 3683,3687 **** return; Py_DECREF(v); ! if (all_ins(d)) return; --- 4545,4549 ---- return; Py_DECREF(v); ! if (all_ins(d)) return; From fdrake@weyr.cnri.reston.va.us Mon Dec 13 16:55:27 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 13 Dec 1999 11:55:27 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.117,2.118 Message-ID: <199912131655.LAA17456@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Removed debugging prints. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.117 retrieving revision 2.118 diff -C2 -r2.117 -r2.118 *** posixmodule.c 1999/12/13 16:37:25 2.117 --- posixmodule.c 1999/12/13 16:55:24 2.118 *************** *** 3417,3425 **** int cmp, mid; char *confname = PyString_AS_STRING(arg); - printf("table: %d entries\n", tablesize); while (lo < hi) { mid = (lo + hi) / 2; - printf("%d confname='%s'; other='%s';\n", - mid, confname, table[mid].name); cmp = strcmp(confname, table[mid].name); if (cmp < 0) --- 3417,3422 ---- *************** *** 3621,3625 **** int len = confstr(name, buffer, sizeof(buffer)); - printf("confstr(%d) --> %d, '%s'\n", name, len, buffer); errno = 0; if (len == 0) { --- 3618,3621 ---- From gstein@lyra.org Mon Dec 13 18:21:57 1999 From: gstein@lyra.org (Greg Stein) Date: Mon, 13 Dec 1999 10:21:57 -0800 (PST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.117,2.118 In-Reply-To: <199912131655.LAA17456@weyr.cnri.reston.va.us> Message-ID: hoo hoo... the new diff's count for something already. I saw that in the first checkin and was about to reply... :-) On Mon, 13 Dec 1999, Fred L. Drake wrote: > Update of /projects/cvsroot/python/dist/src/Modules > In directory weyr:/home/fdrake/projects/python/Modules > > Modified Files: > posixmodule.c > Log Message: > > Removed debugging prints. > > > Index: posixmodule.c > =================================================================== > RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v > retrieving revision 2.117 > retrieving revision 2.118 > diff -C2 -r2.117 -r2.118 > *** posixmodule.c 1999/12/13 16:37:25 2.117 > --- posixmodule.c 1999/12/13 16:55:24 2.118 > *************** > *** 3417,3425 **** > int cmp, mid; > char *confname = PyString_AS_STRING(arg); > - printf("table: %d entries\n", tablesize); > while (lo < hi) { > mid = (lo + hi) / 2; > - printf("%d confname='%s'; other='%s';\n", > - mid, confname, table[mid].name); > cmp = strcmp(confname, table[mid].name); > if (cmp < 0) > --- 3417,3422 ---- > *************** > *** 3621,3625 **** > int len = confstr(name, buffer, sizeof(buffer)); > > - printf("confstr(%d) --> %d, '%s'\n", name, len, buffer); > errno = 0; > if (len == 0) { > --- 3618,3621 ---- > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://www.python.org/mailman/listinfo/python-checkins > -- Greg Stein, http://www.lyra.org/ From gstein@lyra.org Mon Dec 13 18:26:59 1999 From: gstein@lyra.org (Greg Stein) Date: Mon, 13 Dec 1999 10:26:59 -0800 (PST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.116,2.117 In-Reply-To: <199912131637.LAA17318@weyr.cnri.reston.va.us> Message-ID: On Mon, 13 Dec 1999, Fred L. Drake wrote: > Update of /projects/cvsroot/python/dist/src/Modules > In directory weyr:/home/fdrake/projects/python/Modules > > Modified Files: > posixmodule.c > Log Message: > > Added bindings for getgroups(), fpathconf(), pathconf(), confstr(), > and sysconf(). > > *Lots* of tables to define names used by *conf*(); explanation to go > in message to python-dev list. I'm not very familiar with these APIs, but should you let go of the interpreter lock when you call them? (and for the other new funcs) Cheers, -g -- Greg Stein, http://www.lyra.org/ From guido@cnri.reston.va.us Mon Dec 13 23:27:49 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Dec 1999 18:27:49 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib imaplib.py,1.13,1.14 Message-ID: <199912132327.SAA23122@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: imaplib.py Log Message: V 2.16 from Piers: I've changed the login command to force proper quoting of the password argument. I've also added some extra debugging code, which is removed when __debug__ is false. Index: imaplib.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/imaplib.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** imaplib.py 1998/10/21 22:06:56 1.13 --- imaplib.py 1999/12/13 23:27:45 1.14 *************** *** 16,20 **** """ ! __version__ = "2.15" import binascii, re, socket, string, time, random, sys --- 16,20 ---- """ ! __version__ = "2.16" import binascii, re, socket, string, time, random, sys *************** *** 90,94 **** an IMAP4 literal. If necessary (the string contains white-space and isn't enclosed with either parentheses or ! double quotes) each string is quoted. Each command returns a tuple: (type, [data, ...]) where 'type' --- 90,95 ---- an IMAP4 literal. If necessary (the string contains white-space and isn't enclosed with either parentheses or ! double quotes) each string is quoted. However, the 'password' ! argument to the LOGIN command is always quoted. Each command returns a tuple: (type, [data, ...]) where 'type' *************** *** 102,105 **** --- 103,111 ---- .readonly(""), which is a sub-class of 'abort'. + "error" exceptions imply a program error. + "abort" exceptions imply the connection should be reset, and + the command re-tried. + "readonly" exceptions imply the command should be re-tried. + Note: to use this module, you must read the RFCs pertaining to the IMAP4 protocol, as the semantics of the arguments to *************** *** 112,115 **** --- 118,122 ---- class readonly(abort): pass # Mailbox status changed to READ-ONLY + mustquote = re.compile(r'\W') # Match any non-alphanumeric character def __init__(self, host = '', port = IMAP4_PORT): *************** *** 139,144 **** # request and store CAPABILITY response. ! if __debug__ and self.debug >= 1: ! _mesg('new IMAP4 connection, tag=%s' % self.tagpre) self.welcome = self._get_response() --- 146,152 ---- # request and store CAPABILITY response. ! if __debug__: ! if self.debug >= 1: ! _mesg('new IMAP4 connection, tag=%s' % self.tagpre) self.welcome = self._get_response() *************** *** 147,151 **** elif self.untagged_responses.has_key('OK'): self.state = 'NONAUTH' - # elif self.untagged_responses.has_key('BYE'): else: raise self.error(self.welcome) --- 155,158 ---- *************** *** 157,162 **** self.capabilities = tuple(string.split(string.upper(self.untagged_responses[cap][-1]))) ! if __debug__ and self.debug >= 3: ! _mesg('CAPABILITIES: %s' % `self.capabilities`) for version in AllowedVersions: --- 164,170 ---- self.capabilities = tuple(string.split(string.upper(self.untagged_responses[cap][-1]))) ! if __debug__: ! if self.debug >= 3: ! _mesg('CAPABILITIES: %s' % `self.capabilities`) for version in AllowedVersions: *************** *** 230,235 **** --- 238,247 ---- (typ, [data]) = .append(mailbox, flags, date_time, message) + + All args except `message' can be None. """ name = 'APPEND' + if not mailbox: + mailbox = 'INBOX' if flags: if (flags[0],flags[-1]) != ('(',')'): *************** *** 360,367 **** def login(self, user, password): """Identify client using plaintext password. ! (typ, [data]) = .list(user, password) """ ! typ, dat = self._simple_command('LOGIN', user, password) if typ != 'OK': raise self.error(dat[-1]) --- 372,383 ---- def login(self, user, password): """Identify client using plaintext password. + + (typ, [data]) = .login(user, password) ! NB: 'password' will be quoted. """ ! #if not 'AUTH=LOGIN' in self.capabilities: ! # raise self.error("Server doesn't allow LOGIN authentication." % mech) ! typ, dat = self._simple_command('LOGIN', user, self._quote(password)) if typ != 'OK': raise self.error(dat[-1]) *************** *** 404,409 **** (typ, data) = .noop() """ ! if __debug__ and self.debug >= 3: ! _dump_ur(self.untagged_responses) return self._simple_command('NOOP') --- 420,426 ---- (typ, data) = .noop() """ ! if __debug__: ! if self.debug >= 3: ! _dump_ur(self.untagged_responses) return self._simple_command('NOOP') *************** *** 465,469 **** if not self.untagged_responses.has_key('READ-WRITE') \ and not readonly: ! if __debug__ and self.debug >= 1: _dump_ur(self.untagged_responses) raise self.readonly('%s is not writable' % mailbox) return typ, self.untagged_responses.get('EXISTS', [None]) --- 482,488 ---- if not self.untagged_responses.has_key('READ-WRITE') \ and not readonly: ! if __debug__: ! if self.debug >= 1: ! _dump_ur(self.untagged_responses) raise self.readonly('%s is not writable' % mailbox) return typ, self.untagged_responses.get('EXISTS', [None]) *************** *** 547,554 **** def _append_untagged(self, typ, dat): ur = self.untagged_responses ! if __debug__ and self.debug >= 5: ! _mesg('untagged_responses[%s] %s += %s' % ! (typ, len(ur.get(typ,'')), dat)) if ur.has_key(typ): ur[typ].append(dat) --- 566,575 ---- def _append_untagged(self, typ, dat): + if dat is None: dat = '' ur = self.untagged_responses ! if __debug__: ! if self.debug >= 5: ! _mesg('untagged_responses[%s] %s += ["%s"]' % ! (typ, len(ur.get(typ,'')), dat)) if ur.has_key(typ): ur[typ].append(dat) *************** *** 557,560 **** --- 578,587 ---- + def _check_bye(self): + bye = self.untagged_responses.get('BYE') + if bye: + raise self.abort(bye[-1]) + + def _command(self, name, *args): *************** *** 575,588 **** tag = self._new_tag() data = '%s %s' % (tag, name) ! for d in args: ! if d is None: continue ! if type(d) is type(''): ! l = len(string.split(d)) ! else: ! l = 1 ! if l == 0 or l > 1 and (d[0],d[-1]) not in (('(',')'),('"','"')): ! data = '%s "%s"' % (data, d) ! else: ! data = '%s %s' % (data, d) literal = self.literal --- 602,608 ---- tag = self._new_tag() data = '%s %s' % (tag, name) ! for arg in args: ! if arg is None: continue ! data = '%s %s' % (data, self._checkquote(arg)) literal = self.literal *************** *** 595,598 **** --- 615,624 ---- data = '%s {%s}' % (data, len(literal)) + if __debug__: + if self.debug >= 4: + _mesg('> %s' % data) + else: + _log('> %s' % data) + try: self.sock.send('%s%s' % (data, CRLF)) *************** *** 600,606 **** raise self.abort('socket error: %s' % val) - if __debug__ and self.debug >= 4: - _mesg('> %s' % data) - if literal is None: return tag --- 626,629 ---- *************** *** 618,623 **** literal = literator(self.continuation_response) ! if __debug__ and self.debug >= 4: ! _mesg('write literal size %s' % len(literal)) try: --- 641,647 ---- literal = literator(self.continuation_response) ! if __debug__: ! if self.debug >= 4: ! _mesg('write literal size %s' % len(literal)) try: *************** *** 634,637 **** --- 658,662 ---- def _command_complete(self, name, tag): + self._check_bye() try: typ, data = self._get_tagged_response(tag) *************** *** 640,645 **** except self.error, val: raise self.error('command: %s => %s' % (name, val)) ! if self.untagged_responses.has_key('BYE') and name != 'LOGOUT': ! raise self.abort(self.untagged_responses['BYE'][-1]) if typ == 'BAD': raise self.error('%s command error: %s %s' % (name, typ, data)) --- 665,669 ---- except self.error, val: raise self.error('command: %s => %s' % (name, val)) ! self._check_bye() if typ == 'BAD': raise self.error('%s command error: %s %s' % (name, typ, data)) *************** *** 696,701 **** size = string.atoi(self.mo.group('size')) ! if __debug__ and self.debug >= 4: ! _mesg('read literal size %s' % size) data = self.file.read(size) --- 720,726 ---- size = string.atoi(self.mo.group('size')) ! if __debug__: ! if self.debug >= 4: ! _mesg('read literal size %s' % size) data = self.file.read(size) *************** *** 715,720 **** self._append_untagged(self.mo.group('type'), self.mo.group('data')) ! if __debug__ and self.debug >= 1 and typ in ('NO', 'BAD'): ! _mesg('%s response: %s' % (typ, dat)) return resp --- 740,746 ---- self._append_untagged(self.mo.group('type'), self.mo.group('data')) ! if __debug__: ! if self.debug >= 1 and typ in ('NO', 'BAD', 'BYE'): ! _mesg('%s response: %s' % (typ, dat)) return resp *************** *** 740,745 **** line = line[:-2] ! if __debug__ and self.debug >= 4: ! _mesg('< %s' % line) return line --- 766,774 ---- line = line[:-2] ! if __debug__: ! if self.debug >= 4: ! _mesg('< %s' % line) ! else: ! _log('< %s' % line) return line *************** *** 751,756 **** self.mo = cre.match(s) ! if __debug__ and self.mo is not None and self.debug >= 5: ! _mesg("\tmatched r'%s' => %s" % (cre.pattern, `self.mo.groups()`)) return self.mo is not None --- 780,786 ---- self.mo = cre.match(s) ! if __debug__: ! if self.mo is not None and self.debug >= 5: ! _mesg("\tmatched r'%s' => %s" % (cre.pattern, `self.mo.groups()`)) return self.mo is not None *************** *** 764,767 **** --- 794,819 ---- + def _checkquote(self, arg): + + # Must quote command args if non-alphanumeric chars present, + # and not already quoted. + + if type(arg) is not type(''): + return arg + if (arg[0],arg[-1]) in (('(',')'),('"','"')): + return arg + if self.mustquote.search(arg) is None: + return arg + return self._quote(arg) + + + def _quote(self, arg): + + arg = string.replace(arg, '\\', '\\\\') + arg = string.replace(arg, '"', '\\"') + + return '"%s"' % arg + + def _simple_command(self, name, *args): *************** *** 776,781 **** return typ, [None] data = self.untagged_responses[name] ! if __debug__ and self.debug >= 5: ! _mesg('untagged_responses[%s] => %s' % (name, data)) del self.untagged_responses[name] return typ, data --- 828,834 ---- return typ, [None] data = self.untagged_responses[name] ! if __debug__: ! if self.debug >= 5: ! _mesg('untagged_responses[%s] => %s' % (name, data)) del self.untagged_responses[name] return typ, data *************** *** 902,906 **** dttype = type(date_time) ! if dttype is type(1): tt = time.localtime(date_time) elif dttype is type(()): --- 955,959 ---- dttype = type(date_time) ! if dttype is type(1) or dttype is type(1.1): tt = time.localtime(date_time) elif dttype is type(()): *************** *** 923,929 **** if __debug__: ! def _mesg(s): ! # if len(s) > 70: s = '%.70s..' % s ! sys.stderr.write('\t'+s+'\n') sys.stderr.flush() --- 976,984 ---- if __debug__: ! def _mesg(s, secs=None): ! if secs is None: ! secs = time.time() ! tm = time.strftime('%M:%S', time.localtime(secs)) ! sys.stderr.write(' %s.%02d %s\n' % (tm, (secs*100)%100, s)) sys.stderr.flush() *************** *** 937,943 **** _mesg('untagged responses dump:%s%s' % (t, j(l, t))) ! if __debug__ and __name__ == '__main__': import getpass, sys --- 992,1012 ---- _mesg('untagged responses dump:%s%s' % (t, j(l, t))) + _cmd_log = [] # Last `_cmd_log_len' interactions + _cmd_log_len = 10 + + def _log(line): + # Keep log of last `_cmd_log_len' interactions for debugging. + if len(_cmd_log) == _cmd_log_len: + del _cmd_log[0] + _cmd_log.append((time.time(), line)) + + def print_log(): + _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) + for secs,line in _cmd_log: + _mesg(line, secs) + ! if __name__ == '__main__': import getpass, sys *************** *** 955,958 **** --- 1024,1028 ---- ('CREATE', ('/tmp/yyz 2',)), ('append', ('/tmp/yyz 2', None, None, 'From: anon@x.y.z\n\ndata...')), + ('list', ('/tmp', 'yy*')), ('select', ('/tmp/yyz 2',)), ('search', (None, '(TO zork)')), *************** *** 969,972 **** --- 1039,1043 ---- ('uid', ('SEARCH', 'ALL')), ('response', ('EXISTS',)), + ('append', (None, None, None, 'From: anon@x.y.z\n\ndata...')), ('recent', ()), ('logout', ()), *************** *** 974,979 **** def run(cmd, args): typ, dat = apply(eval('M.%s' % cmd), args) ! _mesg(' %s %s\n => %s %s' % (cmd, args, typ, dat)) return dat --- 1045,1051 ---- def run(cmd, args): + _mesg('%s %s' % (cmd, args)) typ, dat = apply(eval('M.%s' % cmd), args) ! _mesg('%s => %s %s' % (cmd, typ, dat)) return dat *************** *** 997,1001 **** continue ! uid = string.split(dat[-1])[-1] ! run('uid', ('FETCH', '%s' % uid, '(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)')) --- 1069,1074 ---- continue ! uid = string.split(dat[-1]) ! if not uid: continue ! run('uid', ('FETCH', '%s' % uid[-1], '(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)')) From guido@cnri.reston.va.us Mon Dec 13 23:29:41 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Dec 1999 18:29:41 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libimaplib.tex Message-ID: <199912132329.SAA23160@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory eric:/projects/python/develop/guido/Doc/lib Modified Files: libimaplib.tex Log Message: Doc update from Piers Lauder see changes for imaplib.py version 2.16. From fdrake@weyr.cnri.reston.va.us Mon Dec 13 23:34:45 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 13 Dec 1999 18:34:45 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libimaplib.tex Message-ID: <199912132334.SAA23367@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libimaplib.tex Log Message: Markup consistency nits that Guido didn't check. ;-) From fdrake@weyr.cnri.reston.va.us Tue Dec 14 20:48:21 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Dec 1999 15:48:21 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src config.h.in,2.47,2.48 configure,1.102,1.103 configure.in,1.110,1.111 Message-ID: <199912142048.PAA27828@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory weyr:/home/fdrake/projects/python Modified Files: config.h.in configure configure.in Log Message: Added detection of getlogin() and getlogin_r(). Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -r2.47 -r2.48 *** config.h.in 1999/12/13 16:23:34 2.47 --- config.h.in 1999/12/14 20:48:17 2.48 *************** *** 273,276 **** --- 273,282 ---- #undef HAVE_GETGROUPS + /* Define if you have the getlogin function. */ + #undef HAVE_GETLOGIN + + /* Define if you have the getlogin_r function. */ + #undef HAVE_GETLOGIN_R + /* Define if you have the getpgrp function. */ #undef HAVE_GETPGRP Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -r1.102 -r1.103 *** configure 1999/12/13 16:23:35 1.102 --- configure 1999/12/14 20:48:17 1.103 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.109 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.110 [...1197 lines suppressed...] #include --- 4642,4646 ---- else cat > conftest.$ac_ext < *************** *** 4660,4664 **** } EOF ! if { (eval echo configure:4663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull --- 4661,4665 ---- } EOF ! if { (eval echo configure:4664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -r1.110 -r1.111 *** configure.in 1999/12/13 16:23:34 1.110 --- configure.in 1999/12/14 20:48:17 1.111 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.110 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.111 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 682,686 **** AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \ flock fork fsync fdatasync fpathconf ftime ftruncate \ ! getgroups getpeername getpgrp getpid getpwent gettimeofday getwd \ kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \ putenv readlink \ --- 682,687 ---- AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \ flock fork fsync fdatasync fpathconf ftime ftruncate \ ! getgroups getlogin getlogin_r getpeername getpgrp getpid getpwent \ ! gettimeofday getwd \ kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \ putenv readlink \ From fdrake@weyr.cnri.reston.va.us Tue Dec 14 21:11:50 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Dec 1999 16:11:50 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src config.h.in,2.48,2.49 configure,1.103,1.104 configure.in,1.111,1.112 Message-ID: <199912142111.QAA28416@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory weyr:/home/fdrake/projects/python Modified Files: config.h.in configure configure.in Log Message: Remove test for getlogin_r(); the interface is not clearly defined, at least on Solaris (sometimes it's Unix98, sometimes it conforms to an early draft). Properly generate config.h.in using autoheader instead of editing it manually; thanks, Guido! Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.48 retrieving revision 2.49 diff -C2 -r2.48 -r2.49 *** config.h.in 1999/12/14 20:48:17 2.48 --- config.h.in 1999/12/14 21:11:46 2.49 *************** *** 216,219 **** --- 216,222 ---- #undef HAVE_CLOCK + /* Define if you have the confstr function. */ + #undef HAVE_CONFSTR + /* Define if you have the ctermid function. */ #undef HAVE_CTERMID *************** *** 240,243 **** --- 243,249 ---- #undef HAVE_FORK + /* Define if you have the fpathconf function. */ + #undef HAVE_FPATHCONF + /* Define if you have the fseek64 function. */ #undef HAVE_FSEEK64 *************** *** 267,273 **** #undef HAVE_GETCWD - /* Define if you have the getpeername function. */ - #undef HAVE_GETPEERNAME - /* Define if you have the getgroups function. */ #undef HAVE_GETGROUPS --- 273,276 ---- *************** *** 276,281 **** #undef HAVE_GETLOGIN ! /* Define if you have the getlogin_r function. */ ! #undef HAVE_GETLOGIN_R /* Define if you have the getpgrp function. */ --- 279,284 ---- #undef HAVE_GETLOGIN ! /* Define if you have the getpeername function. */ ! #undef HAVE_GETPEERNAME /* Define if you have the getpgrp function. */ *************** *** 294,309 **** #undef HAVE_GETWD - /* Define if you have the fpathconf function. */ - #undef HAVE_FPATHCONF - - /* Define if you have the pathconf function. */ - #undef HAVE_PATHCONF - - /* Define if you have the confstr function. */ - #undef HAVE_CONFSTR - - /* Define if you have the sysconf function. */ - #undef HAVE_SYSCONF - /* Define if you have the hypot function. */ #undef HAVE_HYPOT --- 297,300 ---- *************** *** 330,333 **** --- 321,327 ---- #undef HAVE_NICE + /* Define if you have the pathconf function. */ + #undef HAVE_PATHCONF + /* Define if you have the pause function. */ #undef HAVE_PAUSE *************** *** 395,398 **** --- 389,395 ---- /* Define if you have the symlink function. */ #undef HAVE_SYMLINK + + /* Define if you have the sysconf function. */ + #undef HAVE_SYSCONF /* Define if you have the tcgetpgrp function. */ Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -r1.103 -r1.104 *** configure 1999/12/14 20:48:17 1.103 --- configure 1999/12/14 21:11:46 1.104 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.110 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.111 [...1197 lines suppressed...] #include --- 4641,4645 ---- else cat > conftest.$ac_ext < *************** *** 4661,4665 **** } EOF ! if { (eval echo configure:4664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull --- 4660,4664 ---- } EOF ! if { (eval echo configure:4663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -r1.111 -r1.112 *** configure.in 1999/12/14 20:48:17 1.111 --- configure.in 1999/12/14 21:11:47 1.112 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.111 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.112 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 682,687 **** AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \ flock fork fsync fdatasync fpathconf ftime ftruncate \ ! getgroups getlogin getlogin_r getpeername getpgrp getpid getpwent \ ! gettimeofday getwd \ kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \ putenv readlink \ --- 682,686 ---- AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \ flock fork fsync fdatasync fpathconf ftime ftruncate \ ! getgroups getlogin getpeername getpgrp getpid getpwent gettimeofday getwd \ kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \ putenv readlink \ From fdrake@weyr.cnri.reston.va.us Tue Dec 14 21:25:06 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Dec 1999 16:25:06 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.118,2.119 Message-ID: <199912142125.QAA00066@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Added support for getlogin(); does *not* use getlogin_r() where available since the interface is poorly defined on at least one major platform (Solaris). Moved table of constant names for fpathconf() & pathconf() into the conditional that defines the conv_path_confname() helper; Mark Hammond reported that defining the table when none of the constants were defined causes the compiler to complain (won't allow 0-length array, imagine that!). In posix_fpathconf(), use conv_path_confname() as the O& conversion function, instead of the conv_confname() helper, which has the wrong signature (posix_pathconf() already used the right thing). Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.118 retrieving revision 2.119 diff -C2 -r2.118 -r2.119 *** posixmodule.c 1999/12/13 16:55:24 2.118 --- posixmodule.c 1999/12/14 21:25:03 2.119 *************** *** 1831,1834 **** --- 1831,1858 ---- + #ifdef HAVE_GETLOGIN + static char posix_getlogin__doc__[] = "\ + getlogin() -> string\n\ + Return the actual login name."; + + static PyObject * + posix_getlogin(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + + if (PyArg_ParseTuple(args, ":getlogin")) { + char *name = getlogin(); + + if (name == NULL) + posix_error(); + else + result = PyString_FromString(name); + } + return result; + } + #endif + #ifdef HAVE_GETUID static char posix_getuid__doc__[] = *************** *** 3344,3348 **** * integer values, allowing those functions to be called with the * magic names instead of poluting the module's namespace with tons of ! * rarely-used constants. */ struct constdef { --- 3368,3373 ---- * integer values, allowing those functions to be called with the * magic names instead of poluting the module's namespace with tons of ! * rarely-used constants. There are three separate tables that use ! * these definitions. */ struct constdef { *************** *** 3350,3355 **** long value; }; ! static struct constdef posix_constants_pathconf[] = { #ifdef _PC_ASYNC_IO {"PC_ASYNC_IO", _PC_ASYNC_IO}, --- 3375,3419 ---- long value; }; + + static int + conv_confname(arg, valuep, table, tablesize) + PyObject *arg; + int *valuep; + struct constdef *table; + size_t tablesize; + { + if (PyInt_Check(arg)) { + *valuep = PyInt_AS_LONG(arg); + return 1; + } + if (PyString_Check(arg)) { + /* look up the value in the table using a binary search */ + int lo = 0; + int hi = tablesize; + int cmp, mid; + char *confname = PyString_AS_STRING(arg); + while (lo < hi) { + mid = (lo + hi) / 2; + cmp = strcmp(confname, table[mid].name); + if (cmp < 0) + hi = mid; + else if (cmp > 0) + lo = mid + 1; + else { + *valuep = table[mid].value; + return 1; + } + } + PyErr_SetString(PyExc_ValueError, "unrecognized configuration name"); + } + else + PyErr_SetString(PyExc_TypeError, + "configuration names must be strings or integers"); + return 0; + } + ! #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) ! static struct constdef posix_constants_pathconf[] = { #ifdef _PC_ASYNC_IO {"PC_ASYNC_IO", _PC_ASYNC_IO}, *************** *** 3399,3443 **** }; - static int - conv_confname(arg, valuep, table, tablesize) - PyObject *arg; - int *valuep; - struct constdef *table; - size_t tablesize; - { - if (PyInt_Check(arg)) { - *valuep = PyInt_AS_LONG(arg); - return 1; - } - if (PyString_Check(arg)) { - /* look up the value in the table using a binary search */ - int lo = 0; - int hi = tablesize; - int cmp, mid; - char *confname = PyString_AS_STRING(arg); - while (lo < hi) { - mid = (lo + hi) / 2; - cmp = strcmp(confname, table[mid].name); - if (cmp < 0) - hi = mid; - else if (cmp > 0) - lo = mid + 1; - else { - *valuep = table[mid].value; - return 1; - } - } - PyErr_SetString(PyExc_ValueError, "unrecognized configuration name"); - } - else - PyErr_SetString(PyExc_TypeError, - "configuration names must be strings or integers"); - return 0; - } - - - #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) - static int conv_path_confname(arg, valuep) PyObject *arg; --- 3463,3467 ---- *************** *** 3464,3468 **** int name, fd; ! if (PyArg_ParseTuple(args, "iO&:fpathconf", &fd, conv_confname, &name)) { long limit; --- 3488,3493 ---- int name, fd; ! if (PyArg_ParseTuple(args, "iO&:fpathconf", &fd, ! conv_path_confname, &name)) { long limit; *************** *** 3500,3504 **** errno = 0; limit = pathconf(path, name); ! if (limit == -1 && errno != 0) if (errno == EINVAL) /* could be a path or name problem */ --- 3525,3529 ---- errno = 0; limit = pathconf(path, name); ! if (limit == -1 && errno != 0) { if (errno == EINVAL) /* could be a path or name problem */ *************** *** 3506,3509 **** --- 3531,3535 ---- else posix_error_with_filename(path); + } else result = PyInt_FromLong(limit); *************** *** 4234,4237 **** --- 4260,4266 ---- {"getuid", posix_getuid, METH_VARARGS, posix_getuid__doc__}, #endif /* HAVE_GETUID */ + #ifdef HAVE_GETLOGIN + {"getlogin", posix_getlogin, METH_VARARGS, posix_getlogin__doc__}, + #endif #ifdef HAVE_KILL {"kill", posix_kill, METH_VARARGS, posix_kill__doc__}, From guido@cnri.reston.va.us Tue Dec 14 22:18:40 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 14 Dec 1999 17:18:40 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib mailbox.py,1.16,1.17 Message-ID: <199912142218.RAA25264@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: mailbox.py Log Message: Only set msg.fp to None when there are no extra arguments; if there are, we must keep the file around so we can print the body. Index: mailbox.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/mailbox.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** mailbox.py 1999/03/24 16:20:45 1.16 --- mailbox.py 1999/12/14 22:18:37 1.17 *************** *** 256,260 **** break msgs.append(msg) ! msg.fp = None if len(args) > 1: num = string.atoi(args[1]) --- 256,261 ---- break msgs.append(msg) ! if len(args) <= 1: ! msg.fp = None if len(args) > 1: num = string.atoi(args[1]) From fdrake@weyr.cnri.reston.va.us Tue Dec 14 23:37:59 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Dec 1999 18:37:59 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libgetopt.tex Message-ID: <199912142337.SAA00509@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libgetopt.tex Log Message: Improve explanation of what the getopt() return value includes for long options. From bwarsaw@cnri.reston.va.us Wed Dec 15 02:22:55 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Tue, 14 Dec 1999 21:22:55 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.52,2.53 Message-ID: <199912150222.VAA03542@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory anthem:/home/bwarsaw/projects/python/Objects Modified Files: stringobject.c Log Message: do_strip(): Fixed cut-and-paste error; this function should check for zero arguments (found by Marc Lemburg). Index: stringobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/stringobject.c,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -r2.52 -r2.53 *** stringobject.c 1999/10/12 19:54:48 2.52 --- stringobject.c 1999/12/15 02:22:52 2.53 *************** *** 926,933 **** char *s = PyString_AS_STRING(self); int len = PyString_GET_SIZE(self), i, j; - PyObject *scobj = NULL; - int count = -1; ! if (!PyArg_ParseTuple(args, "|Oi", scobj, count)) return NULL; --- 926,931 ---- char *s = PyString_AS_STRING(self); int len = PyString_GET_SIZE(self), i, j; ! if (!PyArg_ParseTuple(args, "")) return NULL; From fdrake@weyr.cnri.reston.va.us Wed Dec 15 15:34:36 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Dec 1999 10:34:36 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.119,2.120 Message-ID: <199912151534.KAA01621@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Added table entries for Irix 6.5 names for confstr()/sysconf()/ pathconf() names, from Sjoerd. Added code to verify that these tables are properly ordered, only included and used when CHECK_CONFNAME_TABLES is defined. This is only needed to test the tables, so I haven't enabled this by default. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.119 retrieving revision 2.120 diff -C2 -r2.119 -r2.120 *** posixmodule.c 1999/12/14 21:25:03 2.119 --- posixmodule.c 1999/12/15 15:34:33 2.120 *************** *** 3416,3419 **** --- 3416,3425 ---- #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) static struct constdef posix_constants_pathconf[] = { + #ifdef _PC_ABI_AIO_XFER_MAX + {"PC_ABI_AIO_XFER_MAX", _PC_ABI_AIO_XFER_MAX}, + #endif + #ifdef _PC_ABI_ASYNC_IO + {"PC_ABI_ASYNC_IO", _PC_ABI_ASYNC_IO}, + #endif #ifdef _PC_ASYNC_IO {"PC_ASYNC_IO", _PC_ASYNC_IO}, *************** *** 3541,3544 **** --- 3547,3565 ---- #ifdef HAVE_CONFSTR static struct constdef posix_constants_confstr[] = { + #ifdef _CS_ARCHITECTURE + {"CS_ARCHITECTURE", _CS_ARCHITECTURE}, + #endif + #ifdef _CS_HOSTNAME + {"CS_HOSTNAME", _CS_HOSTNAME}, + #endif + #ifdef _CS_HW_PROVIDER + {"CS_HW_PROVIDER", _CS_HW_PROVIDER}, + #endif + #ifdef _CS_HW_SERIAL + {"CS_HW_SERIAL", _CS_HW_SERIAL}, + #endif + #ifdef _CS_INITTAB_NAME + {"CS_INITTAB_NAME", _CS_INITTAB_NAME}, + #endif #ifdef _CS_LFS64_CFLAGS {"CS_LFS64_CFLAGS", _CS_LFS64_CFLAGS}, *************** *** 3565,3571 **** --- 3586,3607 ---- {"CS_LFS_LINTFLAGS", _CS_LFS_LINTFLAGS}, #endif + #ifdef _CS_MACHINE + {"CS_MACHINE", _CS_MACHINE}, + #endif #ifdef _CS_PATH {"CS_PATH", _CS_PATH}, #endif + #ifdef _CS_RELEASE + {"CS_RELEASE", _CS_RELEASE}, + #endif + #ifdef _CS_SRPC_DOMAIN + {"CS_SRPC_DOMAIN", _CS_SRPC_DOMAIN}, + #endif + #ifdef _CS_SYSNAME + {"CS_SYSNAME", _CS_SYSNAME}, + #endif + #ifdef _CS_VERSION + {"CS_VERSION", _CS_VERSION}, + #endif #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS {"CS_XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS}, *************** *** 3616,3619 **** --- 3652,3694 ---- {"CS_XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS}, #endif + #ifdef _MIPS_CS_AVAIL_PROCESSORS + {"MIPS_CS_AVAIL_PROCESSORS", _MIPS_CS_AVAIL_PROCESSORS}, + #endif + #ifdef _MIPS_CS_BASE + {"MIPS_CS_BASE", _MIPS_CS_BASE}, + #endif + #ifdef _MIPS_CS_HOSTID + {"MIPS_CS_HOSTID", _MIPS_CS_HOSTID}, + #endif + #ifdef _MIPS_CS_HW_NAME + {"MIPS_CS_HW_NAME", _MIPS_CS_HW_NAME}, + #endif + #ifdef _MIPS_CS_NUM_PROCESSORS + {"MIPS_CS_NUM_PROCESSORS", _MIPS_CS_NUM_PROCESSORS}, + #endif + #ifdef _MIPS_CS_OSREL_MAJ + {"MIPS_CS_OSREL_MAJ", _MIPS_CS_OSREL_MAJ}, + #endif + #ifdef _MIPS_CS_OSREL_MIN + {"MIPS_CS_OSREL_MIN", _MIPS_CS_OSREL_MIN}, + #endif + #ifdef _MIPS_CS_OSREL_PATCH + {"MIPS_CS_OSREL_PATCH", _MIPS_CS_OSREL_PATCH}, + #endif + #ifdef _MIPS_CS_OS_NAME + {"MIPS_CS_OS_NAME", _MIPS_CS_OS_NAME}, + #endif + #ifdef _MIPS_CS_OS_PROVIDER + {"MIPS_CS_OS_PROVIDER", _MIPS_CS_OS_PROVIDER}, + #endif + #ifdef _MIPS_CS_PROCESSORS + {"MIPS_CS_PROCESSORS", _MIPS_CS_PROCESSORS}, + #endif + #ifdef _MIPS_CS_SERIAL + {"MIPS_CS_SERIAL", _MIPS_CS_SERIAL}, + #endif + #ifdef _MIPS_CS_VENDOR + {"MIPS_CS_VENDOR", _MIPS_CS_VENDOR}, + #endif }; *************** *** 3698,3701 **** --- 3773,3782 ---- {"SC_2_VERSION", _SC_2_VERSION}, #endif + #ifdef _SC_ABI_ASYNCHRONOUS_IO + {"SC_ABI_ASYNCHRONOUS_IO", _SC_ABI_ASYNCHRONOUS_IO}, + #endif + #ifdef _SC_ACL + {"SC_ACL", _SC_ACL}, + #endif #ifdef _SC_AIO_LISTIO_MAX {"SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX}, *************** *** 3719,3722 **** --- 3800,3806 ---- {"SC_ATEXIT_MAX", _SC_ATEXIT_MAX}, #endif + #ifdef _SC_AUDIT + {"SC_AUDIT", _SC_AUDIT}, + #endif #ifdef _SC_AVPHYS_PAGES {"SC_AVPHYS_PAGES", _SC_AVPHYS_PAGES}, *************** *** 3734,3737 **** --- 3818,3824 ---- {"SC_BC_STRING_MAX", _SC_BC_STRING_MAX}, #endif + #ifdef _SC_CAP + {"SC_CAP", _SC_CAP}, + #endif #ifdef _SC_CHARCLASS_NAME_MAX {"SC_CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX}, *************** *** 3803,3806 **** --- 3890,3896 ---- {"SC_ICACHE_SZ", _SC_ICACHE_SZ}, #endif + #ifdef _SC_INF + {"SC_INF", _SC_INF}, + #endif #ifdef _SC_INT_MAX {"SC_INT_MAX", _SC_INT_MAX}, *************** *** 3812,3818 **** --- 3902,3917 ---- {"SC_IOV_MAX", _SC_IOV_MAX}, #endif + #ifdef _SC_IP_SECOPTS + {"SC_IP_SECOPTS", _SC_IP_SECOPTS}, + #endif #ifdef _SC_JOB_CONTROL {"SC_JOB_CONTROL", _SC_JOB_CONTROL}, #endif + #ifdef _SC_KERN_POINTERS + {"SC_KERN_POINTERS", _SC_KERN_POINTERS}, + #endif + #ifdef _SC_KERN_SIM + {"SC_KERN_SIM", _SC_KERN_SIM}, + #endif #ifdef _SC_LINE_MAX {"SC_LINE_MAX", _SC_LINE_MAX}, *************** *** 3827,3830 **** --- 3926,3932 ---- {"SC_LONG_BIT", _SC_LONG_BIT}, #endif + #ifdef _SC_MAC + {"SC_MAC", _SC_MAC}, + #endif #ifdef _SC_MAPPED_FILES {"SC_MAPPED_FILES", _SC_MAPPED_FILES}, *************** *** 3848,3851 **** --- 3950,3956 ---- {"SC_MESSAGE_PASSING", _SC_MESSAGE_PASSING}, #endif + #ifdef _SC_MMAP_FIXED_ALIGNMENT + {"SC_MMAP_FIXED_ALIGNMENT", _SC_MMAP_FIXED_ALIGNMENT}, + #endif #ifdef _SC_MQ_OPEN_MAX {"SC_MQ_OPEN_MAX", _SC_MQ_OPEN_MAX}, *************** *** 3854,3857 **** --- 3959,3965 ---- {"SC_MQ_PRIO_MAX", _SC_MQ_PRIO_MAX}, #endif + #ifdef _SC_NACLS_MAX + {"SC_NACLS_MAX", _SC_NACLS_MAX}, + #endif #ifdef _SC_NGROUPS_MAX {"SC_NGROUPS_MAX", _SC_NGROUPS_MAX}, *************** *** 3881,3884 **** --- 3989,3998 ---- {"SC_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN}, #endif + #ifdef _SC_NPROC_CONF + {"SC_NPROC_CONF", _SC_NPROC_CONF}, + #endif + #ifdef _SC_NPROC_ONLN + {"SC_NPROC_ONLN", _SC_NPROC_ONLN}, + #endif #ifdef _SC_NZERO {"SC_NZERO", _SC_NZERO}, *************** *** 3986,3989 **** --- 4100,4106 ---- {"SC_SIGRT_MIN", _SC_SIGRT_MIN}, #endif + #ifdef _SC_SOFTPOWER + {"SC_SOFTPOWER", _SC_SOFTPOWER}, + #endif #ifdef _SC_SPLIT_CACHE {"SC_SPLIT_CACHE", _SC_SPLIT_CACHE}, *************** *** 4160,4163 **** --- 4277,4333 ---- + #ifdef CHECK_CONFNAME_TABLES + /* This code should not be enabled by default; it's only purpose is to + * test the order of constants in the configuration name tables. The + * second function defined here, check_confname_tables(), is called + * during module initialization if CHECK_CONFNAME_TABLES is defined. + * This only needs to be done when changes are made to the tables. + */ + static void + check_confname_table(table, tablesize, tablename) + struct constdef *table; + size_t tablesize; + char *tablename; + { + if (tablesize > 1) { + int i = 0; + + for (; i < (tablesize - 1); ++i) { + if (strcmp(table[i].name, table[i + 1].name) >= 0) { + char buffer[256]; + + snprintf(buffer, sizeof(buffer), + "confname table '%s' out of order!\n", tablename); + Py_FatalError(buffer); + } + } + } + } + + static void + check_confname_tables() + { + #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) + check_confname_table(posix_constants_pathconf, + sizeof(posix_constants_pathconf) + / sizeof(struct constdef), + "pathconf"); + #endif + #ifdef HAVE_CONFSTR + check_confname_table(posix_constants_confstr, + sizeof(posix_constants_confstr) + / sizeof(struct constdef), + "confstr"); + #endif + #ifdef HAVE_SYSCONF + check_confname_table(posix_constants_sysconf, + sizeof(posix_constants_sysconf) + / sizeof(struct constdef), + "sysconf"); + #endif + } + #endif + + static char posix_abort__doc__[] = "\ abort() -> does not return!\n\ *************** *** 4577,4579 **** --- 4747,4753 ---- posix_putenv_garbage = PyDict_New(); + + #ifdef CHECK_CONFNAME_TABLES + check_confname_tables(); + #endif } From fdrake@weyr.cnri.reston.va.us Wed Dec 15 18:31:13 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Dec 1999 13:31:13 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.120,2.121 Message-ID: <199912151831.NAA02685@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Rip out the code to check the ordering of the tables used to map strings to integers for the *conf*() functions. Added code to sort the tables at module initialization. Three dictionaries, confstr_names, sysconf_names, and pathconf_names, are added to the module as well. These map known configuration setting names to the numeric value which is used to represent the setting in the system call. This code is always called. Updated related comments. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.120 retrieving revision 2.121 diff -C2 -r2.120 -r2.121 *** posixmodule.c 1999/12/15 15:34:33 2.120 --- posixmodule.c 1999/12/15 18:31:10 2.121 *************** *** 3370,3373 **** --- 3370,3377 ---- * rarely-used constants. There are three separate tables that use * these definitions. + * + * This code is always included, even if none of the interfaces that + * need it are included. The #if hackery needed to avoid it would be + * sufficiently pervasive that it's not worth the loss of readability. */ struct constdef { *************** *** 4277,4331 **** ! #ifdef CHECK_CONFNAME_TABLES ! /* This code should not be enabled by default; it's only purpose is to ! * test the order of constants in the configuration name tables. The ! * second function defined here, check_confname_tables(), is called ! * during module initialization if CHECK_CONFNAME_TABLES is defined. ! * This only needs to be done when changes are made to the tables. */ ! static void ! check_confname_table(table, tablesize, tablename) struct constdef *table; size_t tablesize; ! char *tablename; { ! if (tablesize > 1) { int i = 0; ! for (; i < (tablesize - 1); ++i) { ! if (strcmp(table[i].name, table[i + 1].name) >= 0) { ! char buffer[256]; ! ! snprintf(buffer, sizeof(buffer), ! "confname table '%s' out of order!\n", tablename); ! Py_FatalError(buffer); } } } } ! static void ! check_confname_tables() { #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) ! check_confname_table(posix_constants_pathconf, sizeof(posix_constants_pathconf) / sizeof(struct constdef), ! "pathconf"); #endif #ifdef HAVE_CONFSTR ! check_confname_table(posix_constants_confstr, sizeof(posix_constants_confstr) / sizeof(struct constdef), ! "confstr"); #endif #ifdef HAVE_SYSCONF ! check_confname_table(posix_constants_sysconf, sizeof(posix_constants_sysconf) / sizeof(struct constdef), ! "sysconf"); #endif } - #endif --- 4281,4366 ---- ! /* This code is used to ensure that the tables of configuration value names ! * are in sorted order as required by conv_confname(), and also to build the ! * the exported dictionaries that are used to publish information about the ! * names available on the host platform. ! * ! * Sorting the table at runtime ensures that the table is properly ordered ! * when used, even for platforms we're not able to test on. It also makes ! * it easier to add additional entries to the tables. */ ! ! static int ! cmp_constdefs(v1, v2) ! const void *v1; ! const void *v2; ! { ! const struct constdef *c1 = ! (const struct constdef *) v1; ! const struct constdef *c2 = ! (const struct constdef *) v2; ! ! return strcmp(c1->name, c2->name); ! } ! ! static int ! setup_confname_table(table, tablesize, tablename, moddict) struct constdef *table; size_t tablesize; ! char * tablename; ! PyObject *moddict; { ! PyObject *d = NULL; ! ! qsort(table, tablesize, sizeof(struct constdef), cmp_constdefs); ! d = PyDict_New(); ! if (d != NULL) { ! PyObject *o; int i = 0; ! for (; i < tablesize; ++i) { ! o = PyInt_FromLong(table[i].value); ! if (o == NULL ! || PyDict_SetItemString(d, table[i].name, o) == -1) { ! Py_DECREF(d); ! d = NULL; ! return -1; } } + if (PyDict_SetItemString(moddict, tablename, d) == -1) + return -1; + return 0; } + return -1; } ! /* Return -1 on failure, 0 on success. */ ! static int ! setup_confname_tables(moddict) ! PyObject *moddict; { #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) ! if (setup_confname_table(posix_constants_pathconf, sizeof(posix_constants_pathconf) / sizeof(struct constdef), ! "pathconf_names", moddict)) ! return -1; #endif #ifdef HAVE_CONFSTR ! if (setup_confname_table(posix_constants_confstr, sizeof(posix_constants_confstr) / sizeof(struct constdef), ! "confstr_names", moddict)) ! return -1; #endif #ifdef HAVE_SYSCONF ! if (setup_confname_table(posix_constants_sysconf, sizeof(posix_constants_sysconf) / sizeof(struct constdef), ! "sysconf_names", moddict)) ! return -1; #endif + return 0; } *************** *** 4347,4352 **** return NULL; } - static PyMethodDef posix_methods[] = { {"access", posix_access, METH_VARARGS, posix_access__doc__}, --- 4382,4387 ---- return NULL; } + static PyMethodDef posix_methods[] = { {"access", posix_access, METH_VARARGS, posix_access__doc__}, *************** *** 4744,4753 **** return; PyDict_SetItemString(d, "error", PyExc_OSError); posix_putenv_garbage = PyDict_New(); - - #ifdef CHECK_CONFNAME_TABLES - check_confname_tables(); - #endif } --- 4779,4787 ---- return; + if (setup_confname_tables(d)) + return; + PyDict_SetItemString(d, "error", PyExc_OSError); posix_putenv_garbage = PyDict_New(); } From fdrake@weyr.cnri.reston.va.us Wed Dec 15 19:39:07 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Dec 1999 14:39:07 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libos.tex Message-ID: <199912151939.OAA03319@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libos.tex Log Message: Document getgroups(), getlogin(), fpathconf(), pathconf(), pathconf_names, confstr(), confstr_names, sysconf(), sysconf_names. From gstein@lyra.org Thu Dec 16 03:11:53 1999 From: gstein@lyra.org (Greg Stein) Date: Wed, 15 Dec 1999 19:11:53 -0800 (PST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.120,2.121 In-Reply-To: <199912151831.NAA02685@weyr.cnri.reston.va.us> Message-ID: But this means that your tables no long reside in "const" space. Yet More Per-Process Memory... It would be nice to have those tables marked as "const". -g On Wed, 15 Dec 1999, Fred L. Drake wrote: > Update of /projects/cvsroot/python/dist/src/Modules > In directory weyr:/home/fdrake/projects/python/Modules > > Modified Files: > posixmodule.c > Log Message: > > Rip out the code to check the ordering of the tables used to map > strings to integers for the *conf*() functions. > > Added code to sort the tables at module initialization. Three > dictionaries, confstr_names, sysconf_names, and pathconf_names, are > added to the module as well. These map known configuration setting > names to the numeric value which is used to represent the setting in > the system call. This code is always called. -- Greg Stein, http://www.lyra.org/ From guido@CNRI.Reston.VA.US Thu Dec 16 15:53:51 1999 From: guido@CNRI.Reston.VA.US (Guido van Rossum) Date: Thu, 16 Dec 1999 10:53:51 -0500 Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.120,2.121 In-Reply-To: Your message of "Wed, 15 Dec 1999 19:11:53 PST." References: Message-ID: <199912161553.KAA08428@eric.cnri.reston.va.us> > But this means that your tables no long reside in "const" space. Yet More > Per-Process Memory... & size python 1046211 + 117992 + 13640 = 1177843 I don't think there's much of a need to worry about this. Why are you always bringing up this subject? No-one else that I know has ever had this concern... --Guido van Rossum (home page: http://www.python.org/~guido/) From fdrake@weyr.cnri.reston.va.us Thu Dec 16 16:11:08 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 16 Dec 1999 11:11:08 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libmath.tex Message-ID: <199912161611.LAA10485@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libmath.tex Log Message: Add a discussion about the non-acceptance of complex numbers (yes, I know there is one in the cmath documentation as well). Needed here so that people can find this material more easily. Includes hyperlink to the cmath module. From guido@cnri.reston.va.us Thu Dec 16 17:49:05 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Thu, 16 Dec 1999 12:49:05 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.24,1.25 Message-ID: <199912161749.MAA11088@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: acconfig.h Log Message: Correct stupid typo (HAVE_GETHOSTBTNAME). Index: acconfig.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/acconfig.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** acconfig.h 1999/11/16 15:55:00 1.24 --- acconfig.h 1999/12/16 17:49:02 1.25 *************** *** 40,44 **** /* Define this if you have gethostbyname() */ ! #undef HAVE_GETHOSTBTNAME /* Define this if you have some version of gethostbyname_r() */ --- 40,44 ---- /* Define this if you have gethostbyname() */ ! #undef HAVE_GETHOSTBYNAME /* Define this if you have some version of gethostbyname_r() */ From guido@cnri.reston.va.us Thu Dec 16 17:49:30 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Thu, 16 Dec 1999 12:49:30 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src config.h.in,2.49,2.50 Message-ID: <199912161749.MAA11112@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: config.h.in Log Message: Regenerated after new acconfig.h. Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -r2.49 -r2.50 *** config.h.in 1999/12/14 21:11:46 2.49 --- config.h.in 1999/12/16 17:49:27 2.50 *************** *** 100,103 **** --- 100,106 ---- #undef HAVE_ALTZONE + /* Define this if you have gethostbyname() */ + #undef HAVE_GETHOSTBYNAME + /* Define this if you have some version of gethostbyname_r() */ #undef HAVE_GETHOSTBYNAME_R From guido@cnri.reston.va.us Thu Dec 16 17:50:56 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Thu, 16 Dec 1999 12:50:56 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src configure,1.104,1.105 configure.in,1.112,1.113 Message-ID: <199912161750.MAA11140@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: configure configure.in Log Message: Patch by Geoff Furnish to make compiling with C++ more gentle. (The configure script is regenerated, not from his patch.) Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -r1.104 -r1.105 *** configure 1999/12/14 21:11:46 1.104 --- configure 1999/12/16 17:50:52 1.105 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.111 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.113 [...3156 lines suppressed...] --- 4703,4707 ---- } EOF ! if { (eval echo configure:4706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull *************** *** 4824,4828 **** s%@MACHDEP@%$MACHDEP%g s%@SGI_ABI@%$SGI_ABI%g ! s%@SET_CCC@%$SET_CCC%g s%@CC@%$CC%g s%@MAKE_LDLIBRARY@%$MAKE_LDLIBRARY%g --- 4867,4872 ---- s%@MACHDEP@%$MACHDEP%g s%@SGI_ABI@%$SGI_ABI%g ! s%@SET_CXX@%$SET_CXX%g ! s%@MAINOBJ@%$MAINOBJ%g s%@CC@%$CC%g s%@MAKE_LDLIBRARY@%$MAKE_LDLIBRARY%g Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -r1.112 -r1.113 *** configure.in 1999/12/14 21:11:47 1.112 --- configure.in 1999/12/16 17:50:52 1.113 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.112 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.113 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 83,99 **** # Not all make programs have this predefined. # ! AC_SUBST(SET_CCC) ! AC_MSG_CHECKING(CCC) ! if test -z "$CCC" ! then ! case $ac_sys_system in ! IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";; ! Linux*) SET_CCC="CCC= g++";; ! *) SET_CCC="" ! esac ! else ! SET_CCC="CCC= ${CCC}" ! fi ! AC_MSG_RESULT($SET_CCC) --- 83,99 ---- # Not all make programs have this predefined. # ! #AC_SUBST(SET_CCC) ! #AC_MSG_CHECKING(CCC) ! #if test -z "$CCC" ! #then ! # case $ac_sys_system in ! # IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";; ! # Linux*) SET_CCC="CCC= g++";; ! # *) SET_CCC="" ! # esac ! #else ! # SET_CCC="CCC= ${CCC}" ! #fi ! #AC_MSG_RESULT($SET_CCC) *************** *** 153,156 **** --- 153,186 ---- AC_MSG_RESULT($without_gcc) + AC_SUBST(SET_CXX) + AC_SUBST(MAINOBJ) + MAINOBJ=python.o + AC_MSG_CHECKING(for --with-cxx=) + AC_ARG_WITH(cxx, [--with-cxx= enable C++ support],[ + case $withval in + no) CXX= + with_cxx=no;; + *) CXX=$withval + MAINOBJ=ccpython.o + with_cxx=$withval;; + esac], [ + with_cxx=no + ]) + AC_MSG_RESULT($with_cxx) + SET_CXX="CXX = $CXX" + + #AC_MSG_CHECKING(CCC) + #if test -z "$CCC" + #then + # case $ac_sys_system in + # IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";; + # Linux*) SET_CCC="CCC= g++";; + # *) SET_CCC="" + # esac + #else + # SET_CCC="CCC= ${CCC}" + #fi + #AC_MSG_RESULT($SET_CCC) + # If the user switches compilers, we can't believe the cache if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" *************** *** 193,196 **** --- 223,230 ---- AC_SUBST(LINKCC) AC_MSG_CHECKING(LINKCC) + if test -z "$LINKCC" -a ! -z "$CXX" + then + LINKCC="$CXX" + fi if test -z "$LINKCC" then From guido@cnri.reston.va.us Thu Dec 16 17:52:10 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Thu, 16 Dec 1999 12:52:10 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules ccpython.cc,NONE,2.1 Makefile.pre.in,1.59,1.60 Message-ID: <199912161752.MAA11170@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/projects/python/develop/guido/src/Modules Modified Files: Makefile.pre.in Added Files: ccpython.cc Log Message: Patch and new file by Geoff Furnish for C++ compilation. Index: Makefile.pre.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/Makefile.pre.in,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -r1.59 -r1.60 *** Makefile.pre.in 1999/04/12 16:42:13 1.59 --- Makefile.pre.in 1999/12/16 17:52:08 1.60 *************** *** 18,22 **** VPATH= @srcdir@ ! @SET_CCC@ CC= @CC@ RANLIB= @RANLIB@ --- 18,22 ---- VPATH= @srcdir@ ! @SET_CXX@ CC= @CC@ RANLIB= @RANLIB@ *************** *** 96,100 **** OBJS= $(MODOBJS) $(FIXOBJS) ! MAINOBJ= python.o SYSLIBS= $(LIBM) $(LIBC) --- 96,101 ---- OBJS= $(MODOBJS) $(FIXOBJS) ! #MAINOBJ= python.o ! MAINOBJ= @MAINOBJ@ SYSLIBS= $(LIBM) $(LIBC) *************** *** 243,246 **** --- 244,250 ---- fi; \ done + + ccpython.o: ccpython.cc + $(CXX) $(CFLAGS) -c $*.cc # Stuff is appended here by makesetup and make depend From gstein@lyra.org Thu Dec 16 18:05:23 1999 From: gstein@lyra.org (Greg Stein) Date: Thu, 16 Dec 1999 10:05:23 -0800 (PST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.120,2.121 In-Reply-To: <199912161553.KAA08428@eric.cnri.reston.va.us> Message-ID: On Thu, 16 Dec 1999, Guido van Rossum wrote: > > But this means that your tables no long reside in "const" space. Yet More > > Per-Process Memory... > > & size python > 1046211 + 117992 + 13640 = 1177843 > > I don't think there's much of a need to worry about this. Why are you > always bringing up this subject? No-one else that I know has ever had > this concern... Somebody has to :-) Keeping the working set low is more efficient from a system standpoint. If you have 50 Python processes running, then you want them sharing as much as possible and you want the per-process working set as small as possible. A smaller working set means that you can start more processes before paging (i.e. it scales better), and it also leads to a faster startup time (less initialization and page allocation). Cheers, -g -- Greg Stein, http://www.lyra.org/ From fdrake@weyr.cnri.reston.va.us Mon Dec 20 18:02:32 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 20 Dec 1999 13:02:32 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libcgi.tex Message-ID: <199912201802.NAA17248@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libcgi.tex Log Message: Typo: vales --> values Reported by Roy Smith . From guido@cnri.reston.va.us Mon Dec 20 20:40:15 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 15:40:15 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.98,2.99 Message-ID: <199912202040.PAA10361@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: compile.c Log Message: The cleanup code in com-init() at label fail_0000 should remove c_varnames, not c_lnotab. Index: compile.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/compile.c,v retrieving revision 2.98 retrieving revision 2.99 diff -C2 -r2.98 -r2.99 *** compile.c 1999/09/15 22:48:09 2.98 --- compile.c 1999/12/20 20:40:12 2.99 *************** *** 458,462 **** fail_0000: ! Py_DECREF(c->c_lnotab); fail_000: Py_DECREF(c->c_locals); --- 458,462 ---- fail_0000: ! Py_DECREF(c->c_varnames); fail_000: Py_DECREF(c->c_locals); From guido@cnri.reston.va.us Mon Dec 20 21:18:52 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:18:52 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python dynload_aix.c,NONE,2.1 dynload_beos.c,NONE,2.1 dynload_dl.c,NONE,2.1 dynload_hpux.c,NONE,2.1 dynload_mac.c,NONE,2.1 dynload_next.c,NONE,2.1 dynload_os2.c,NONE,2.1 dynload_shlib.c,NONE,2.1 dynload_stub.c,NONE,2.1 dynload_win.c,NONE,2.1 Message-ID: <199912202118.QAA10565@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Added Files: dynload_aix.c dynload_beos.c dynload_dl.c dynload_hpux.c dynload_mac.c dynload_next.c dynload_os2.c dynload_shlib.c dynload_stub.c dynload_win.c Log Message: The old platform-specific contents of importdl.c, broken down into one file per platform (really: per style of Dl API; e.g. all platforms using dlopen() are grouped together in dynload_shlib.c.). This is part of a set of patches by Greg Stein. From guido@cnri.reston.va.us Mon Dec 20 21:20:45 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:20:45 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python importdl.c,2.62,2.63 Message-ID: <199912202120.QAA10598@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: importdl.c Log Message: Moved most of the platform-specific code to dynload_.c files. (A few nite remain, these will probably disappear soon.) This is part of a set of patches by Greg Stein. Index: importdl.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/importdl.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -r2.62 -r2.63 *** importdl.c 1999/11/16 15:54:16 2.62 --- importdl.c 1999/12/20 21:20:42 2.63 *************** *** 34,43 **** #include "Python.h" - - #ifdef HAVE_SYS_PARAM_H - /* osdefs.h will define MAXPATHLEN if it's not already defined. */ - #include - #endif - #include "osdefs.h" #include "importdl.h" [...1154 lines suppressed...] - beos_nuke_dyn( py_id ); - retval = PyDict_DelItemString( beos_dyn_images, name ); - } - - py_id = PyInt_FromLong( (long)id ); - if( py_id ) { - retval = PyDict_SetItemString( beos_dyn_images, name, py_id ); - } - - #ifdef WITH_THREAD - PyThread_release_lock( beos_dyn_lock ); - #endif - } - - #endif /* __BEOS__ */ --- 161,164 ---- Py_INCREF(m); return m; ! #endif /* HAVE_DYNAMIC_LOADING */ } From guido@cnri.reston.va.us Mon Dec 20 21:22:27 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:22:27 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python importdl.h,2.10,2.11 Message-ID: <199912202122.QAA10620@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: importdl.h Log Message: Some rearrangements for the importdl.c restructuring. This is part of a set of patches by Greg Stein. Index: importdl.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/importdl.h,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -r2.10 -r2.11 *** importdl.h 1998/08/06 13:36:43 2.10 --- importdl.h 1999/12/20 21:22:24 2.11 *************** *** 1,2 **** --- 1,9 ---- + #ifndef Py_IMPORTDL_H + #define Py_IMPORTDL_H + + #ifdef __cplusplus + extern "C" { + #endif + /*********************************************************** Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, *************** *** 43,51 **** }; ! extern struct filedescr { char *suffix; char *mode; enum filetype type; ! } _PyImport_Filetab[]; extern PyObject *_PyImport_LoadDynamicModule --- 50,60 ---- }; ! struct filedescr { char *suffix; char *mode; enum filetype type; ! }; ! extern struct filedescr * _PyImport_Filetab; ! extern const struct filedescr _PyImport_DynLoadFiletab[]; extern PyObject *_PyImport_LoadDynamicModule *************** *** 54,55 **** --- 63,80 ---- /* Max length of module suffix searched for -- accommodates "module.slb" */ #define MAXSUFFIXSIZE 12 + + #ifdef MS_WINDOWS + typedef FARPROC dl_funcptr; + #else + #ifdef PYOS_OS2 + typedef int (* APIENTRY dl_funcptr)(); + #else + typedef void (*dl_funcptr)(void); + #endif + #endif + + + #ifdef __cplusplus + } + #endif + #endif /* !Py_IMPORTDL_H */ From guido@cnri.reston.va.us Mon Dec 20 21:23:44 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:23:44 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.126,2.127 Message-ID: <199912202123.QAA10644@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: import.c Log Message: In _PyImport_Init(), dynamically construct the table of legal suffixes from two static tables (one standard, one provided by the platform's dynload_*.c variant). This is part of a set of patches by Greg Stein. Index: import.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/import.c,v retrieving revision 2.126 retrieving revision 2.127 diff -C2 -r2.126 -r2.127 *** import.c 1999/04/07 16:07:20 2.126 --- import.c 1999/12/20 21:23:41 2.127 *************** *** 95,98 **** --- 95,106 ---- struct _inittab *PyImport_Inittab = _PyImport_Inittab; + /* these tables define the module suffixes that Python recognizes */ + struct filedescr * _PyImport_Filetab = NULL; + static const struct filedescr _PyImport_StandardFiletab[] = { + {".py", "r", PY_SOURCE}, + {".pyc", "rb", PY_COMPILED}, + {0, 0} + }; + /* Initialize things */ *************** *** 100,109 **** _PyImport_Init() { if (Py_OptimizeFlag) { ! /* Replace ".pyc" with ".pyo" in import_filetab */ ! struct filedescr *p; ! for (p = _PyImport_Filetab; p->suffix != NULL; p++) { ! if (strcmp(p->suffix, ".pyc") == 0) ! p->suffix = ".pyo"; } } --- 108,137 ---- _PyImport_Init() { + const struct filedescr *scan; + struct filedescr *filetab; + int countD = 0; + int countS = 0; + + /* prepare _PyImport_Filetab: copy entries from + _PyImport_DynLoadFiletab and _PyImport_StandardFiletab. + */ + for (scan = _PyImport_DynLoadFiletab; scan->suffix != NULL; ++scan) + ++countD; + for (scan = _PyImport_StandardFiletab; scan->suffix != NULL; ++scan) + ++countS; + filetab = malloc((countD + countS + 1) * sizeof(struct filedescr)); + memcpy(filetab, _PyImport_DynLoadFiletab, + countD * sizeof(struct filedescr)); + memcpy(filetab + countD, _PyImport_StandardFiletab, + countS * sizeof(struct filedescr)); + filetab[countD + countS].suffix = NULL; + + _PyImport_Filetab = filetab; + if (Py_OptimizeFlag) { ! /* Replace ".pyc" with ".pyo" in _PyImport_Filetab */ ! for (; filetab->suffix != NULL; filetab++) { ! if (strcmp(filetab->suffix, ".pyc") == 0) ! filetab->suffix = ".pyo"; } } From guido@cnri.reston.va.us Mon Dec 20 21:24:12 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:24:12 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python Makefile.in,2.21,2.22 Message-ID: <199912202124.QAA10667@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: Makefile.in Log Message: Support for selecting the correct dynload_.c file. This is part of a set of patches by Greg Stein. Index: Makefile.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/Makefile.in,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -r2.21 -r2.22 *** Makefile.in 1998/10/07 22:51:56 2.21 --- Makefile.in 1999/12/20 21:24:09 2.22 *************** *** 18,21 **** --- 18,22 ---- LIBS= @LIBS@ DLINCLDIR= @DLINCLDIR@ + DYNLOADFILE= @DYNLOADFILE@ # Machine-dependent subdirectories *************** *** 47,50 **** --- 48,52 ---- structmember.o sysmodule.o \ traceback.o \ + $(DYNLOADFILE) \ $(LIBOBJS) OBJS= $(AROBJS) sigcheck.o *************** *** 92,95 **** --- 94,107 ---- compile.o: compile.c dup2.o: dup2.c + dynload_aix.o: dynload_aix.c + dynload_beos.o: dynload_beos.c + dynload_dl.o: dynload_dl.c + dynload_hpux.o: dynload_hpux.c + dynload_mac.o: dynload_mac.c + dynload_next.o: dynload_next.c + dynload_os2.o: dynload_os2.c + dynload_shlib.o: dynload_shlib.c + dynload_stub.o: dynload_stub.c + dynload_win.o: dynload_win.c errors.o: errors.c fmod.o: fmod.c From guido@cnri.reston.va.us Mon Dec 20 21:24:39 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:24:39 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.25,1.26 Message-ID: <199912202124.QAA10690@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: acconfig.h Log Message: Define HAVE_DYNAMIC_LOADING. This is part of a set of patches by Greg Stein. Index: acconfig.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/acconfig.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** acconfig.h 1999/12/16 17:49:02 1.25 --- acconfig.h 1999/12/20 21:24:37 1.26 *************** *** 143,146 **** --- 143,149 ---- #undef HAVE_LARGEFILE_SUPPORT + /* Defined when any dynamic module loading is enabled */ + #undef HAVE_DYNAMIC_LOADING + /* Leave that blank line there-- autoheader needs it! */ From guido@cnri.reston.va.us Mon Dec 20 21:26:01 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:26:01 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src config.h.in,2.50,2.51 Message-ID: <199912202126.QAA11142@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: config.h.in Log Message: Add line for HAVE_DYNAMIC_LOADING (result of editing acconfig.h). This is part of a set of patches by Greg Stein. Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -r2.50 -r2.51 *** config.h.in 1999/12/16 17:49:27 2.50 --- config.h.in 1999/12/20 21:25:59 2.51 *************** *** 198,201 **** --- 198,204 ---- #undef HAVE_LARGEFILE_SUPPORT + /* Defined when any dynamic module loading is enabled */ + #undef HAVE_DYNAMIC_LOADING + /* The number of bytes in a int. */ #undef SIZEOF_INT From guido@cnri.reston.va.us Mon Dec 20 21:27:25 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:27:25 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src configure,1.105,1.106 configure.in,1.113,1.114 Message-ID: <199912202127.QAA11170@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: configure configure.in Log Message: Changes to auto-detect the correct dynload_.c file. NOTE: Windows, Mac and OS/2 build procedures must be adapted manually! This is part of a set of patches by Greg Stein. Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -r1.105 -r1.106 *** configure 1999/12/16 17:50:52 1.105 --- configure 1999/12/20 21:27:22 1.106 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.113 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.114 [...1309 lines suppressed...] *** 4703,4707 **** } EOF ! if { (eval echo configure:4706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull --- 4787,4791 ---- } EOF ! if { (eval echo configure:4790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull *************** *** 4889,4892 **** --- 4973,4977 ---- s%@LDLAST@%$LDLAST%g s%@DLINCLDIR@%$DLINCLDIR%g + s%@DYNLOADFILE@%$DYNLOADFILE%g s%@LIBOBJS@%$LIBOBJS%g s%@HAVE_GETHOSTBYNAME_R_6_ARG@%$HAVE_GETHOSTBYNAME_R_6_ARG%g Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -r1.113 -r1.114 *** configure.in 1999/12/16 17:50:52 1.113 --- configure.in 1999/12/20 21:27:22 1.114 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.113 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.114 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 692,695 **** --- 692,696 ---- AC_MSG_RESULT($withval) AC_DEFINE(WITH_SGI_DL) + DYNLOADFILE="dynload_dl.o" dldir=$withval if test -d "$dldir" *************** *** 704,707 **** --- 705,709 ---- AC_MSG_RESULT($withval) AC_DEFINE(WITH_DL_DLD) + DYNLOADFILE="dynload_dl.o" dldir=`echo "$withval" | sed 's/,.*//'` dlddir=`echo "$withval" | sed 's/.*,//'` *************** *** 712,715 **** --- 714,748 ---- DLINCLDIR=${dldir} LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no)) + + # the dlopen() function means we might want to use dynload_shlib.o. some + # platforms, such as AIX, have dlopen(), but don't want to use it. + AC_CHECK_FUNC(dlopen) + + # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic + # loading of modules. + AC_SUBST(DYNLOADFILE) + AC_MSG_CHECKING(DYNLOADFILE) + if test -z "$DYNLOADFILE" + then + case $ac_sys_system/$ac_sys_release in + AIX*) DYNLOADFILE="dynload_aix.o";; + BeOS*) DYNLOADFILE="dynload_beos.o";; + hp*|HP*) DYNLOADFILE="dynload_hpux.o";; + next/*) DYNLOADFILE="dynload_next.o";; + *) + # use dynload_shlib.c and dlopen() if we have it; otherwise stub + # out any dynamic loading + if test "$ac_cv_func_dlopen" = yes + then DYNLOADFILE="dynload_shlib.o" + else DYNLOADFILE="dynload_stub.o" + fi + ;; + esac + fi + AC_MSG_RESULT($DYNLOADFILE) + if test "$DYNLOADFILE" != "dynload_stub.o" + then + AC_DEFINE(HAVE_DYNAMIC_LOADING) + fi # checks for library functions From akuchlin@CNRI.Reston.VA.US Mon Dec 20 22:13:41 1999 From: akuchlin@CNRI.Reston.VA.US (Andrew M. Kuchling) Date: Mon, 20 Dec 1999 17:13:41 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules zlibmodule.c,2.27,2.28 Message-ID: <199912202213.RAA03311@amarok.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory amarok:/home/akuchlin/src/Python-1.5/Modules Modified Files: zlibmodule.c Log Message: Fix typo in docstring: wbites -> wbits Index: zlibmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/zlibmodule.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -r2.27 -r2.28 *** zlibmodule.c 1999/04/12 14:35:48 2.27 --- zlibmodule.c 1999/12/20 22:13:38 2.28 *************** *** 854,858 **** "crc32(string) -- Compute a CRC-32 checksum.\n" "crc32(string, start) -- Compute a CRC-32 checksum using a given starting value.\n" ! "decompress(string,[wbites],[bufsize]) -- Decompresses a compressed string.\n" "decompressobj([wbits]) -- Return a decompressor object (wbits=window buffer size).\n\n" "Compressor objects support compress() and flush() methods; decompressor \n" --- 854,858 ---- "crc32(string) -- Compute a CRC-32 checksum.\n" "crc32(string, start) -- Compute a CRC-32 checksum using a given starting value.\n" ! "decompress(string,[wbits],[bufsize]) -- Decompresses a compressed string.\n" "decompressobj([wbits]) -- Return a decompressor object (wbits=window buffer size).\n\n" "Compressor objects support compress() and flush() methods; decompressor \n" From guido@cnri.reston.va.us Mon Dec 20 22:55:05 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 17:55:05 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python importdl.h,2.11,2.12 Message-ID: <199912202255.RAA11664@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: importdl.h Log Message: For Windows, need to add #include . Index: importdl.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/importdl.h,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -r2.11 -r2.12 *** importdl.h 1999/12/20 21:22:24 2.11 --- importdl.h 1999/12/20 22:55:03 2.12 *************** *** 65,68 **** --- 65,69 ---- #ifdef MS_WINDOWS + #include typedef FARPROC dl_funcptr; #else From guido@cnri.reston.va.us Mon Dec 20 22:57:43 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 17:57:43 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/PC config.h,1.29,1.30 Message-ID: <199912202257.RAA11694@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/PC In directory eric:/projects/python/develop/guido/src/PC Modified Files: config.h Log Message: Add HAVE_DYNAMIC_LOADING. Define Py_DEBUG when compiling in debug mode. (Is that a good idea?) Index: config.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/PC/config.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** config.h 1999/06/09 15:36:37 1.29 --- config.h 1999/12/20 22:57:41 1.30 *************** *** 214,217 **** --- 214,218 ---- /* So nobody needs to specify the .lib in their Makefile any more */ #ifdef _DEBUG + #define Py_DEBUG #pragma comment(lib,"python15_d.lib") #else *************** *** 378,381 **** --- 379,385 ---- /* Define if you have clock. */ /* #define HAVE_CLOCK */ + + /* Define when any dynamic module loading is enabled */ + #define HAVE_DYNAMIC_LOADING /* Define if you have ftime. */ From guido@cnri.reston.va.us Mon Dec 20 23:00:13 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 18:00:13 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/PCbuild python15.dsp,1.8,1.9 Message-ID: <199912202300.SAA11742@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/PCbuild In directory eric:/projects/python/develop/guido/src/PCbuild Modified Files: python15.dsp Log Message: Add dynload_win.c to project. Index: python15.dsp =================================================================== RCS file: /projects/cvsroot/python/dist/src/PCbuild/python15.dsp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** python15.dsp 1999/04/13 15:44:21 1.8 --- python15.dsp 1999/12/20 23:00:10 1.9 *************** *** 174,177 **** --- 174,181 ---- # Begin Source File + SOURCE=..\Python\dynload_win.c + # End Source File + # Begin Source File + SOURCE=..\Modules\errnomodule.c # End Source File *************** *** 380,390 **** SOURCE=..\PC\python_nt.rc - - !IF "$(CFG)" == "python15 - Win32 Release" - - !ELSEIF "$(CFG)" == "python15 - Win32 Debug" - - !ENDIF - # End Source File # Begin Source File --- 384,387 ---- From guido@cnri.reston.va.us Mon Dec 20 23:02:44 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 18:02:44 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/PCbuild python.dsp,1.5,1.6 Message-ID: <199912202302.SAA11772@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/PCbuild In directory eric:/projects/python/develop/guido/src/PCbuild Modified Files: python.dsp Log Message: Added setargv.obj to the link link. This causes * etc. on the command line to be expanded, link on Unix. Index: python.dsp =================================================================== RCS file: /projects/cvsroot/python/dist/src/PCbuild/python.dsp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** python.dsp 1998/08/13 18:54:50 1.5 --- python.dsp 1999/12/20 23:02:41 1.6 *************** *** 50,54 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"Release" !ELSEIF "$(CFG)" == "python - Win32 Debug" --- 50,54 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ! # ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"Release" !ELSEIF "$(CFG)" == "python - Win32 Debug" *************** *** 74,78 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"./python_d.exe" /pdbtype:sept /libpath:"Debug" !ENDIF --- 74,78 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"./python_d.exe" /pdbtype:sept /libpath:"Debug" !ENDIF From guido@cnri.reston.va.us Tue Dec 21 15:55:49 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 21 Dec 1999 10:55:49 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python dynload_aix.c,2.1,2.2 Message-ID: <199912211555.KAA12467@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: dynload_aix.c Log Message: Vladimir Marangozov: Here's a patch that avoids a warning caused by the "const char* pathname" declaration for _PyImport_GetDynLoadFunc (in dynload_aix). The "aix_load" function's 1st arg is prototyped as "char *pathname". Index: dynload_aix.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_aix.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_aix.c 1999/12/20 21:18:48 2.1 --- dynload_aix.c 1999/12/21 15:55:47 2.2 *************** *** 222,226 **** if (aix_getoldmodules(&staticmodlistptr) == -1) return NULL; ! p = (dl_funcptr) aix_load(pathname, L_NOAUTODEFER, 0); if (p == NULL) { aix_loaderror(pathname); --- 222,226 ---- if (aix_getoldmodules(&staticmodlistptr) == -1) return NULL; ! p = (dl_funcptr) aix_load((char *)pathname, L_NOAUTODEFER, 0); if (p == NULL) { aix_loaderror(pathname); From fdrake@weyr.cnri.reston.va.us Tue Dec 21 15:59:41 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 21 Dec 1999 10:59:41 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/html style.css Message-ID: <199912211559.KAA23895@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/html In directory weyr:/home/fdrake/projects/python/Doc-152p1/html Modified Files: Tag: release152p1-patches style.css Log Message: Typo: avantgarge --> avantgarde From fdrake@weyr.cnri.reston.va.us Tue Dec 21 18:31:33 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 21 Dec 1999 13:31:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libaifc.tex libwave.tex Message-ID: <199912211831.NAA24968@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libaifc.tex libwave.tex Log Message: Document that the |mode| parameter to open() is optional and explain how the default value is determined. From fdrake@weyr.cnri.reston.va.us Tue Dec 21 18:45:19 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 21 Dec 1999 13:45:19 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libfpformat.tex Message-ID: <199912211845.NAA25069@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libfpformat.tex Log Message: Document 1.5.2+ aspects of the NotANumber exception. (Note that this is in the development branch, not the maintenance branch!) From guido@cnri.reston.va.us Tue Dec 21 22:38:43 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 21 Dec 1999 17:38:43 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib getopt.py,1.7,1.8 Message-ID: <199912212238.RAA13660@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: getopt.py Log Message: Contribution from Gerrit Holl: This patch changes the string-based exceptions to class-based exceptions, so that you can fetch the unknown option as an attribute. As far as I know, it is backward compatible. [The new exception class is called GetoptError; the name error is an alias for compatibility.] Index: getopt.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/getopt.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** getopt.py 1998/11/17 04:16:37 1.7 --- getopt.py 1999/12/21 22:38:40 1.8 *************** *** 8,13 **** provides a single function and an exception: getopt() -- Parse command line options ! error -- Exception (string) raised when bad options are found """ --- 8,17 ---- provides a single function and an exception: + Gerrit Holl moved the string-based exceptions + to class-based exceptions. + getopt() -- Parse command line options ! GetoptError -- exception (class) raised with 'opt' attribute, which is the ! option involved with the exception. """ *************** *** 15,20 **** import string ! error = 'getopt.error' def getopt(args, shortopts, longopts = []): --- 19,38 ---- import string + + class GetoptError(Exception): + opt = '' + msg = '' + def __init__(self, *args): + self.args = args + if len(args) == 1: + self.msg = args[0] + elif len(args) == 2: + self.msg = args[0] + self.opt = args[1] + + def __str__(self): + return self.msg ! error = GetoptError # backward compatibility def getopt(args, shortopts, longopts = []): *************** *** 73,80 **** if optarg is None: if not args: ! raise error, 'option --%s requires argument' % opt optarg, args = args[0], args[1:] elif optarg: ! raise error, 'option --%s must not have an argument' % opt opts.append(('--' + opt, optarg or '')) return opts, args --- 91,98 ---- if optarg is None: if not args: ! raise GetoptError('option --%s requires argument' % opt, opt) optarg, args = args[0], args[1:] elif optarg: ! raise GetoptError('option --%s must not have an argument' % opt, opt) opts.append(('--' + opt, optarg or '')) return opts, args *************** *** 91,99 **** if y != '' and y != '=' and i+1 < len(longopts): if opt == longopts[i+1][:optlen]: ! raise error, 'option --%s not a unique prefix' % opt if longopts[i][-1:] in ('=', ): return 1, longopts[i][:-1] return 0, longopts[i] ! raise error, 'option --' + opt + ' not recognized' def do_shorts(opts, optstring, shortopts, args): --- 109,117 ---- if y != '' and y != '=' and i+1 < len(longopts): if opt == longopts[i+1][:optlen]: ! raise GetoptError('option --%s not a unique prefix' % opt, opt) if longopts[i][-1:] in ('=', ): return 1, longopts[i][:-1] return 0, longopts[i] ! raise GetoptError('option --%s not recognized' % opt, opt) def do_shorts(opts, optstring, shortopts, args): *************** *** 103,107 **** if optstring == '': if not args: ! raise error, 'option -%s requires argument' % opt optstring, args = args[0], args[1:] optarg, optstring = optstring, '' --- 121,125 ---- if optstring == '': if not args: ! raise GetoptError('option -%s requires argument' % opt, opt) optstring, args = args[0], args[1:] optarg, optstring = optstring, '' *************** *** 115,119 **** if opt == shortopts[i] != ':': return shortopts[i+1:i+2] == ':' ! raise error, 'option -%s not recognized' % opt if __name__ == '__main__': --- 133,137 ---- if opt == shortopts[i] != ':': return shortopts[i+1:i+2] == ':' ! raise GetoptError('option -%s not recognized' % opt, opt) if __name__ == '__main__': From fdrake@weyr.cnri.reston.va.us Tue Dec 21 22:50:08 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 21 Dec 1999 17:50:08 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libgetopt.tex Message-ID: <199912212250.RAA03054@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libgetopt.tex Log Message: Document GetoptError and label error an alias. From fdrake@weyr.cnri.reston.va.us Tue Dec 21 23:02:41 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 21 Dec 1999 18:02:41 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc TODO Message-ID: <199912212302.SAA03360@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc In directory weyr:/home/fdrake/projects/python/Doc Modified Files: TODO Log Message: Removed a couple of items that got done(!). Moved a couple to a new "Not worth it" section (explanations were already there). From guido@cnri.reston.va.us Wed Dec 22 14:09:39 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Wed, 22 Dec 1999 09:09:39 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python dynload_aix.c,2.2,2.3 dynload_beos.c,2.1,2.2 dynload_dl.c,2.1,2.2 dynload_hpux.c,2.1,2.2 dynload_mac.c,2.1,2.2 dynload_next.c,2.1,2.2 dynload_os2.c,2.1,2.2 dynload_shlib.c,2.1,2.2 dynload_win.c,2.1,2.2 import.c,2.127,2.128 importdl.c,2.63,2.64 Message-ID: <199912221409.JAA16115@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: dynload_aix.c dynload_beos.c dynload_dl.c dynload_hpux.c dynload_mac.c dynload_next.c dynload_os2.c dynload_shlib.c dynload_win.c import.c importdl.c Log Message: Cleanup patches from Greg Stein: * in import.c, #ifdef out references to dynamic loading based on HAVE_DYNAMIC_LOADING * clean out the platform-specific crud from importdl.c. [ maybe fold this function into import.c and drop the importdl.c file? Greg.] * change GetDynLoadFunc's "funcname" parameter to "shortname". change "name" to "fqname" for clarification. * each GetDynLoadFunc now creates its own funcname value. WARNING: as I mentioned previously, we may run into an issue with a missing "_" on some platforms. Testing will show this pretty quickly, however. * move pathname munging into dynload_shlib.c Index: dynload_aix.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_aix.c,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** dynload_aix.c 1999/12/21 15:55:47 2.2 --- dynload_aix.c 1999/12/22 14:09:35 2.3 *************** *** 203,207 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { --- 203,207 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { Index: dynload_beos.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_beos.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_beos.c 1999/12/20 21:18:48 2.1 --- dynload_beos.c 1999/12/22 14:09:35 2.2 *************** *** 186,190 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { --- 186,190 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { *************** *** 193,196 **** --- 193,197 ---- status_t retval; char fullpath[PATH_MAX]; + char funcname[258]; if( Py_VerboseFlag ) { *************** *** 237,240 **** --- 238,242 ---- } + sprintf(funcname, "init%.200s", shortname); if( Py_VerboseFlag ) { printf( "get_image_symbol( %s )\n", funcname ); *************** *** 275,279 **** * gracefully. */ ! beos_add_dyn( name, the_id ); return p; --- 277,281 ---- * gracefully. */ ! beos_add_dyn( fqname, the_id ); return p; Index: dynload_dl.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_dl.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_dl.c 1999/12/20 21:18:48 2.1 --- dynload_dl.c 1999/12/22 14:09:35 2.2 *************** *** 47,53 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { return dl_loadmod(Py_GetProgramName(), pathname, funcname); } --- 47,56 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { + char funcname[258]; + + sprintf(funcname, "init%.200s", shortname); return dl_loadmod(Py_GetProgramName(), pathname, funcname); } Index: dynload_hpux.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_hpux.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_hpux.c 1999/12/20 21:18:48 2.1 --- dynload_hpux.c 1999/12/22 14:09:35 2.2 *************** *** 38,41 **** --- 38,46 ---- #include "importdl.h" + #if defined(__hp9000s300) + #define FUNCNAME_PATTERN "_init%.200s" + #else + #define FUNCNAME_PATTERN "init%.200s" + #endif const struct filedescr _PyImport_DynLoadFiletab[] = { *************** *** 45,49 **** }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { --- 50,54 ---- }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { *************** *** 51,54 **** --- 56,60 ---- shl_t lib; int flags; + char funcname[258]; flags = BIND_FIRST | BIND_DEFERRED; *************** *** 68,71 **** --- 74,78 ---- return NULL; } + sprintf(funcname, FUNCNAME_PATTERN, shortname); if (Py_VerboseFlag) printf("shl_findsym %s\n", funcname); Index: dynload_mac.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_mac.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_mac.c 1999/12/20 21:18:48 2.1 --- dynload_mac.c 1999/12/22 14:09:35 2.2 *************** *** 60,67 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { dl_funcptr p; /* --- 60,68 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { dl_funcptr p; + char funcname[258]; /* *************** *** 122,125 **** --- 123,127 ---- } /* Locate the address of the correct init function */ + sprintf(funcname, "init%.200s", shortname); err = FindSymbol(connID, Pstring(funcname), &symAddr, &class); if ( err ) { Index: dynload_next.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_next.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_next.c 1999/12/20 21:18:48 2.1 --- dynload_next.c 1999/12/22 14:09:35 2.2 *************** *** 69,76 **** }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { dl_funcptr p = NULL; #ifdef USE_RLD --- 69,79 ---- }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { dl_funcptr p = NULL; + char funcname[258]; + + sprintf(funcname, "_init%.200s", shortname); #ifdef USE_RLD Index: dynload_os2.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_os2.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_os2.c 1999/12/20 21:18:48 2.1 --- dynload_os2.c 1999/12/22 14:09:35 2.2 *************** *** 46,50 **** }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { --- 46,50 ---- }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { *************** *** 53,56 **** --- 53,57 ---- HMODULE hDLL; char failreason[256]; + char funcname[258]; rc = DosLoadModule(failreason, *************** *** 68,71 **** --- 69,73 ---- } + sprintf(funcname, "init%.200s", shortname); rc = DosQueryProcAddr(hDLL, 0L, funcname, &p); if (rc != NO_ERROR) Index: dynload_shlib.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_shlib.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_shlib.c 1999/12/20 21:18:48 2.1 --- dynload_shlib.c 1999/12/22 14:09:35 2.2 *************** *** 66,74 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { dl_funcptr p; void *handle; if (fp != NULL) { --- 66,85 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { dl_funcptr p; void *handle; + char funcname[258]; + char pathbuf[260]; + + if (strchr(pathname, '/') == NULL) { + /* Prefix bare filename with "./" */ + sprintf(pathbuf, "./%-.255s", pathname); + pathname = pathbuf; + } + + /* ### should there be a leading underscore for some platforms? */ + sprintf(funcname, "init%.200s", shortname); if (fp != NULL) { Index: dynload_win.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_win.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_win.c 1999/12/20 21:18:49 2.1 --- dynload_win.c 1999/12/22 14:09:35 2.2 *************** *** 50,57 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { dl_funcptr p; #ifdef MS_WIN32 --- 50,60 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { dl_funcptr p; + char funcname[258]; + + sprintf(funcname, "init%.200s", shortname); #ifdef MS_WIN32 Index: import.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/import.c,v retrieving revision 2.127 retrieving revision 2.128 diff -C2 -r2.127 -r2.128 *** import.c 1999/12/20 21:23:41 2.127 --- import.c 1999/12/22 14:09:35 2.128 *************** *** 1235,1241 **** --- 1235,1243 ---- break; + #ifdef HAVE_DYNAMIC_LOADING case C_EXTENSION: m = _PyImport_LoadDynamicModule(name, buf, fp); break; + #endif #ifdef macintosh *************** *** 2159,2162 **** --- 2161,2166 ---- } + #ifdef HAVE_DYNAMIC_LOADING + static PyObject * imp_load_dynamic(self, args) *************** *** 2181,2184 **** --- 2185,2190 ---- } + #endif /* HAVE_DYNAMIC_LOADING */ + static PyObject * imp_load_source(self, args) *************** *** 2331,2335 **** --- 2337,2343 ---- {"is_frozen", imp_is_frozen, 1}, {"load_compiled", imp_load_compiled, 1}, + #ifdef HAVE_DYNAMIC_LOADING {"load_dynamic", imp_load_dynamic, 1}, + #endif {"load_package", imp_load_package, 1}, #ifdef macintosh Index: importdl.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/importdl.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -r2.63 -r2.64 *** importdl.c 1999/12/20 21:20:42 2.63 --- importdl.c 1999/12/22 14:09:35 2.64 *************** *** 31,89 **** /* Support for dynamic loading of extension modules */ - /* If no dynamic linking is supported, this file still generates some code! */ #include "Python.h" - #include "importdl.h" - - /* Explanation of some of the the various #defines used by dynamic linking... ! symbol -- defined for: ! ! HAVE_DYNAMIC_LOADING -- any kind of dynamic linking (from ./configure) ! USE_SHLIB -- SunOS or IRIX 5 (SVR4?) shared libraries ! _AIX -- AIX style dynamic linking ! __NetBSD__ -- NetBSD shared libraries ! (assuming dlerror() was introduced between 1.2 and 1.3) ! __BEOS__ -- BeOS shared libraries - defined by the compiler */ - - /* Configure dynamic linking */ - #ifdef HAVE_DYNAMIC_LOADING extern dl_funcptr _PyImport_GetDynLoadFunc(const char *name, ! const char *funcname, const char *pathname, FILE *fp); - /* ### given NeXT, is WITH_DYLD not necessary? */ - - #if defined(__hp9000s300) || (defined(__NetBSD__) || defined(__FreeBSD__)) && !defined(__ELF__) || defined(__OpenBSD__) || defined(__BORLANDC__) || defined(NeXT) || defined(WITH_DYLD) - #define FUNCNAME_PATTERN "_init%.200s" - #else - #define FUNCNAME_PATTERN "init%.200s" - #endif - - /* ### temporary, for setting USE_SHLIB */ - #if defined(__NetBSD__) && (NetBSD < 199712) - #define USE_SHLIB - #else - #if defined(HAVE_DLOPEN) || defined(M_UNIX) - #define USE_SHLIB - #endif - #endif - #ifdef _AIX - #undef USE_SHLIB - #endif - #ifdef __BEOS__ - #undef USE_SHLIB - #endif - #endif /* HAVE_DYNAMIC_LOADING */ - - #ifdef NO_DYNAMIC_LINK - #undef HAVE_DYNAMIC_LOADING - #endif - PyObject * _PyImport_LoadDynamicModule(name, pathname, fp) --- 31,52 ---- /* Support for dynamic loading of extension modules */ #include "Python.h" ! /* ./configure sets HAVE_DYNAMIC_LOADING if dynamic loading of modules is ! supported on this platform. configure will then compile and link in one ! of the dynload_*.c files, as appropriate. We will call a function in ! those modules to get a function pointer to the module's init function. */ #ifdef HAVE_DYNAMIC_LOADING + #include "importdl.h" + extern dl_funcptr _PyImport_GetDynLoadFunc(const char *name, ! const char *shortname, const char *pathname, FILE *fp); PyObject * _PyImport_LoadDynamicModule(name, pathname, fp) *************** *** 92,113 **** FILE *fp; { - #ifndef HAVE_DYNAMIC_LOADING - PyErr_SetString(PyExc_ImportError, - "dynamically linked modules not supported"); - return NULL; - #else PyObject *m, *d, *s; - char funcname[258]; char *lastdot, *shortname, *packagecontext; ! dl_funcptr p = NULL; ! ! #ifdef USE_SHLIB ! char pathbuf[260]; ! if (strchr(pathname, '/') == NULL) { ! /* Prefix bare filename with "./" */ ! sprintf(pathbuf, "./%-.255s", pathname); ! pathname = pathbuf; ! } ! #endif /* USE_SHLIB */ if ((m = _PyImport_FindExtension(name, pathname)) != NULL) { --- 55,61 ---- FILE *fp; { PyObject *m, *d, *s; char *lastdot, *shortname, *packagecontext; ! dl_funcptr p; if ((m = _PyImport_FindExtension(name, pathname)) != NULL) { *************** *** 124,136 **** shortname = lastdot+1; } - sprintf(funcname, FUNCNAME_PATTERN, shortname); ! p = _PyImport_GetDynLoadFunc(name, funcname, pathname, fp); if (PyErr_Occurred()) return NULL; if (p == NULL) { PyErr_Format(PyExc_ImportError, ! "dynamic module does not define init function (%.200s)", ! funcname); return NULL; } --- 72,83 ---- shortname = lastdot+1; } ! p = _PyImport_GetDynLoadFunc(name, shortname, pathname, fp); if (PyErr_Occurred()) return NULL; if (p == NULL) { PyErr_Format(PyExc_ImportError, ! "dynamic module does not define init function (init%.200s)", ! shortname); return NULL; } *************** *** 161,164 **** Py_INCREF(m); return m; - #endif /* HAVE_DYNAMIC_LOADING */ } --- 108,112 ---- Py_INCREF(m); return m; } + + #endif /* HAVE_DYNAMIC_LOADING */ From fdrake@weyr.cnri.reston.va.us Wed Dec 22 16:13:57 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 22 Dec 1999 11:13:57 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules zlibmodule.c,2.28,2.29 Message-ID: <199912221613.LAA06244@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: zlibmodule.c Log Message: For ZlibError and ZLIB_VERSION, only attempt to add entry to the module dict if the inserted object isn't NULL (basic defensive programming!). Index: zlibmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/zlibmodule.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -r2.28 -r2.29 *** zlibmodule.c 1999/12/20 22:13:38 2.28 --- zlibmodule.c 1999/12/22 16:13:54 2.29 *************** *** 871,875 **** d = PyModule_GetDict(m); ZlibError = PyErr_NewException("zlib.error", NULL, NULL); ! PyDict_SetItemString(d, "error", ZlibError); insint(d, "MAX_WBITS", MAX_WBITS); --- 871,876 ---- d = PyModule_GetDict(m); ZlibError = PyErr_NewException("zlib.error", NULL, NULL); ! if (ZlibError != NULL) ! PyDict_SetItemString(d, "error", ZlibError); insint(d, "MAX_WBITS", MAX_WBITS); *************** *** 889,893 **** ver = PyString_FromString(ZLIB_VERSION); ! PyDict_SetItemString(d, "ZLIB_VERSION", ver); ! Py_DECREF(ver); } --- 890,896 ---- ver = PyString_FromString(ZLIB_VERSION); ! if (ver != NULL) { ! PyDict_SetItemString(d, "ZLIB_VERSION", ver); ! Py_DECREF(ver); ! } } From akuchlin@CNRI.Reston.VA.US Wed Dec 22 16:56:57 1999 From: akuchlin@CNRI.Reston.VA.US (Andrew M. Kuchling) Date: Wed, 22 Dec 1999 11:56:57 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libzlib.tex Message-ID: <199912221656.LAA06792@amarok.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory amarok:/home/akuchlin/src/Python-1.5/Doc/lib Modified Files: Tag: release152p1-patches libzlib.tex Log Message: Document the Decompress.unused_data attribute. Explain the wbits and bufsize parameters. From fdrake@weyr.cnri.reston.va.us Wed Dec 22 21:52:35 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 22 Dec 1999 16:52:35 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib pprint.py,1.9,1.10 Message-ID: <199912222152.QAA08327@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory weyr:/home/fdrake/projects/python/Lib Modified Files: pprint.py Log Message: Don't call len() if the value is already cached! Caught by Gerrit Holl . Index: pprint.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/pprint.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** pprint.py 1999/09/02 15:09:44 1.9 --- pprint.py 1999/12/22 21:52:32 1.10 *************** *** 142,146 **** self.__format(object[0], stream, indent, allowance + 1, context, level) ! if len(object) > 1: for ent in object[1:]: stream.write(',\n' + ' '*indent) --- 142,146 ---- self.__format(object[0], stream, indent, allowance + 1, context, level) ! if length > 1: for ent in object[1:]: stream.write(',\n' + ' '*indent) From fdrake@weyr.cnri.reston.va.us Thu Dec 23 14:16:58 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 09:16:58 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.146,2.147 Message-ID: <199912231416.JAA11661@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory weyr:/home/fdrake/projects/python/Python Modified Files: bltinmodule.c Log Message: Adjusted apply() docstring based on comments from Gerrit Holl . Index: bltinmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.146 retrieving revision 2.147 diff -C2 -r2.146 -r2.147 *** bltinmodule.c 1999/10/12 19:54:53 2.146 --- bltinmodule.c 1999/12/23 14:16:55 2.147 *************** *** 131,138 **** static char apply_doc[] = ! "apply(function, args[, kwargs]) -> value\n\ \n\ ! Call a function with positional arguments taken from the tuple args,\n\ ! and keyword arguments taken from the optional dictionary kwargs."; --- 131,139 ---- static char apply_doc[] = ! "apply(object, args[, kwargs]) -> value\n\ \n\ ! Call a callable object with positional arguments taken from the tuple args,\n\ ! and keyword arguments taken from the optional dictionary kwargs.\n\ ! Note that classes are callable, as are instances with a __call__() method."; From fdrake@weyr.cnri.reston.va.us Thu Dec 23 15:36:46 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 10:36:46 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_b2.py,1.14,1.15 test_long.py,1.2,1.3 test_pow.py,1.3,1.4 Message-ID: <199912231536.KAA16379@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib/test In directory weyr:/home/fdrake/projects/python/Lib/test Modified Files: test_b2.py test_long.py test_pow.py Log Message: Revise tests to support str() not appending "L". Index: test_b2.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_b2.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** test_b2.py 1998/05/22 15:05:36 1.14 --- test_b2.py 1999/12/23 15:36:42 1.15 *************** *** 210,214 **** if str('') <> '': raise TestFailed, 'str(\'\')' if str(0) <> '0': raise TestFailed, 'str(0)' ! if str(0L) <> '0L': raise TestFailed, 'str(0L)' if str(()) <> '()': raise TestFailed, 'str(())' if str([]) <> '[]': raise TestFailed, 'str([])' --- 210,214 ---- if str('') <> '': raise TestFailed, 'str(\'\')' if str(0) <> '0': raise TestFailed, 'str(0)' ! if str(0L) <> '0': raise TestFailed, 'str(0L)' if str(()) <> '()': raise TestFailed, 'str(())' if str([]) <> '[]': raise TestFailed, 'str([])' Index: test_long.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_long.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_long.py 1998/10/02 01:19:46 1.2 --- test_long.py 1999/12/23 15:36:42 1.3 *************** *** 160,164 **** test_bitop_identities_3(x, y, getran((lenx + leny)/2)) ! # ------------------------------------------------------ hex oct str atol def slow_format(x, base): --- 160,164 ---- test_bitop_identities_3(x, y, getran((lenx + leny)/2)) ! # ------------------------------------------------- hex oct repr str atol def slow_format(x, base): *************** *** 182,186 **** def test_format_1(x): from string import atol ! for base, mapper in (8, oct), (10, str), (16, hex): got = mapper(x) expected = slow_format(x, base) --- 182,186 ---- def test_format_1(x): from string import atol ! for base, mapper in (8, oct), (10, repr), (16, hex): got = mapper(x) expected = slow_format(x, base) *************** *** 188,191 **** --- 188,197 ---- got, "but expected", expected, "for", x) check(atol(got, 0) == x, 'atol("%s", 0) !=' % got, x) + # str() has to be checked a little differently since there's no + # trailing "L" + got = str(x) + expected = slow_format(x, 10)[:-1] + check(got == expected, mapper.__name__, "returned", + got, "but expected", expected, "for", x) def test_format(maxdigits=MAXDIGITS): Index: test_pow.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_pow.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_pow.py 1998/03/26 19:42:30 1.3 --- test_pow.py 1999/12/23 15:36:42 1.4 *************** *** 57,74 **** print 'The number in both columns should match.' ! print pow(3,3) % 8, pow(3,3,8) ! print pow(3,3) % -8, pow(3,3,-8) ! print pow(3,2) % -2, pow(3,2,-2) ! print pow(-3,3) % 8, pow(-3,3,8) ! print pow(-3,3) % -8, pow(-3,3,-8) ! print pow(5,2) % -8, pow(5,2,-8) print ! print pow(3L,3L) % 8, pow(3L,3L,8) ! print pow(3L,3L) % -8, pow(3L,3L,-8) ! print pow(3L,2) % -2, pow(3L,2,-2) ! print pow(-3L,3L) % 8, pow(-3L,3L,8) ! print pow(-3L,3L) % -8, pow(-3L,3L,-8) ! print pow(5L,2) % -8, pow(5L,2,-8) print --- 57,74 ---- print 'The number in both columns should match.' ! print `pow(3,3) % 8`, `pow(3,3,8)` ! print `pow(3,3) % -8`, `pow(3,3,-8)` ! print `pow(3,2) % -2`, `pow(3,2,-2)` ! print `pow(-3,3) % 8`, `pow(-3,3,8)` ! print `pow(-3,3) % -8`, `pow(-3,3,-8)` ! print `pow(5,2) % -8`, `pow(5,2,-8)` print ! print `pow(3L,3L) % 8`, `pow(3L,3L,8)` ! print `pow(3L,3L) % -8`, `pow(3L,3L,-8)` ! print `pow(3L,2) % -2`, `pow(3L,2,-2)` ! print `pow(-3L,3L) % 8`, `pow(-3L,3L,8)` ! print `pow(-3L,3L) % -8`, `pow(-3L,3L,-8)` ! print `pow(5L,2) % -8`, `pow(5L,2,-8)` print From fdrake@weyr.cnri.reston.va.us Thu Dec 23 15:41:31 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 10:41:31 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects longobject.c,1.53,1.54 Message-ID: <199912231541.KAA16419@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory weyr:/home/fdrake/projects/python/Objects Modified Files: longobject.c Log Message: long_format(): Now takes a third parameter, addL; iff true, a trailing 'L' is appended to the representation, otherwise not. All existing call sites are modified to pass true for addL. Remove incorrect statement about external use of this function from elsewhere; it's static! long_str(): Handler for the tp_str slot in the type object. Identical to long_repr(), but passes false as the addL parameter of long_format(). Index: longobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/longobject.c,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -r1.53 -r1.54 *** longobject.c 1999/10/11 22:34:41 1.53 --- longobject.c 1999/12/23 15:41:28 1.54 *************** *** 48,52 **** static PyLongObject *muladd1 Py_PROTO((PyLongObject *, wdigit, wdigit)); static PyLongObject *divrem1 Py_PROTO((PyLongObject *, wdigit, digit *)); ! static PyObject *long_format Py_PROTO((PyObject *aa, int base)); static int ticker; /* XXX Could be shared with ceval? */ --- 48,52 ---- static PyLongObject *muladd1 Py_PROTO((PyLongObject *, wdigit, wdigit)); static PyLongObject *divrem1 Py_PROTO((PyLongObject *, wdigit, digit *)); ! static PyObject *long_format Py_PROTO((PyObject *aa, int base, int addL)); static int ticker; /* XXX Could be shared with ceval? */ *************** *** 571,581 **** /* Convert a long int object to a string, using a given conversion base. Return a string object. ! If base is 8 or 16, add the proper prefix '0' or '0x'. ! External linkage: used in bltinmodule.c by hex() and oct(). */ static PyObject * ! long_format(aa, base) PyObject *aa; int base; { register PyLongObject *a = (PyLongObject *)aa; --- 571,581 ---- /* Convert a long int object to a string, using a given conversion base. Return a string object. ! If base is 8 or 16, add the proper prefix '0' or '0x'. */ static PyObject * ! long_format(aa, base, addL) PyObject *aa; int base; + int addL; { register PyLongObject *a = (PyLongObject *)aa; *************** *** 600,604 **** i >>= 1; } ! i = 6 + (size_a*SHIFT + bits-1) / bits; str = (PyStringObject *) PyString_FromStringAndSize((char *)0, i); if (str == NULL) --- 600,604 ---- i >>= 1; } ! i = 5 + (addL ? 1 : 0) + (size_a*SHIFT + bits-1) / bits; str = (PyStringObject *) PyString_FromStringAndSize((char *)0, i); if (str == NULL) *************** *** 606,610 **** p = PyString_AS_STRING(str) + i; *p = '\0'; ! *--p = 'L'; if (a->ob_size < 0) sign = '-'; --- 606,611 ---- p = PyString_AS_STRING(str) + i; *p = '\0'; ! if (addL) ! *--p = 'L'; if (a->ob_size < 0) sign = '-'; *************** *** 975,981 **** PyObject *v; { ! return long_format(v, 10); } static int long_compare(a, b) --- 976,989 ---- PyObject *v; { ! return long_format(v, 10, 1); } + static PyObject * + long_str(v) + PyObject *v; + { + return long_format(v, 10, 0); + } + static int long_compare(a, b) *************** *** 1757,1761 **** PyObject *v; { ! return long_format(v, 8); } --- 1765,1769 ---- PyObject *v; { ! return long_format(v, 8, 1); } *************** *** 1764,1768 **** PyObject *v; { ! return long_format(v, 16); } --- 1772,1776 ---- PyObject *v; { ! return long_format(v, 16, 1); } *************** *** 1818,1820 **** --- 1826,1830 ---- (long (*) Py_FPROTO((PyObject *))) (hashfunc)long_hash, /*tp_hash*/ + 0, /*tp_call*/ + (reprfunc)long_str, /*tp_str*/ }; From fdrake@weyr.cnri.reston.va.us Thu Dec 23 16:45:59 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 11:45:59 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex Message-ID: <199912231645.LAA16824@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/api In directory weyr:/home/fdrake/projects/python/Doc-152p1/api Modified Files: Tag: release152p1-patches api.tex Log Message: PyString_AsString(): Clarified that the return value points to memory owned by Python, not a copy that needs to be freed. Point out that the contents must not be modified. Need for clarity pointed out by Greg Kochanski . From fdrake@weyr.cnri.reston.va.us Thu Dec 23 16:50:36 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 11:50:36 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex Message-ID: <199912231650.LAA16911@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/api In directory weyr:/home/fdrake/projects/python/Doc-152p1/api Modified Files: Tag: release152p1-patches api.tex Log Message: PyString_AsString(): Strings are *not* NULL terminated; just say it's null-terminated. We *really* need a good proofreader for this stuff! From fdrake@weyr.cnri.reston.va.us Thu Dec 23 17:22:15 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 12:22:15 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc TODO Message-ID: <199912231722.MAA17061@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc In directory weyr:/home/fdrake/projects/python/Doc Modified Files: TODO Log Message: Added item about specific missing entries in the C API manual. From fdrake@weyr.cnri.reston.va.us Thu Dec 23 17:37:41 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 12:37:41 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/ext ext.tex Message-ID: <199912231737.MAA17235@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/ext In directory weyr:/home/fdrake/projects/python/Doc-152p1/ext Modified Files: Tag: release152p1-patches ext.tex Log Message: In the section on PyArg_ParseTuple(), point out that object references are *borrowed* and should not be decrefed. Omission pointed out by Greg Kochanski . From guido@cnri.reston.va.us Thu Dec 23 19:00:31 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Thu, 23 Dec 1999 14:00:31 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects floatobject.c,2.52,2.53 Message-ID: <199912231900.OAA23159@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/projects/python/develop/guido/src/Objects Modified Files: floatobject.c Log Message: Implement the other easy thing: repr() of a float now uses %.17g, while str() uses %.12g as before. Index: floatobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/floatobject.c,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -r2.52 -r2.53 *** floatobject.c 1999/10/12 19:54:48 2.52 --- floatobject.c 1999/12/23 19:00:28 2.53 *************** *** 244,250 **** void ! PyFloat_AsString(buf, v) char *buf; PyFloatObject *v; { register char *cp; --- 244,251 ---- void ! PyFloat_AsStringEx(buf, v, precision) char *buf; PyFloatObject *v; + int precision; { register char *cp; *************** *** 254,258 **** However, %g may print the number as an integer; in such cases, we append ".0" to the string. */ ! sprintf(buf, "%.12g", v->ob_fval); cp = buf; if (*cp == '-') --- 255,259 ---- However, %g may print the number as an integer; in such cases, we append ".0" to the string. */ ! sprintf(buf, "%.*g", precision, v->ob_fval); cp = buf; if (*cp == '-') *************** *** 271,274 **** --- 272,300 ---- } + /* Precisions used by repr() and str(), respectively. + + The repr() precision (17 significant decimal digits) is the minimal number + that is guaranteed to have enough precision so that if the number is read + back in the exact same binary value is recreated. This is true for IEEE + floating point by design, and also happens to work for all other modern + hardware. + + The str() precision is chosen so that in most cases, the rounding noise + created by various operations is suppressed, while giving plenty of + precision for practical use. + + */ + + #define PREC_REPR 17 + #define PREC_STR 12 + + void + PyFloat_AsString(buf, v) + char *buf; + PyFloatObject *v; + { + PyFloat_AsStringEx(buf, v, PREC_STR); + } + /* ARGSUSED */ static int *************** *** 279,283 **** { char buf[100]; ! PyFloat_AsString(buf, v); fputs(buf, fp); return 0; --- 305,309 ---- { char buf[100]; ! PyFloat_AsStringEx(buf, v, flags&Py_PRINT_RAW ? PREC_STR : PREC_REPR); fputs(buf, fp); return 0; *************** *** 288,293 **** PyFloatObject *v; { char buf[100]; ! PyFloat_AsString(buf, v); return PyString_FromString(buf); } --- 314,328 ---- PyFloatObject *v; { + char buf[100]; + PyFloat_AsStringEx(buf, v, PREC_REPR); + return PyString_FromString(buf); + } + + static PyObject * + float_str(v) + PyFloatObject *v; + { char buf[100]; ! PyFloat_AsStringEx(buf, v, PREC_STR); return PyString_FromString(buf); } *************** *** 674,682 **** 0, /*tp_setattr*/ (cmpfunc)float_compare, /*tp_compare*/ ! (reprfunc)float_repr, /*tp_repr*/ &float_as_number, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ ! (hashfunc)float_hash, /*tp_hash*/ }; --- 709,719 ---- 0, /*tp_setattr*/ (cmpfunc)float_compare, /*tp_compare*/ ! (reprfunc)float_repr, /*tp_repr*/ &float_as_number, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ ! (hashfunc)float_hash, /*tp_hash*/ ! 0, /*tp_call*/ ! (reprfunc)float_str, /*tp_str*/ }; From fdrake@weyr.cnri.reston.va.us Thu Dec 30 18:05:46 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 30 Dec 1999 13:05:46 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.121,2.122 Message-ID: <199912301805.NAA04906@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: setup_confname_table(): Use size_t instead of int for an index when building the dicts used to inform the user about the defined constants when using the *conf*() APIs. Thanks to Mark Hammond . Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.121 retrieving revision 2.122 diff -C2 -r2.121 -r2.122 *** posixmodule.c 1999/12/15 18:31:10 2.121 --- posixmodule.c 1999/12/30 18:05:43 2.122 *************** *** 4317,4321 **** if (d != NULL) { PyObject *o; ! int i = 0; for (; i < tablesize; ++i) { --- 4317,4321 ---- if (d != NULL) { PyObject *o; ! size_t i = 0; for (; i < tablesize; ++i) { From fdrake@weyr.cnri.reston.va.us Thu Dec 30 19:18:03 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 30 Dec 1999 14:18:03 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libqueue.tex Message-ID: <199912301918.OAA05040@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libqueue.tex Log Message: The Full exception is raised by put_nowait(), not get_nowait(). Error reported by Justin Sheehy . From fdrake@weyr.cnri.reston.va.us Wed Dec 1 18:42:00 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 1 Dec 1999 13:42:00 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libundoc.tex Message-ID: <199912011842.NAA13373@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libundoc.tex Log Message: Update link to PythonWare library page. From fdrake@weyr.cnri.reston.va.us Wed Dec 1 18:44:10 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 1 Dec 1999 13:44:10 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libundoc.tex Message-ID: <199912011844.NAA13404@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libundoc.tex Log Message: Update link to PythonWare library page. From bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Wed Dec 1 19:01:12 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) (Barry A. Warsaw) Date: Wed, 1 Dec 1999 14:01:12 -0500 (EST) Subject: [Python-checkins] CVS log messages with diffs References: <199911161700.MAA02716@eric.cnri.reston.va.us> <14389.31511.706588.20840@anthem.cnri.reston.va.us> Message-ID: <14405.28792.184298.298597@anthem.cnri.reston.va.us> >>>>> "BAW" == Barry A Warsaw writes: BAW> There was a suggestion to start augmenting the checkin emails BAW> to include the diffs of the checkin. This would let you keep BAW> a current snapshot of the tree without having to do a direct BAW> `cvs update'. The voting has stopped, with the "yeah" vote slightly head of the "nay" vote. We'll go with context diffs, and we'll be implementing Greg Stein's approach with the xml-checkins list: truncating diffs to H number of lines at the top and T number of lines at the bottom, so as not to overwhelm incoming email. I'll try to get this going sometime today (no promises). You'll likely see a number of tests coming through python-checkins in the meantime. I'll send a message out when it's done. -Barry From bwarsaw@cnri.reston.va.us Wed Dec 1 22:34:43 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 1 Dec 1999 17:34:43 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.7,1.8 Message-ID: <199912012234.RAA01747@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Misc In directory anthem:/home/bwarsaw/projects/python/Misc Modified Files: ccpy-style.el Log Message: Minor change to test new CVS reporting [...-40 lines suppressed...] From bwarsaw@cnri.reston.va.us Wed Dec 1 22:39:00 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 1 Dec 1999 17:39:00 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.8,1.9 Message-ID: <199912012239.RAA01775@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Misc In directory anthem:/home/bwarsaw/projects/python/Misc Modified Files: ccpy-style.el Log Message: Minor change to test new CVS reporting From guido@CNRI.Reston.VA.US Wed Dec 1 22:43:03 1999 From: guido@CNRI.Reston.VA.US (Guido van Rossum) Date: Wed, 01 Dec 1999 17:43:03 -0500 Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.7,1.8 In-Reply-To: Your message of "Wed, 01 Dec 1999 17:34:43 EST." <199912012234.RAA01747@anthem.cnri.reston.va.us> References: <199912012234.RAA01747@anthem.cnri.reston.va.us> Message-ID: <199912012243.RAA10832@eric.cnri.reston.va.us> > Update of /projects/cvsroot/python/dist/src/Misc > In directory anthem:/home/bwarsaw/projects/python/Misc > > Modified Files: > ccpy-style.el > Log Message: > Minor change to test new CVS reporting > > > [...-40 lines suppressed...] Sounds like it didn't do quite what you expected? --Guido van Rossum (home page: http://www.python.org/~guido/) From bwarsaw@cnri.reston.va.us Wed Dec 1 22:43:05 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 1 Dec 1999 17:43:05 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.9,1.10 Message-ID: <199912012243.RAA01803@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Misc In directory anthem:/home/bwarsaw/projects/python/Misc Modified Files: ccpy-style.el Log Message: Minor change to test new CVS reporting Error code 1 occurred during diff From bwarsaw@cnri.reston.va.us Wed Dec 1 23:30:48 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 1 Dec 1999 18:30:48 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.19,1.20 Message-ID: <199912012330.SAA02151@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Misc In directory anthem:/home/bwarsaw/projects/python/Misc Modified Files: ccpy-style.el Log Message: more trivial stuff to test CVS -- should be the last? Error code 1 occurred during diff From bwarsaw@cnri.reston.va.us Wed Dec 1 23:40:04 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Wed, 1 Dec 1999 18:40:04 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Misc ccpy-style.el,1.23,1.24 Message-ID: <199912012340.SAA02235@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Misc In directory anthem:/home/bwarsaw/projects/python/Misc Modified Files: ccpy-style.el Log Message: Last try, think I got it now. Index: ccpy-style.el =================================================================== RCS file: /projects/cvsroot/python/dist/src/Misc/ccpy-style.el,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -r1.23 -r1.24 *** ccpy-style.el 1999/12/01 23:38:27 1.23 --- ccpy-style.el 1999/12/01 23:40:01 1.24 *************** *** 15,19 **** ;; ). - ;; To use, make sure this file is on your Emacs load-path, and simply ;; add this to your .emacs file: --- 15,18 ---- From bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Thu Dec 2 04:24:03 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) (Barry A. Warsaw) Date: Wed, 1 Dec 1999 23:24:03 -0500 (EST) Subject: [Python-checkins] CVS log messages with diffs References: <199911161700.MAA02716@eric.cnri.reston.va.us> <14389.31511.706588.20840@anthem.cnri.reston.va.us> Message-ID: <14405.62563.345566.500106@anthem.cnri.reston.va.us> Okay folks, I think I've got the diff thing working now. The trick (for you CVS heads) was that you can't do a `cvs diff' while you're executing a loginfo script. Lock contention (repeat after me: "I Love CVS!"). Anyway, let's see how you all like it. Note that based on a suggestion by Greg Stein, seconded by GvR, I do not send out the entire diff of every file (which could potentially be huge). I send out 20 lines from the head of the diff and 20 lines from the tail, and suppress everything inbetween. Those numbers can be easily tweaked, and I'm not sure what the ideal is. Let's see what the emails look like when stuff starts getting checked in. Enjoy, -Barry From fdrake@weyr.cnri.reston.va.us Fri Dec 3 17:13:59 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 12:13:59 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libarray.tex Message-ID: <199912031713.MAA13379@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libarray.tex Log Message: Correct the documentation for the byteswap method; error pointed out by Bernhard Reiter . Clarified that the repr of array objects is guaranteed to work given "from array import array", not that it was always guaranteed to work regardless of the namespace. Added references to NumPy and the NumPy manual, indicating that an additional array type is provided there. From fdrake@weyr.cnri.reston.va.us Fri Dec 3 17:15:33 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 12:15:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules arraymodule.c,2.35,2.36 Message-ID: <199912031715.MAA13412@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: arraymodule.c Log Message: Correct the docstring for byteswap(); error noted by Bernhard Reiter . Added a check that no parameters were passed to byteswap(); previously allowed any parameters you happened to pass. Index: arraymodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.35 retrieving revision 2.36 diff -u -C2 -r2.35 -r2.36 *** arraymodule.c 1999/08/27 20:33:52 2.35 --- arraymodule.c 1999/12/03 17:15:30 2.36 *************** *** 760,763 **** --- 760,767 ---- char *p; int i; + + if (!PyArg_ParseTuple(args, ":byteswap")) + return NULL; + switch (self->ob_descr->itemsize) { case 1: *************** *** 806,813 **** static char byteswap_doc [] = ! "byteswap(x)\n\ \n\ ! Byteswap all items of the array. This is only supported for integer\n\ ! values of x, which determines the size of the blocks swapped."; static PyObject * --- 810,817 ---- static char byteswap_doc [] = ! "byteswap()\n\ \n\ ! Byteswap all items of the array. If the items in the array are not 1, 2,\n\ ! 4, or 8 bytes in size, RuntimeError is raised."; static PyObject * *************** *** 1140,1144 **** {"append", (PyCFunction)array_append, 0, append_doc}, {"buffer_info", (PyCFunction)array_buffer_info, 0, buffer_info_doc}, ! {"byteswap", (PyCFunction)array_byteswap, 0, byteswap_doc}, /* {"count", (method)array_count},*/ {"fromfile", (PyCFunction)array_fromfile, 0, fromfile_doc}, --- 1144,1149 ---- {"append", (PyCFunction)array_append, 0, append_doc}, {"buffer_info", (PyCFunction)array_buffer_info, 0, buffer_info_doc}, ! {"byteswap", (PyCFunction)array_byteswap, METH_VARARGS, ! byteswap_doc}, /* {"count", (method)array_count},*/ {"fromfile", (PyCFunction)array_fromfile, 0, fromfile_doc}, From fdrake@weyr.cnri.reston.va.us Fri Dec 3 18:12:30 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 13:12:30 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libnis.tex Message-ID: <199912031812.NAA13722@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libnis.tex Log Message: Removed unnecessary XXX comment. From fdrake@weyr.cnri.reston.va.us Fri Dec 3 19:13:37 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 14:13:37 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/ext ext.tex Message-ID: <199912031913.OAA14164@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/ext In directory weyr:/home/fdrake/projects/python/Doc-152p1/ext Modified Files: Tag: release152p1-patches ext.tex Log Message: Added some explanation about the difference initializing modules that are part of an embedding application. Lack of clarity pointed out by Steven Work in a message buried deep in my inbox. From fdrake@weyr.cnri.reston.va.us Fri Dec 3 19:52:50 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 14:52:50 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libos.tex Message-ID: <199912031952.OAA14391@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libos.tex Log Message: Fixed typo and expanded list of functions that return a process status code; fix & suggestion by Gerry Wiener . From fdrake@weyr.cnri.reston.va.us Fri Dec 3 22:00:34 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Fri, 3 Dec 1999 17:00:34 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/tut tut.tex Message-ID: <199912032200.RAA15506@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/tut In directory weyr:/home/fdrake/projects/python/Doc-152p1/tut Modified Files: Tag: release152p1-patches tut.tex Log Message: Try to clarify the "pass by value" explanation in the text, not just the footnote. Roger Irwin reported confusion, and I know this has come up before. From guido@CNRI.Reston.VA.US Mon Dec 6 14:51:08 1999 From: guido@CNRI.Reston.VA.US (Guido van Rossum) Date: Mon, 6 Dec 1999 09:51:08 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib posixfile.py,1.11,1.12 Message-ID: <199912061451.JAA18806@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: posixfile.py Log Message: According to Craig H Rowland, openbsd2 is yet another BSD variant that uses the BSD version of the lock structure. Sigh, @!%$. Index: posixfile.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/posixfile.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** posixfile.py 1999/02/23 04:14:32 1.11 --- posixfile.py 1999/12/06 14:51:05 1.12 *************** *** 179,182 **** --- 179,183 ---- import sys, os if sys.platform in ('netbsd1', + 'openbsd2', 'freebsd2', 'freebsd3', 'bsdos2', 'bsdos3', 'bsdos4'): *************** *** 194,197 **** --- 195,199 ---- if '?' in how: if sys.platform in ('netbsd1', + 'openbsd2', 'freebsd2', 'freebsd3', 'bsdos2', 'bsdos3', 'bsdos4'): From bwarsaw@CNRI.Reston.VA.US Mon Dec 6 02:46:52 1999 From: bwarsaw@CNRI.Reston.VA.US (Barry A. Warsaw) Date: Sun, 5 Dec 1999 21:46:52 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Tools/i18n pygettext.py,1.4,1.5 Message-ID: <199912060246.VAA08410@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Tools/i18n In directory anthem:/home/bwarsaw/projects/python/Tools/i18n Modified Files: pygettext.py Log Message: Added \" to escapes so embedded escaped double quotes are handled correctly. Patch suggested by Mads Kiilerich . Index: pygettext.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Tools/i18n/pygettext.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** pygettext.py 1999/11/03 18:47:52 1.4 --- pygettext.py 1999/12/06 02:46:49 1.5 *************** *** 138,141 **** --- 138,142 ---- escapes[ord('\r')] = '\\r' escapes[ord('\n')] = '\\n' + escapes[ord('\"')] = '\\"' def escape(s): From fdrake@weyr.cnri.reston.va.us Tue Dec 7 15:13:33 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 7 Dec 1999 10:13:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libtime.tex Message-ID: <199912071513.KAA06649@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libtime.tex Log Message: Added note explaining why the seconds field allows as many as 62 seconds in a minute. Confusion noted by Manus Hand . From fdrake@weyr.cnri.reston.va.us Tue Dec 7 20:01:52 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 7 Dec 1999 15:01:52 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/ref ref3.tex Message-ID: <199912072001.PAA08640@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/ref In directory weyr:/home/fdrake/projects/python/Doc-152p1/ref Modified Files: Tag: release152p1-patches ref3.tex Log Message: Follow up on Barry's confusion about bit numbering; use bitmasks instead of bit numbers to describe the bits of the co_flags. From guido@cnri.reston.va.us Tue Dec 7 21:30:33 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Dec 1999 16:30:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.94,1.95 Message-ID: <199912072130.QAA25590@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/projects/python/develop/guido/src/Modules Modified Files: socketmodule.c Log Message: OpenSSL support. This is based on patches for a version of SSLeay by Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by Laszlo Kovacs of HP. Both have kindly given permission to include the patches in the Python distribution. Final formatting by GvR. Index: socketmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.94 retrieving revision 1.95 diff -C2 -r1.94 -r1.95 *** socketmodule.c 1999/11/04 18:22:29 1.94 --- socketmodule.c 1999/12/07 21:30:30 1.95 *************** *** 32,35 **** --- 32,37 ---- /* Socket module */ + /* SSL support based on patches by Brian E Gallew and Laszlo Kovacs */ + /* This module provides an interface to Berkeley socket IPC. *************** *** 57,60 **** --- 59,63 ---- - socket.inet_aton(IP address) -> 32-bit packed IP representation - socket.inet_ntoa(packed IP) -> IP address string + - socket.ssl(socket, keyfile, certfile) -> new ssl object - an Internet socket address is a pair (hostname, port) where hostname can be anything recognized by gethostbyname() *************** *** 191,194 **** --- 194,205 ---- #endif + #ifdef USE_SSL + #include "rsa.h" + #include "crypto.h" + #include "x509.h" + #include "pem.h" + #include "ssl.h" + #include "err.h" + #endif /* USE_SSL */ /* Here we have some hacks to choose between K&R or ANSI style function *************** *** 254,257 **** --- 265,272 ---- static PyObject *PySocket_Error; + #ifdef USE_SSL + static PyObject *SSLErrorObject; + #endif /* USE_SSL */ + /* Convenience function to raise an error according to errno *************** *** 325,329 **** --- 340,367 ---- } PySocketSockObject; + #ifdef USE_SSL + + typedef struct { + PyObject_HEAD + PySocketSockObject *Socket; /* Socket on which we're layered */ + PyObject *x_attr; /* Attributes dictionary */ + SSL_CTX* ctx; + SSL* ssl; + X509* server_cert; + BIO* sbio; + char server[256]; + char issuer[256]; + + } SSLObject; + + staticforward PyTypeObject SSL_Type; + staticforward int SSL_setattr(SSLObject *self, char *name, PyObject *v); + staticforward PyObject *SSL_SSLwrite(SSLObject *self, PyObject *args); + staticforward PyObject *SSL_SSLread(SSLObject *self, PyObject *args); + + #define SSLObject_Check(v) ((v)->ob_type == &SSL_Type) + #endif /* USE_SSL */ + /* A forward reference to the Socktype type object. The Socktype variable contains pointers to various functions, *************** *** 1875,1878 **** --- 1913,2152 ---- } + + #ifdef USE_SSL + + /* This is a C function to be called for new object initialization */ + static SSLObject * + BUILD_FUNC_DEF_3(newSSLObject, + PySocketSockObject *,Sock, char*,key_file, char*,cert_file) + { + SSLObject *self; + char *str; + + #if 0 + meth=SSLv23_client_method(); + meth=SSLv3_client_method(); + meth=SSLv2_client_method(); + #endif + + self = PyObject_NEW(SSLObject, &SSL_Type); /* Create new object */ + if (self == NULL){ + PyErr_SetObject(SSLErrorObject, + PyString_FromString("newSSLObject error")); + return NULL; + } + memset(self->server, NULL, sizeof(char) * 256); + memset(self->issuer, NULL, sizeof(char) * 256); + + self->x_attr = PyDict_New(); + self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */ + if (self->ctx == NULL) { + PyErr_SetObject(SSLErrorObject, + PyString_FromString("SSL_CTX_new error")); + PyMem_DEL(self); + return NULL; + } + + if ( (key_file && !cert_file) || (!key_file && cert_file) ) + { + PyErr_SetObject(SSLErrorObject, + PyString_FromString( + "Both the key & certificate files must be specified")); + PyMem_DEL(self); + return NULL; + } + + if (key_file && cert_file) + { + if (SSL_CTX_use_PrivateKey_file(self->ctx, key_file, + SSL_FILETYPE_PEM) < 1) + { + PyErr_SetObject(SSLErrorObject, + PyString_FromString( + "SSL_CTX_use_PrivateKey_file error")); + PyMem_DEL(self); + return NULL; + } + + if (SSL_CTX_use_certificate_chain_file(self->ctx, + cert_file) < 1) + { + PyErr_SetObject(SSLErrorObject, + PyString_FromString( + "SSL_CTX_use_certificate_chain_file error")); + PyMem_DEL(self); + return NULL; + } + } + + SSL_CTX_set_verify(self->ctx, + SSL_VERIFY_NONE, NULL); /* set verify lvl */ + self->ssl = SSL_new(self->ctx); /* New ssl struct */ + SSL_set_fd(self->ssl, Sock->sock_fd); /* Set the socket for SSL */ + SSL_set_connect_state(self->ssl); + + if ((SSL_connect(self->ssl)) == -1) { + /* Actually negotiate SSL connection */ + PyErr_SetObject(SSLErrorObject, + PyString_FromString("SSL_connect error")); + PyMem_DEL(self); + return NULL; + } + self->ssl->debug = 1; + + if ((self->server_cert = SSL_get_peer_certificate(self->ssl))) { + X509_NAME_oneline(X509_get_subject_name(self->server_cert), + self->server, 256); + X509_NAME_oneline(X509_get_issuer_name(self->server_cert), + self->issuer, 256); + } + self->x_attr = NULL; + self->Socket = Sock; + Py_INCREF(self->Socket); + return self; + } + + /* This is the Python function called for new object initialization */ + static PyObject * + BUILD_FUNC_DEF_2(PySocket_ssl, PyObject *, self, PyObject *, args) + { + SSLObject *rv; + PySocketSockObject *Sock; + char *key_file; + char *cert_file; + + if (!PyArg_ParseTuple(args, "O!zz", + &PySocketSock_Type, (PyObject*)&Sock, + &key_file, &cert_file) ) + return NULL; + + rv = newSSLObject(Sock, key_file, cert_file); + if ( rv == NULL ) + return NULL; + return (PyObject *)rv; + } + + static char ssl_doc[] = + "ssl(socket, keyfile, certfile) -> sslobject"; + + static PyObject * + BUILD_FUNC_DEF_2(SSL_server, SSLObject *, self, PyObject *, args) + { + return PyString_FromString(self->server); + } + + static PyObject * + BUILD_FUNC_DEF_2(SSL_issuer, SSLObject *, self, PyObject *, args) + { + return PyString_FromString(self->issuer); + } + + + /* SSL object methods */ + + static PyMethodDef SSLMethods[] = { + { "write", (PyCFunction)SSL_SSLwrite, 1 }, + { "read", (PyCFunction)SSL_SSLread, 1 }, + { "server", (PyCFunction)SSL_server, 1 }, + { "issuer", (PyCFunction)SSL_issuer, 1 }, + { NULL, NULL} + }; + + static void SSL_dealloc(SSLObject *self) + { + if (self->server_cert) /* Possible not to have one? */ + X509_free (self->server_cert); + SSL_CTX_free(self->ctx); + SSL_free(self->ssl); + Py_XDECREF(self->x_attr); + Py_XDECREF(self->Socket); + PyMem_DEL(self); + } + + static PyObject *SSL_getattr(SSLObject *self, char *name) + { + return Py_FindMethod(SSLMethods, (PyObject *)self, name); + } + + staticforward PyTypeObject SSL_Type = { + PyObject_HEAD_INIT(&PyType_Type) + 0, /*ob_size*/ + "SSL", /*tp_name*/ + sizeof(SSLObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + /* methods */ + (destructor)SSL_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + (getattrfunc)SSL_getattr, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + }; + + + + static PyObject *SSL_SSLwrite(SSLObject *self, PyObject *args) + { + char *data; + int len = 0; + + if (!PyArg_ParseTuple(args, "s|i", &data, &len)) + return NULL; + + if (!len) + len = strlen(data); + + len = SSL_write(self->ssl, data, len); + return PyInt_FromLong((long)len); + } + + static PyObject *SSL_SSLread(SSLObject *self, PyObject *args) + { + PyObject *buf; + int count = 0; + int len = 1024; + int res; + + PyArg_ParseTuple(args, "|i", &len); + + if (!(buf = PyString_FromStringAndSize((char *) 0, len))) + return NULL; /* Error object should already be set */ + + count = SSL_read(self->ssl, PyString_AsString(buf), len); + res = SSL_get_error(self->ssl, count); + + switch (res) { + case 0: /* Good return value! */ + break; + case 6: + PyErr_SetString(SSLErrorObject, "EOF"); + Py_DECREF(buf); + return NULL; + break; + case 5: + default: + return PyErr_SetFromErrno(SSLErrorObject); + break; + } + + fflush(stderr); + + if (count < 0) { + Py_DECREF(buf); + return PyErr_SetFromErrno(SSLErrorObject); + } + + if (count != len && _PyString_Resize(&buf, count) < 0) + return NULL; + return buf; + } + + #endif /* USE_SSL */ + + /* List of functions exported by this module. */ *************** *** 1894,1897 **** --- 2168,2174 ---- {"inet_aton", PySocket_inet_aton, 0, inet_aton_doc}, {"inet_ntoa", PySocket_inet_ntoa, 0, inet_ntoa_doc}, + #ifdef USE_SSL + {"ssl", PySocket_ssl, 1, ssl_doc}, + #endif /* USE_SSL */ {NULL, NULL} /* Sentinel */ }; *************** *** 1982,1986 **** #endif /* PYOS_OS2 */ - /* Initialize this module. * This is called when the first 'import socket' is done, --- 2259,2262 ---- *************** *** 2020,2023 **** --- 2296,2300 ---- inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format\n\ inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)\n\ + ssl() -- secure socket layer support (only available if configured)\n\ \n\ (*) not available on all platforms!)\n\ *************** *** 2093,2096 **** --- 2370,2385 ---- if (PySocket_Error == NULL) return; + #ifdef USE_SSL + SSL_load_error_strings(); + SSLeay_add_ssl_algorithms(); + SSLErrorObject = PyErr_NewException("socket.sslerror", NULL, NULL); + if (SSLErrorObject == NULL) + return; + PyDict_SetItemString(d, "sslerror", SSLErrorObject); + Py_INCREF(&SSL_Type); + if (PyDict_SetItemString(d, "SSLType", + (PyObject *)&SSL_Type) != 0) + return; + #endif /* USE_SSL */ PyDict_SetItemString(d, "error", PySocket_Error); PySocketSock_Type.ob_type = &PyType_Type; From guido@cnri.reston.va.us Tue Dec 7 21:35:22 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Dec 1999 16:35:22 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib httplib.py,1.12,1.13 Message-ID: <199912072135.QAA25621@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: httplib.py Log Message: OpenSSL support. This is based on patches for a version of SSLeay by Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by Laszlo Kovacs of HP. Both have kindly given permission to include the patches in the Python distribution. Final formatting by GvR. Index: httplib.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/httplib.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** httplib.py 1998/01/19 22:25:24 1.12 --- httplib.py 1999/12/07 21:35:20 1.13 *************** *** 29,43 **** """ import socket import string import mimetools HTTP_VERSION = 'HTTP/1.0' HTTP_PORT = 80 class HTTP: """This class manages a connection to an HTTP server.""" ! ! def __init__(self, host = '', port = 0): """Initialize a new instance. --- 29,74 ---- """ + import os import socket import string import mimetools + try: + from cStringIO import StringIO + except: + from StringIO import StringIO + HTTP_VERSION = 'HTTP/1.0' HTTP_PORT = 80 + HTTPS_PORT = 443 + + class FakeSocket: + def __init__(self, sock, ssl): + self.__sock = sock + self.__ssl = ssl + return + + def makefile(self, mode): # hopefully, never have to write + msgbuf = "" + while 1: + try: + msgbuf = msgbuf + self.__ssl.read() + except socket.sslerror, msg: + break + return StringIO(msgbuf) + + def send(self, stuff, flags = 0): + return self.__ssl.write(stuff) + + def recv(self, len = 1024, flags = 0): + return self.__ssl.read(len) + + def __getattr__(self, attr): + return getattr(self.__sock, attr) class HTTP: """This class manages a connection to an HTTP server.""" ! ! def __init__(self, host = '', port = 0, **x509): """Initialize a new instance. *************** *** 47,54 **** """ self.debuglevel = 0 self.file = None if host: self.connect(host, port) ! def set_debuglevel(self, debuglevel): """Set the debug output level. --- 78,87 ---- """ + self.key_file = x509.get('key_file') + self.cert_file = x509.get('cert_file') self.debuglevel = 0 self.file = None if host: self.connect(host, port) ! def set_debuglevel(self, debuglevel): """Set the debug output level. *************** *** 59,66 **** """ self.debuglevel = debuglevel ! def connect(self, host, port = 0): """Connect to a host on a given port. ! Note: This method is automatically invoked by __init__, if a host is specified during instantiation. --- 92,99 ---- """ self.debuglevel = debuglevel ! def connect(self, host, port = 0): """Connect to a host on a given port. ! Note: This method is automatically invoked by __init__, if a host is specified during instantiation. *************** *** 78,87 **** if self.debuglevel > 0: print 'connect:', (host, port) self.sock.connect(host, port) ! def send(self, str): """Send `str' to the server.""" if self.debuglevel > 0: print 'send:', `str` self.sock.send(str) ! def putrequest(self, request, selector): """Send a request to the server. --- 111,120 ---- if self.debuglevel > 0: print 'connect:', (host, port) self.sock.connect(host, port) ! def send(self, str): """Send `str' to the server.""" if self.debuglevel > 0: print 'send:', `str` self.sock.send(str) ! def putrequest(self, request, selector): """Send a request to the server. *************** *** 95,99 **** str = '%s %s %s\r\n' % (request, selector, HTTP_VERSION) self.send(str) ! def putheader(self, header, *args): """Send a request header line to the server. --- 128,132 ---- str = '%s %s %s\r\n' % (request, selector, HTTP_VERSION) self.send(str) ! def putheader(self, header, *args): """Send a request header line to the server. *************** *** 104,115 **** str = '%s: %s\r\n' % (header, string.joinfields(args,'\r\n\t')) self.send(str) ! def endheaders(self): """Indicate that the last header line has been sent to the server.""" self.send('\r\n') ! def getreply(self): """Get a reply from the server. ! Returns a tuple consisting of: - server response code (e.g. '200' if all goes well) --- 137,148 ---- str = '%s: %s\r\n' % (header, string.joinfields(args,'\r\n\t')) self.send(str) ! def endheaders(self): """Indicate that the last header line has been sent to the server.""" self.send('\r\n') ! def getreply(self): """Get a reply from the server. ! Returns a tuple consisting of: - server response code (e.g. '200' if all goes well) *************** *** 137,141 **** self.headers = mimetools.Message(self.file, 0) return errcode, errmsg, self.headers ! def getfile(self): """Get a file object from which to receive data from the HTTP server. --- 170,174 ---- self.headers = mimetools.Message(self.file, 0) return errcode, errmsg, self.headers ! def getfile(self): """Get a file object from which to receive data from the HTTP server. *************** *** 146,150 **** """ return self.file ! def close(self): """Close the connection to the HTTP server.""" --- 179,183 ---- """ return self.file ! def close(self): """Close the connection to the HTTP server.""" *************** *** 156,159 **** --- 189,217 ---- self.sock = None + if hasattr(socket, "ssl"): + class HTTPS(HTTP): + """This class allows communication via SSL.""" + + def connect(self, host, port = 0): + """Connect to a host on a given port. + + Note: This method is automatically invoked by __init__, + if a host is specified during instantiation. + + """ + if not port: + i = string.find(host, ':') + if i >= 0: + host, port = host[:i], host[i+1:] + try: port = string.atoi(port) + except string.atoi_error: + raise socket.error, "nonnumeric port" + if not port: port = HTTPS_PORT + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + if self.debuglevel > 0: print 'connect:', (host, port) + sock.connect(host, port) + ssl = socket.ssl(sock, self.key_file, self.cert_file) + self.sock = FakeSocket(sock, ssl) + def test(): *************** *** 171,174 **** --- 229,233 ---- for o, a in opts: if o == '-d': dl = dl + 1 + print "testing HTTP..." host = 'www.python.org' selector = '/' *************** *** 188,191 **** --- 247,270 ---- print print h.getfile().read() + if hasattr(socket, "ssl"): + print "-"*40 + print "testing HTTPS..." + host = 'synergy.as.cmu.edu' + selector = '/~geek/' + if args[0:]: host = args[0] + if args[1:]: selector = args[1] + h = HTTPS() + h.set_debuglevel(dl) + h.connect(host) + h.putrequest('GET', selector) + h.endheaders() + errcode, errmsg, headers = h.getreply() + print 'errcode =', errcode + print 'errmsg =', errmsg + print + if headers: + for header in headers.headers: print string.strip(header) + print + print h.getfile().read() From guido@cnri.reston.va.us Tue Dec 7 21:37:20 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Dec 1999 16:37:20 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib urllib.py,1.88,1.89 Message-ID: <199912072137.QAA25644@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: urllib.py Log Message: OpenSSL support. This is based on patches for a version of SSLeay by Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by Laszlo Kovacs of HP. Both have kindly given permission to include the patches in the Python distribution. Final formatting by GvR. Index: urllib.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/urllib.py,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -r1.88 -r1.89 *** urllib.py 1999/08/18 17:40:33 1.88 --- urllib.py 1999/12/07 21:37:17 1.89 *************** *** 28,32 **** ! __version__ = '1.11' # XXX This version is not always updated :-( MAXFTPCACHE = 10 # Trim the ftp cache beyond this size --- 28,32 ---- ! __version__ = '1.12' # XXX This version is not always updated :-( MAXFTPCACHE = 10 # Trim the ftp cache beyond this size *************** *** 82,90 **** # Constructor ! def __init__(self, proxies=None): if proxies is None: proxies = getproxies() assert hasattr(proxies, 'has_key'), "proxies must be a mapping" self.proxies = proxies server_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-agent', server_version)] --- 82,92 ---- # Constructor ! def __init__(self, proxies=None, **x509): if proxies is None: proxies = getproxies() assert hasattr(proxies, 'has_key'), "proxies must be a mapping" self.proxies = proxies + self.key_file = x509.get('key_file') + self.cert_file = x509.get('cert_file') server_version = "Python-urllib/%s" % __version__ self.addheaders = [('User-agent', server_version)] *************** *** 145,148 **** --- 147,151 ---- url = (host, fullurl) # Signal special case to open_*() name = 'open_' + type + self.type = type if '-' in name: # replace - with _ *************** *** 295,298 **** --- 298,337 ---- raise IOError, ('http error', errcode, errmsg, headers) + # Use HTTPS protocol + if hasattr(socket, "ssl"): + def open_https(self, url): + import httplib + if type(url) is type(""): + host, selector = splithost(url) + user_passwd, host = splituser(host) + else: + host, selector = url + urltype, rest = splittype(selector) + if string.lower(urltype) == 'https': + realhost, rest = splithost(rest) + user_passwd, realhost = splituser(realhost) + if user_passwd: + selector = "%s://%s%s" % (urltype, realhost, rest) + print "proxy via https:", host, selector + if not host: raise IOError, ('https error', 'no host given') + if user_passwd: + import base64 + auth = string.strip(base64.encodestring(user_passwd)) + else: + auth = None + h = httplib.HTTPS(host, 0, + key_file=self.key_file, + cert_file=self.cert_file) + h.putrequest('GET', selector) + if auth: h.putheader('Authorization: Basic %s' % auth) + for args in self.addheaders: apply(h.putheader, args) + h.endheaders() + errcode, errmsg, headers = h.getreply() + fp = h.getfile() + if errcode == 200: + return addinfourl(fp, headers, url) + else: + return self.http_error(url, fp, errcode, errmsg, headers) + # Use Gopher protocol def open_gopher(self, url): *************** *** 478,482 **** scheme, realm = match.groups() if string.lower(scheme) == 'basic': ! return self.retry_http_basic_auth(url, realm, data) def retry_http_basic_auth(self, url, realm, data): --- 517,522 ---- scheme, realm = match.groups() if string.lower(scheme) == 'basic': ! name = 'retry_' + self.type + '_basic_auth' ! return getattr(self,name)(url, realm) def retry_http_basic_auth(self, url, realm, data): *************** *** 489,492 **** --- 529,542 ---- newurl = 'http://' + host + selector return self.open(newurl, data) + + def retry_https_basic_auth(self, url, realm): + host, selector = splithost(url) + i = string.find(host, '@') + 1 + host = host[i:] + user, passwd = self.get_user_passwd(host, realm, i) + if not (user or passwd): return None + host = user + ':' + passwd + '@' + host + newurl = '//' + host + selector + return self.open_https(newurl) def get_user_passwd(self, host, realm, clear_cache = 0): *************** *** 631,636 **** self.read = self.fp.read self.readline = self.fp.readline ! self.readlines = self.fp.readlines ! self.fileno = self.fp.fileno def __repr__(self): return '<%s at %s whose fp = %s>' % (self.__class__.__name__, --- 681,686 ---- self.read = self.fp.read self.readline = self.fp.readline ! if hasattr(self.fp, "readlines"): self.readlines = self.fp.readlines ! if hasattr(self.fp, "fileno"): self.fileno = self.fp.fileno def __repr__(self): return '<%s at %s whose fp = %s>' % (self.__class__.__name__, *************** *** 1016,1019 **** --- 1066,1071 ---- 'http://www.python.org/index.html', ] + if hasattr(URLopener, "open_https"): + args.append('https://synergy.as.cmu.edu/~geek/') try: for url in args: From guido@cnri.reston.va.us Tue Dec 7 21:47:12 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 7 Dec 1999 16:47:12 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules Setup.in,1.88,1.89 Message-ID: <199912072147.QAA25724@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/projects/python/develop/guido/src/Modules Modified Files: Setup.in Log Message: OpenSSL support. This is based on patches for a version of SSLeay by Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by Laszlo Kovacs of HP. Both have kindly given permission to include the patches in the Python distribution. Final formatting by GvR. Index: Setup.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/Setup.in,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -r1.88 -r1.89 *** Setup.in 1999/03/24 19:03:56 1.88 --- Setup.in 1999/12/07 21:47:09 1.89 *************** *** 146,153 **** pwd pwdmodule.c # pwd(3) grp grpmodule.c # grp(3) select selectmodule.c # select(2); not on ancient System V socket socketmodule.c # socket(2); not on ancient System V #_socket socketmodule.c # socket(2); use this one for BeOS sockets ! errno errnomodule.c # posix (UNIX) errno values # The crypt module is now disabled by default because it breaks builds --- 146,159 ---- pwd pwdmodule.c # pwd(3) grp grpmodule.c # grp(3) + errno errnomodule.c # posix (UNIX) errno values select selectmodule.c # select(2); not on ancient System V socket socketmodule.c # socket(2); not on ancient System V #_socket socketmodule.c # socket(2); use this one for BeOS sockets ! ! # Socket module compiled with SSL support; you must edit the SSL variable: ! #SSL=/usr/local/ssl ! #socket socketmodule.c \ ! # -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ ! # -L$(SSL)/lib -lssl -lcrypto # The crypt module is now disabled by default because it breaks builds From fdrake@weyr.cnri.reston.va.us Thu Dec 9 21:13:10 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 9 Dec 1999 16:13:10 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.115,2.116 Message-ID: <199912092113.QAA22913@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Added support for abort(), ctermid(), tmpfile(), tempnam(), tmpnam(), and TMP_MAX. Converted all functions that used PyArg_Parse() or PyArg_NoArgs() to use PyArg_ParseTuple() and specified all function names using the :name syntax in the format strings, to allow better error messages when TypeError is raised for parameter type mismatches. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.115 retrieving revision 2.116 diff -u -C2 -r2.115 -r2.116 *** posixmodule.c 1999/10/19 13:29:23 2.115 --- posixmodule.c 1999/12/09 21:13:07 2.116 *************** *** 432,442 **** static PyObject * ! posix_int(args, func) PyObject *args; int (*func) Py_FPROTO((int)); { int fd; int res; ! if (!PyArg_Parse(args, "i", &fd)) return NULL; [...1720 lines suppressed...] #endif + #ifdef HAVE_TEMPNAM + {"tempnam", posix_tempnam, METH_VARARGS, posix_tempnam__doc__}, + #endif + #ifdef HAVE_TMPNAM + {"tmpnam", posix_tmpnam, METH_VARARGS, posix_tmpnam__doc__}, + #endif + {"abort", posix_abort, METH_VARARGS, posix_abort__doc__}, {NULL, NULL} /* Sentinel */ }; *************** *** 3426,3429 **** --- 3586,3592 ---- if (ins(d, "X_OK", (long)X_OK)) return -1; #endif + #ifdef TMP_MAX + if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1; + #endif #ifdef WNOHANG if (ins(d, "WNOHANG", (long)WNOHANG)) return -1; From fdrake@weyr.cnri.reston.va.us Thu Dec 9 22:03:29 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 9 Dec 1999 17:03:29 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src configure,1.100,1.101 configure.in,1.108,1.109 config.h.in,2.45,2.46 Message-ID: <199912092203.RAA23412@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory weyr:/home/fdrake/projects/python Modified Files: configure configure.in config.h.in Log Message: Added support for ctermid, tempnam, tmpfile, tmpnam, and tmpnam_r. Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.100 retrieving revision 1.101 diff -u -C2 -r1.100 -r1.101 *** configure 1999/11/16 15:57:37 1.100 --- configure 1999/12/09 22:03:25 1.101 *************** *** 3190,3194 **** # checks for library functions ! for ac_func in alarm chown clock dlopen execv flock fork \ fsync fdatasync ftime ftruncate \ getpeername getpgrp getpid getpwent gettimeofday getwd \ --- 3190,3194 ---- # checks for library functions ! for ac_func in alarm chown clock ctermid ctermid_r dlopen execv flock fork \ fsync fdatasync ftime ftruncate \ [...1190 lines suppressed...] #include --- 4640,4644 ---- else cat > conftest.$ac_ext < *************** *** 4658,4662 **** } EOF ! if { (eval echo configure:4661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull --- 4659,4663 ---- } EOF ! if { (eval echo configure:4662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.108 retrieving revision 1.109 diff -u -C2 -r1.108 -r1.109 *** configure.in 1999/11/16 15:57:37 1.108 --- configure.in 1999/12/09 22:03:25 1.109 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.108 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.109 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 680,684 **** # checks for library functions ! AC_CHECK_FUNCS(alarm chown clock dlopen execv flock fork \ fsync fdatasync ftime ftruncate \ getpeername getpgrp getpid getpwent gettimeofday getwd \ --- 680,684 ---- # checks for library functions ! AC_CHECK_FUNCS(alarm chown clock ctermid ctermid_r dlopen execv flock fork \ fsync fdatasync ftime ftruncate \ getpeername getpgrp getpid getpwent gettimeofday getwd \ *************** *** 686,690 **** select setgid setlocale setuid setsid setpgid setpgrp setvbuf \ sigaction siginterrupt sigrelse strftime strptime symlink \ ! tcgetpgrp tcsetpgrp timegm times truncate uname waitpid) # check for long file support functions --- 686,691 ---- select setgid setlocale setuid setsid setpgid setpgrp setvbuf \ sigaction siginterrupt sigrelse strftime strptime symlink \ ! tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ ! truncate uname waitpid) # check for long file support functions Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.45 retrieving revision 2.46 diff -u -C2 -r2.45 -r2.46 *** config.h.in 1999/11/16 15:55:56 2.45 --- config.h.in 1999/12/09 22:03:25 2.46 *************** *** 216,219 **** --- 216,225 ---- #undef HAVE_CLOCK + /* Define if you have the ctermid function. */ + #undef HAVE_CTERMID + + /* Define if you have the ctermid_r function. */ + #undef HAVE_CTERMID_R + /* Define if you have the dlopen function. */ #undef HAVE_DLOPEN *************** *** 375,378 **** --- 381,387 ---- #undef HAVE_TCSETPGRP + /* Define if you have the tempnam function. */ + #undef HAVE_TEMPNAM + /* Define if you have the timegm function. */ #undef HAVE_TIMEGM *************** *** 380,383 **** --- 389,401 ---- /* Define if you have the times function. */ #undef HAVE_TIMES + + /* Define if you have the tmpfile function. */ + #undef HAVE_TMPFILE + + /* Define if you have the tmpnam function. */ + #undef HAVE_TMPNAM + + /* Define if you have the tmpnam_r function. */ + #undef HAVE_TMPNAM_R /* Define if you have the truncate function. */ From fdrake@weyr.cnri.reston.va.us Thu Dec 9 22:11:46 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 9 Dec 1999 17:11:46 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libos.tex Message-ID: <199912092211.RAA23643@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libos.tex Log Message: Document the new stuff in the os module. From guido@cnri.reston.va.us Fri Dec 10 15:12:13 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Fri, 10 Dec 1999 10:12:13 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules almodule.c,1.21,1.22 Message-ID: <199912101512.KAA09516@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/projects/python/develop/guido/src/Modules Modified Files: almodule.c Log Message: The call to PyArg_ParseTuple in al_Connect had one too few arguments. This fixes PR#157. Index: almodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/almodule.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -r1.21 -r1.22 *** almodule.c 1998/08/31 14:14:09 1.21 --- almodule.c 1999/12/10 15:12:11 1.22 *************** *** 1546,1550 **** PyObject *propobj = NULL; ! if (!PyArg_ParseTuple(args, "ii|O!", &source, &dest, &propobj)) return NULL; if (propobj != NULL) { --- 1546,1550 ---- PyObject *propobj = NULL; ! if (!PyArg_ParseTuple(args, "ii|O!", &source, &dest, &PyList_Type, &propobj)) return NULL; if (propobj != NULL) { From fdrake@weyr.cnri.reston.va.us Mon Dec 13 16:23:38 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 13 Dec 1999 11:23:38 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src config.h.in,2.46,2.47 configure.in,1.109,1.110 configure,1.101,1.102 Message-ID: <199912131623.LAA17249@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory weyr:/home/fdrake/projects/python Modified Files: config.h.in configure.in configure Log Message: Added detection for getgroups(), fpathconf(), pathconf(), confstr(), and sysconf(). Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.46 retrieving revision 2.47 diff -C2 -r2.46 -r2.47 *** config.h.in 1999/12/09 22:03:25 2.46 --- config.h.in 1999/12/13 16:23:34 2.47 *************** *** 270,273 **** --- 270,276 ---- #undef HAVE_GETPEERNAME + /* Define if you have the getgroups function. */ + #undef HAVE_GETGROUPS + /* Define if you have the getpgrp function. */ #undef HAVE_GETPGRP *************** *** 284,287 **** --- 287,302 ---- /* Define if you have the getwd function. */ #undef HAVE_GETWD + + /* Define if you have the fpathconf function. */ + #undef HAVE_FPATHCONF + + /* Define if you have the pathconf function. */ + #undef HAVE_PATHCONF + + /* Define if you have the confstr function. */ + #undef HAVE_CONFSTR + + /* Define if you have the sysconf function. */ + #undef HAVE_SYSCONF /* Define if you have the hypot function. */ Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -r1.109 -r1.110 *** configure.in 1999/12/09 22:03:25 1.109 --- configure.in 1999/12/13 16:23:34 1.110 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.109 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.110 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 680,689 **** # checks for library functions ! AC_CHECK_FUNCS(alarm chown clock ctermid ctermid_r dlopen execv flock fork \ ! fsync fdatasync ftime ftruncate \ ! getpeername getpgrp getpid getpwent gettimeofday getwd \ ! kill link lstat mkfifo mktime nice pause plock pthread_init putenv readlink \ select setgid setlocale setuid setsid setpgid setpgrp setvbuf \ ! sigaction siginterrupt sigrelse strftime strptime symlink \ tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname waitpid) --- 680,690 ---- # checks for library functions ! AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \ ! flock fork fsync fdatasync fpathconf ftime ftruncate \ ! getgroups getpeername getpgrp getpid getpwent gettimeofday getwd \ ! kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \ ! putenv readlink \ select setgid setlocale setuid setsid setpgid setpgrp setvbuf \ ! sigaction siginterrupt sigrelse strftime strptime symlink sysconf \ tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname waitpid) Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -r1.101 -r1.102 *** configure 1999/12/09 22:03:25 1.101 --- configure 1999/12/13 16:23:35 1.102 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.108 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.109 [...1204 lines suppressed...] #include --- 4641,4645 ---- else cat > conftest.$ac_ext < *************** *** 4659,4663 **** } EOF ! if { (eval echo configure:4662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull --- 4660,4664 ---- } EOF ! if { (eval echo configure:4663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull From fdrake@weyr.cnri.reston.va.us Mon Dec 13 16:37:28 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 13 Dec 1999 11:37:28 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.116,2.117 Message-ID: <199912131637.LAA17318@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Added bindings for getgroups(), fpathconf(), pathconf(), confstr(), and sysconf(). *Lots* of tables to define names used by *conf*(); explanation to go in message to python-dev list. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.116 retrieving revision 2.117 diff -C2 -r2.116 -r2.117 *** posixmodule.c 1999/12/09 21:13:07 2.116 --- posixmodule.c 1999/12/13 16:37:25 2.117 *************** *** 1723,1726 **** --- 1723,1772 ---- + #ifdef HAVE_GETGROUPS + static char posix_getgroups__doc__[] = "\ + getgroups() -> list of group IDs\n\ + Return list of supplemental group IDs for the process."; + + static PyObject * + posix_getgroups(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + + if (PyArg_ParseTuple(args, ":getgroups")) { + #ifdef NGROUPS_MAX + #define MAX_GROUPS NGROUPS_MAX + #else + /* defined to be 16 on Solaris7, so this should be a small number */ + #define MAX_GROUPS 64 + #endif + gid_t grouplist[MAX_GROUPS]; + int n; + + n = getgroups(MAX_GROUPS, grouplist); + if (n < 0) + posix_error(); + else { + result = PyList_New(n); + if (result != NULL) { + PyObject *o; + int i; + for (i = 0; i < n; ++i) { + o = PyInt_FromLong((long)grouplist[i]); + if (o == NULL) { + Py_DECREF(result); + result = NULL; + break; + } + PyList_SET_ITEM(result, i, o); + } + } + } + } + return result; + } + #endif + #ifdef HAVE_GETPGRP static char posix_getpgrp__doc__[] = *************** *** 3294,3297 **** --- 3340,4141 ---- + /* This is used for fpathconf(), pathconf(), confstr() and sysconf(). + * It maps strings representing configuration variable names to + * integer values, allowing those functions to be called with the + * magic names instead of poluting the module's namespace with tons of + * rarely-used constants. + */ + struct constdef { + char *name; + long value; + }; + + static struct constdef posix_constants_pathconf[] = { + #ifdef _PC_ASYNC_IO + {"PC_ASYNC_IO", _PC_ASYNC_IO}, + #endif + #ifdef _PC_CHOWN_RESTRICTED + {"PC_CHOWN_RESTRICTED", _PC_CHOWN_RESTRICTED}, + #endif + #ifdef _PC_FILESIZEBITS + {"PC_FILESIZEBITS", _PC_FILESIZEBITS}, + #endif + #ifdef _PC_LAST + {"PC_LAST", _PC_LAST}, + #endif + #ifdef _PC_LINK_MAX + {"PC_LINK_MAX", _PC_LINK_MAX}, + #endif + #ifdef _PC_MAX_CANON + {"PC_MAX_CANON", _PC_MAX_CANON}, + #endif + #ifdef _PC_MAX_INPUT + {"PC_MAX_INPUT", _PC_MAX_INPUT}, + #endif + #ifdef _PC_NAME_MAX + {"PC_NAME_MAX", _PC_NAME_MAX}, + #endif + #ifdef _PC_NO_TRUNC + {"PC_NO_TRUNC", _PC_NO_TRUNC}, + #endif + #ifdef _PC_PATH_MAX + {"PC_PATH_MAX", _PC_PATH_MAX}, + #endif + #ifdef _PC_PIPE_BUF + {"PC_PIPE_BUF", _PC_PIPE_BUF}, + #endif + #ifdef _PC_PRIO_IO + {"PC_PRIO_IO", _PC_PRIO_IO}, + #endif + #ifdef _PC_SOCK_MAXBUF + {"PC_SOCK_MAXBUF", _PC_SOCK_MAXBUF}, + #endif + #ifdef _PC_SYNC_IO + {"PC_SYNC_IO", _PC_SYNC_IO}, + #endif + #ifdef _PC_VDISABLE + {"PC_VDISABLE", _PC_VDISABLE}, + #endif + }; + + + static int + conv_confname(arg, valuep, table, tablesize) + PyObject *arg; + int *valuep; + struct constdef *table; + size_t tablesize; + { + if (PyInt_Check(arg)) { + *valuep = PyInt_AS_LONG(arg); + return 1; + } + if (PyString_Check(arg)) { + /* look up the value in the table using a binary search */ + int lo = 0; + int hi = tablesize; + int cmp, mid; + char *confname = PyString_AS_STRING(arg); + printf("table: %d entries\n", tablesize); + while (lo < hi) { + mid = (lo + hi) / 2; + printf("%d confname='%s'; other='%s';\n", + mid, confname, table[mid].name); + cmp = strcmp(confname, table[mid].name); + if (cmp < 0) + hi = mid; + else if (cmp > 0) + lo = mid + 1; + else { + *valuep = table[mid].value; + return 1; + } + } + PyErr_SetString(PyExc_ValueError, "unrecognized configuration name"); + } + else + PyErr_SetString(PyExc_TypeError, + "configuration names must be strings or integers"); + return 0; + } + + + #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) + static int + conv_path_confname(arg, valuep) + PyObject *arg; + int *valuep; + { + return conv_confname(arg, valuep, posix_constants_pathconf, + sizeof(posix_constants_pathconf) + / sizeof(struct constdef)); + } + #endif + + #ifdef HAVE_FPATHCONF + static char posix_fpathconf__doc__[] = "\ + fpathconf(fd, name) -> integer\n\ + Return the configuration limit name for the file descriptor fd.\n\ + If there is no limit, return -1."; + + static PyObject * + posix_fpathconf(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + int name, fd; + + if (PyArg_ParseTuple(args, "iO&:fpathconf", &fd, conv_confname, &name)) { + long limit; + + errno = 0; + limit = fpathconf(fd, name); + if (limit == -1 && errno != 0) + posix_error(); + else + result = PyInt_FromLong(limit); + } + return result; + } + #endif + + + #ifdef HAVE_PATHCONF + static char posix_pathconf__doc__[] = "\ + pathconf(path, name) -> integer\n\ + Return the configuration limit name for the file or directory path.\n\ + If there is no limit, return -1."; + + static PyObject * + posix_pathconf(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + int name; + char *path; + + if (PyArg_ParseTuple(args, "sO&:pathconf", &path, + conv_path_confname, &name)) { + long limit; + + errno = 0; + limit = pathconf(path, name); + if (limit == -1 && errno != 0) + if (errno == EINVAL) + /* could be a path or name problem */ + posix_error(); + else + posix_error_with_filename(path); + else + result = PyInt_FromLong(limit); + } + return result; + } + #endif + + #ifdef HAVE_CONFSTR + static struct constdef posix_constants_confstr[] = { + #ifdef _CS_LFS64_CFLAGS + {"CS_LFS64_CFLAGS", _CS_LFS64_CFLAGS}, + #endif + #ifdef _CS_LFS64_LDFLAGS + {"CS_LFS64_LDFLAGS", _CS_LFS64_LDFLAGS}, + #endif + #ifdef _CS_LFS64_LIBS + {"CS_LFS64_LIBS", _CS_LFS64_LIBS}, + #endif + #ifdef _CS_LFS64_LINTFLAGS + {"CS_LFS64_LINTFLAGS", _CS_LFS64_LINTFLAGS}, + #endif + #ifdef _CS_LFS_CFLAGS + {"CS_LFS_CFLAGS", _CS_LFS_CFLAGS}, + #endif + #ifdef _CS_LFS_LDFLAGS + {"CS_LFS_LDFLAGS", _CS_LFS_LDFLAGS}, + #endif + #ifdef _CS_LFS_LIBS + {"CS_LFS_LIBS", _CS_LFS_LIBS}, + #endif + #ifdef _CS_LFS_LINTFLAGS + {"CS_LFS_LINTFLAGS", _CS_LFS_LINTFLAGS}, + #endif + #ifdef _CS_PATH + {"CS_PATH", _CS_PATH}, + #endif + #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS + {"CS_XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS}, + #endif + #ifdef _CS_XBS5_ILP32_OFF32_LDFLAGS + {"CS_XBS5_ILP32_OFF32_LDFLAGS", _CS_XBS5_ILP32_OFF32_LDFLAGS}, + #endif + #ifdef _CS_XBS5_ILP32_OFF32_LIBS + {"CS_XBS5_ILP32_OFF32_LIBS", _CS_XBS5_ILP32_OFF32_LIBS}, + #endif + #ifdef _CS_XBS5_ILP32_OFF32_LINTFLAGS + {"CS_XBS5_ILP32_OFF32_LINTFLAGS", _CS_XBS5_ILP32_OFF32_LINTFLAGS}, + #endif + #ifdef _CS_XBS5_ILP32_OFFBIG_CFLAGS + {"CS_XBS5_ILP32_OFFBIG_CFLAGS", _CS_XBS5_ILP32_OFFBIG_CFLAGS}, + #endif + #ifdef _CS_XBS5_ILP32_OFFBIG_LDFLAGS + {"CS_XBS5_ILP32_OFFBIG_LDFLAGS", _CS_XBS5_ILP32_OFFBIG_LDFLAGS}, + #endif + #ifdef _CS_XBS5_ILP32_OFFBIG_LIBS + {"CS_XBS5_ILP32_OFFBIG_LIBS", _CS_XBS5_ILP32_OFFBIG_LIBS}, + #endif + #ifdef _CS_XBS5_ILP32_OFFBIG_LINTFLAGS + {"CS_XBS5_ILP32_OFFBIG_LINTFLAGS", _CS_XBS5_ILP32_OFFBIG_LINTFLAGS}, + #endif + #ifdef _CS_XBS5_LP64_OFF64_CFLAGS + {"CS_XBS5_LP64_OFF64_CFLAGS", _CS_XBS5_LP64_OFF64_CFLAGS}, + #endif + #ifdef _CS_XBS5_LP64_OFF64_LDFLAGS + {"CS_XBS5_LP64_OFF64_LDFLAGS", _CS_XBS5_LP64_OFF64_LDFLAGS}, + #endif + #ifdef _CS_XBS5_LP64_OFF64_LIBS + {"CS_XBS5_LP64_OFF64_LIBS", _CS_XBS5_LP64_OFF64_LIBS}, + #endif + #ifdef _CS_XBS5_LP64_OFF64_LINTFLAGS + {"CS_XBS5_LP64_OFF64_LINTFLAGS", _CS_XBS5_LP64_OFF64_LINTFLAGS}, + #endif + #ifdef _CS_XBS5_LPBIG_OFFBIG_CFLAGS + {"CS_XBS5_LPBIG_OFFBIG_CFLAGS", _CS_XBS5_LPBIG_OFFBIG_CFLAGS}, + #endif + #ifdef _CS_XBS5_LPBIG_OFFBIG_LDFLAGS + {"CS_XBS5_LPBIG_OFFBIG_LDFLAGS", _CS_XBS5_LPBIG_OFFBIG_LDFLAGS}, + #endif + #ifdef _CS_XBS5_LPBIG_OFFBIG_LIBS + {"CS_XBS5_LPBIG_OFFBIG_LIBS", _CS_XBS5_LPBIG_OFFBIG_LIBS}, + #endif + #ifdef _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS + {"CS_XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS}, + #endif + }; + + static int + conv_confstr_confname(arg, valuep) + PyObject *arg; + int *valuep; + { + return conv_confname(arg, valuep, posix_constants_confstr, + sizeof(posix_constants_confstr) + / sizeof(struct constdef)); + } + + static char posix_confstr__doc__[] = "\ + confstr(name) -> string\n\ + Return a string-valued system configuration variable."; + + static PyObject * + posix_confstr(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + int name; + char buffer[64]; + + if (PyArg_ParseTuple(args, "O&:confstr", conv_confstr_confname, &name)) { + int len = confstr(name, buffer, sizeof(buffer)); + + printf("confstr(%d) --> %d, '%s'\n", name, len, buffer); + errno = 0; + if (len == 0) { + if (errno != 0) + posix_error(); + else + result = PyString_FromString(""); + } + else { + if (len >= sizeof(buffer)) { + result = PyString_FromStringAndSize(NULL, len); + if (result != NULL) + confstr(name, PyString_AS_STRING(result), len+1); + } + else + result = PyString_FromString(buffer); + } + } + return result; + } + #endif + + + #ifdef HAVE_SYSCONF + static struct constdef posix_constants_sysconf[] = { + #ifdef _SC_2_CHAR_TERM + {"SC_2_CHAR_TERM", _SC_2_CHAR_TERM}, + #endif + #ifdef _SC_2_C_BIND + {"SC_2_C_BIND", _SC_2_C_BIND}, + #endif + #ifdef _SC_2_C_DEV + {"SC_2_C_DEV", _SC_2_C_DEV}, + #endif + #ifdef _SC_2_C_VERSION + {"SC_2_C_VERSION", _SC_2_C_VERSION}, + #endif + #ifdef _SC_2_FORT_DEV + {"SC_2_FORT_DEV", _SC_2_FORT_DEV}, + #endif + #ifdef _SC_2_FORT_RUN + {"SC_2_FORT_RUN", _SC_2_FORT_RUN}, + #endif + #ifdef _SC_2_LOCALEDEF + {"SC_2_LOCALEDEF", _SC_2_LOCALEDEF}, + #endif + #ifdef _SC_2_SW_DEV + {"SC_2_SW_DEV", _SC_2_SW_DEV}, + #endif + #ifdef _SC_2_UPE + {"SC_2_UPE", _SC_2_UPE}, + #endif + #ifdef _SC_2_VERSION + {"SC_2_VERSION", _SC_2_VERSION}, + #endif + #ifdef _SC_AIO_LISTIO_MAX + {"SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX}, + #endif + #ifdef _SC_AIO_LIST_MAX + {"SC_AIO_LIST_MAX", _SC_AIO_LIST_MAX}, + #endif + #ifdef _SC_AIO_MAX + {"SC_AIO_MAX", _SC_AIO_MAX}, + #endif + #ifdef _SC_AIO_PRIO_DELTA_MAX + {"SC_AIO_PRIO_DELTA_MAX", _SC_AIO_PRIO_DELTA_MAX}, + #endif + #ifdef _SC_ARG_MAX + {"SC_ARG_MAX", _SC_ARG_MAX}, + #endif + #ifdef _SC_ASYNCHRONOUS_IO + {"SC_ASYNCHRONOUS_IO", _SC_ASYNCHRONOUS_IO}, + #endif + #ifdef _SC_ATEXIT_MAX + {"SC_ATEXIT_MAX", _SC_ATEXIT_MAX}, + #endif + #ifdef _SC_AVPHYS_PAGES + {"SC_AVPHYS_PAGES", _SC_AVPHYS_PAGES}, + #endif + #ifdef _SC_BC_BASE_MAX + {"SC_BC_BASE_MAX", _SC_BC_BASE_MAX}, + #endif + #ifdef _SC_BC_DIM_MAX + {"SC_BC_DIM_MAX", _SC_BC_DIM_MAX}, + #endif + #ifdef _SC_BC_SCALE_MAX + {"SC_BC_SCALE_MAX", _SC_BC_SCALE_MAX}, + #endif + #ifdef _SC_BC_STRING_MAX + {"SC_BC_STRING_MAX", _SC_BC_STRING_MAX}, + #endif + #ifdef _SC_CHARCLASS_NAME_MAX + {"SC_CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX}, + #endif + #ifdef _SC_CHAR_BIT + {"SC_CHAR_BIT", _SC_CHAR_BIT}, + #endif + #ifdef _SC_CHAR_MAX + {"SC_CHAR_MAX", _SC_CHAR_MAX}, + #endif + #ifdef _SC_CHAR_MIN + {"SC_CHAR_MIN", _SC_CHAR_MIN}, + #endif + #ifdef _SC_CHILD_MAX + {"SC_CHILD_MAX", _SC_CHILD_MAX}, + #endif + #ifdef _SC_CLK_TCK + {"SC_CLK_TCK", _SC_CLK_TCK}, + #endif + #ifdef _SC_COHER_BLKSZ + {"SC_COHER_BLKSZ", _SC_COHER_BLKSZ}, + #endif + #ifdef _SC_COLL_WEIGHTS_MAX + {"SC_COLL_WEIGHTS_MAX", _SC_COLL_WEIGHTS_MAX}, + #endif + #ifdef _SC_DCACHE_ASSOC + {"SC_DCACHE_ASSOC", _SC_DCACHE_ASSOC}, + #endif + #ifdef _SC_DCACHE_BLKSZ + {"SC_DCACHE_BLKSZ", _SC_DCACHE_BLKSZ}, + #endif + #ifdef _SC_DCACHE_LINESZ + {"SC_DCACHE_LINESZ", _SC_DCACHE_LINESZ}, + #endif + #ifdef _SC_DCACHE_SZ + {"SC_DCACHE_SZ", _SC_DCACHE_SZ}, + #endif + #ifdef _SC_DCACHE_TBLKSZ + {"SC_DCACHE_TBLKSZ", _SC_DCACHE_TBLKSZ}, + #endif + #ifdef _SC_DELAYTIMER_MAX + {"SC_DELAYTIMER_MAX", _SC_DELAYTIMER_MAX}, + #endif + #ifdef _SC_EQUIV_CLASS_MAX + {"SC_EQUIV_CLASS_MAX", _SC_EQUIV_CLASS_MAX}, + #endif + #ifdef _SC_EXPR_NEST_MAX + {"SC_EXPR_NEST_MAX", _SC_EXPR_NEST_MAX}, + #endif + #ifdef _SC_FSYNC + {"SC_FSYNC", _SC_FSYNC}, + #endif + #ifdef _SC_GETGR_R_SIZE_MAX + {"SC_GETGR_R_SIZE_MAX", _SC_GETGR_R_SIZE_MAX}, + #endif + #ifdef _SC_GETPW_R_SIZE_MAX + {"SC_GETPW_R_SIZE_MAX", _SC_GETPW_R_SIZE_MAX}, + #endif + #ifdef _SC_ICACHE_ASSOC + {"SC_ICACHE_ASSOC", _SC_ICACHE_ASSOC}, + #endif + #ifdef _SC_ICACHE_BLKSZ + {"SC_ICACHE_BLKSZ", _SC_ICACHE_BLKSZ}, + #endif + #ifdef _SC_ICACHE_LINESZ + {"SC_ICACHE_LINESZ", _SC_ICACHE_LINESZ}, + #endif + #ifdef _SC_ICACHE_SZ + {"SC_ICACHE_SZ", _SC_ICACHE_SZ}, + #endif + #ifdef _SC_INT_MAX + {"SC_INT_MAX", _SC_INT_MAX}, + #endif + #ifdef _SC_INT_MIN + {"SC_INT_MIN", _SC_INT_MIN}, + #endif + #ifdef _SC_IOV_MAX + {"SC_IOV_MAX", _SC_IOV_MAX}, + #endif + #ifdef _SC_JOB_CONTROL + {"SC_JOB_CONTROL", _SC_JOB_CONTROL}, + #endif + #ifdef _SC_LINE_MAX + {"SC_LINE_MAX", _SC_LINE_MAX}, + #endif + #ifdef _SC_LOGIN_NAME_MAX + {"SC_LOGIN_NAME_MAX", _SC_LOGIN_NAME_MAX}, + #endif + #ifdef _SC_LOGNAME_MAX + {"SC_LOGNAME_MAX", _SC_LOGNAME_MAX}, + #endif + #ifdef _SC_LONG_BIT + {"SC_LONG_BIT", _SC_LONG_BIT}, + #endif + #ifdef _SC_MAPPED_FILES + {"SC_MAPPED_FILES", _SC_MAPPED_FILES}, + #endif + #ifdef _SC_MAXPID + {"SC_MAXPID", _SC_MAXPID}, + #endif + #ifdef _SC_MB_LEN_MAX + {"SC_MB_LEN_MAX", _SC_MB_LEN_MAX}, + #endif + #ifdef _SC_MEMLOCK + {"SC_MEMLOCK", _SC_MEMLOCK}, + #endif + #ifdef _SC_MEMLOCK_RANGE + {"SC_MEMLOCK_RANGE", _SC_MEMLOCK_RANGE}, + #endif + #ifdef _SC_MEMORY_PROTECTION + {"SC_MEMORY_PROTECTION", _SC_MEMORY_PROTECTION}, + #endif + #ifdef _SC_MESSAGE_PASSING + {"SC_MESSAGE_PASSING", _SC_MESSAGE_PASSING}, + #endif + #ifdef _SC_MQ_OPEN_MAX + {"SC_MQ_OPEN_MAX", _SC_MQ_OPEN_MAX}, + #endif + #ifdef _SC_MQ_PRIO_MAX + {"SC_MQ_PRIO_MAX", _SC_MQ_PRIO_MAX}, + #endif + #ifdef _SC_NGROUPS_MAX + {"SC_NGROUPS_MAX", _SC_NGROUPS_MAX}, + #endif + #ifdef _SC_NL_ARGMAX + {"SC_NL_ARGMAX", _SC_NL_ARGMAX}, + #endif + #ifdef _SC_NL_LANGMAX + {"SC_NL_LANGMAX", _SC_NL_LANGMAX}, + #endif + #ifdef _SC_NL_MSGMAX + {"SC_NL_MSGMAX", _SC_NL_MSGMAX}, + #endif + #ifdef _SC_NL_NMAX + {"SC_NL_NMAX", _SC_NL_NMAX}, + #endif + #ifdef _SC_NL_SETMAX + {"SC_NL_SETMAX", _SC_NL_SETMAX}, + #endif + #ifdef _SC_NL_TEXTMAX + {"SC_NL_TEXTMAX", _SC_NL_TEXTMAX}, + #endif + #ifdef _SC_NPROCESSORS_CONF + {"SC_NPROCESSORS_CONF", _SC_NPROCESSORS_CONF}, + #endif + #ifdef _SC_NPROCESSORS_ONLN + {"SC_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN}, + #endif + #ifdef _SC_NZERO + {"SC_NZERO", _SC_NZERO}, + #endif + #ifdef _SC_OPEN_MAX + {"SC_OPEN_MAX", _SC_OPEN_MAX}, + #endif + #ifdef _SC_PAGESIZE + {"SC_PAGESIZE", _SC_PAGESIZE}, + #endif + #ifdef _SC_PAGE_SIZE + {"SC_PAGE_SIZE", _SC_PAGE_SIZE}, + #endif + #ifdef _SC_PASS_MAX + {"SC_PASS_MAX", _SC_PASS_MAX}, + #endif + #ifdef _SC_PHYS_PAGES + {"SC_PHYS_PAGES", _SC_PHYS_PAGES}, + #endif + #ifdef _SC_PII + {"SC_PII", _SC_PII}, + #endif + #ifdef _SC_PII_INTERNET + {"SC_PII_INTERNET", _SC_PII_INTERNET}, + #endif + #ifdef _SC_PII_INTERNET_DGRAM + {"SC_PII_INTERNET_DGRAM", _SC_PII_INTERNET_DGRAM}, + #endif + #ifdef _SC_PII_INTERNET_STREAM + {"SC_PII_INTERNET_STREAM", _SC_PII_INTERNET_STREAM}, + #endif + #ifdef _SC_PII_OSI + {"SC_PII_OSI", _SC_PII_OSI}, + #endif + #ifdef _SC_PII_OSI_CLTS + {"SC_PII_OSI_CLTS", _SC_PII_OSI_CLTS}, + #endif + #ifdef _SC_PII_OSI_COTS + {"SC_PII_OSI_COTS", _SC_PII_OSI_COTS}, + #endif + #ifdef _SC_PII_OSI_M + {"SC_PII_OSI_M", _SC_PII_OSI_M}, + #endif + #ifdef _SC_PII_SOCKET + {"SC_PII_SOCKET", _SC_PII_SOCKET}, + #endif + #ifdef _SC_PII_XTI + {"SC_PII_XTI", _SC_PII_XTI}, + #endif + #ifdef _SC_POLL + {"SC_POLL", _SC_POLL}, + #endif + #ifdef _SC_PRIORITIZED_IO + {"SC_PRIORITIZED_IO", _SC_PRIORITIZED_IO}, + #endif + #ifdef _SC_PRIORITY_SCHEDULING + {"SC_PRIORITY_SCHEDULING", _SC_PRIORITY_SCHEDULING}, + #endif + #ifdef _SC_REALTIME_SIGNALS + {"SC_REALTIME_SIGNALS", _SC_REALTIME_SIGNALS}, + #endif + #ifdef _SC_RE_DUP_MAX + {"SC_RE_DUP_MAX", _SC_RE_DUP_MAX}, + #endif + #ifdef _SC_RTSIG_MAX + {"SC_RTSIG_MAX", _SC_RTSIG_MAX}, + #endif + #ifdef _SC_SAVED_IDS + {"SC_SAVED_IDS", _SC_SAVED_IDS}, + #endif + #ifdef _SC_SCHAR_MAX + {"SC_SCHAR_MAX", _SC_SCHAR_MAX}, + #endif + #ifdef _SC_SCHAR_MIN + {"SC_SCHAR_MIN", _SC_SCHAR_MIN}, + #endif + #ifdef _SC_SELECT + {"SC_SELECT", _SC_SELECT}, + #endif + #ifdef _SC_SEMAPHORES + {"SC_SEMAPHORES", _SC_SEMAPHORES}, + #endif + #ifdef _SC_SEM_NSEMS_MAX + {"SC_SEM_NSEMS_MAX", _SC_SEM_NSEMS_MAX}, + #endif + #ifdef _SC_SEM_VALUE_MAX + {"SC_SEM_VALUE_MAX", _SC_SEM_VALUE_MAX}, + #endif + #ifdef _SC_SHARED_MEMORY_OBJECTS + {"SC_SHARED_MEMORY_OBJECTS", _SC_SHARED_MEMORY_OBJECTS}, + #endif + #ifdef _SC_SHRT_MAX + {"SC_SHRT_MAX", _SC_SHRT_MAX}, + #endif + #ifdef _SC_SHRT_MIN + {"SC_SHRT_MIN", _SC_SHRT_MIN}, + #endif + #ifdef _SC_SIGQUEUE_MAX + {"SC_SIGQUEUE_MAX", _SC_SIGQUEUE_MAX}, + #endif + #ifdef _SC_SIGRT_MAX + {"SC_SIGRT_MAX", _SC_SIGRT_MAX}, + #endif + #ifdef _SC_SIGRT_MIN + {"SC_SIGRT_MIN", _SC_SIGRT_MIN}, + #endif + #ifdef _SC_SPLIT_CACHE + {"SC_SPLIT_CACHE", _SC_SPLIT_CACHE}, + #endif + #ifdef _SC_SSIZE_MAX + {"SC_SSIZE_MAX", _SC_SSIZE_MAX}, + #endif + #ifdef _SC_STACK_PROT + {"SC_STACK_PROT", _SC_STACK_PROT}, + #endif + #ifdef _SC_STREAM_MAX + {"SC_STREAM_MAX", _SC_STREAM_MAX}, + #endif + #ifdef _SC_SYNCHRONIZED_IO + {"SC_SYNCHRONIZED_IO", _SC_SYNCHRONIZED_IO}, + #endif + #ifdef _SC_THREADS + {"SC_THREADS", _SC_THREADS}, + #endif + #ifdef _SC_THREAD_ATTR_STACKADDR + {"SC_THREAD_ATTR_STACKADDR", _SC_THREAD_ATTR_STACKADDR}, + #endif + #ifdef _SC_THREAD_ATTR_STACKSIZE + {"SC_THREAD_ATTR_STACKSIZE", _SC_THREAD_ATTR_STACKSIZE}, + #endif + #ifdef _SC_THREAD_DESTRUCTOR_ITERATIONS + {"SC_THREAD_DESTRUCTOR_ITERATIONS", _SC_THREAD_DESTRUCTOR_ITERATIONS}, + #endif + #ifdef _SC_THREAD_KEYS_MAX + {"SC_THREAD_KEYS_MAX", _SC_THREAD_KEYS_MAX}, + #endif + #ifdef _SC_THREAD_PRIORITY_SCHEDULING + {"SC_THREAD_PRIORITY_SCHEDULING", _SC_THREAD_PRIORITY_SCHEDULING}, + #endif + #ifdef _SC_THREAD_PRIO_INHERIT + {"SC_THREAD_PRIO_INHERIT", _SC_THREAD_PRIO_INHERIT}, + #endif + #ifdef _SC_THREAD_PRIO_PROTECT + {"SC_THREAD_PRIO_PROTECT", _SC_THREAD_PRIO_PROTECT}, + #endif + #ifdef _SC_THREAD_PROCESS_SHARED + {"SC_THREAD_PROCESS_SHARED", _SC_THREAD_PROCESS_SHARED}, + #endif + #ifdef _SC_THREAD_SAFE_FUNCTIONS + {"SC_THREAD_SAFE_FUNCTIONS", _SC_THREAD_SAFE_FUNCTIONS}, + #endif + #ifdef _SC_THREAD_STACK_MIN + {"SC_THREAD_STACK_MIN", _SC_THREAD_STACK_MIN}, + #endif + #ifdef _SC_THREAD_THREADS_MAX + {"SC_THREAD_THREADS_MAX", _SC_THREAD_THREADS_MAX}, + #endif + #ifdef _SC_TIMERS + {"SC_TIMERS", _SC_TIMERS}, + #endif + #ifdef _SC_TIMER_MAX + {"SC_TIMER_MAX", _SC_TIMER_MAX}, + #endif + #ifdef _SC_TTY_NAME_MAX + {"SC_TTY_NAME_MAX", _SC_TTY_NAME_MAX}, + #endif + #ifdef _SC_TZNAME_MAX + {"SC_TZNAME_MAX", _SC_TZNAME_MAX}, + #endif + #ifdef _SC_T_IOV_MAX + {"SC_T_IOV_MAX", _SC_T_IOV_MAX}, + #endif + #ifdef _SC_UCHAR_MAX + {"SC_UCHAR_MAX", _SC_UCHAR_MAX}, + #endif + #ifdef _SC_UINT_MAX + {"SC_UINT_MAX", _SC_UINT_MAX}, + #endif + #ifdef _SC_UIO_MAXIOV + {"SC_UIO_MAXIOV", _SC_UIO_MAXIOV}, + #endif + #ifdef _SC_ULONG_MAX + {"SC_ULONG_MAX", _SC_ULONG_MAX}, + #endif + #ifdef _SC_USHRT_MAX + {"SC_USHRT_MAX", _SC_USHRT_MAX}, + #endif + #ifdef _SC_VERSION + {"SC_VERSION", _SC_VERSION}, + #endif + #ifdef _SC_WORD_BIT + {"SC_WORD_BIT", _SC_WORD_BIT}, + #endif + #ifdef _SC_XBS5_ILP32_OFF32 + {"SC_XBS5_ILP32_OFF32", _SC_XBS5_ILP32_OFF32}, + #endif + #ifdef _SC_XBS5_ILP32_OFFBIG + {"SC_XBS5_ILP32_OFFBIG", _SC_XBS5_ILP32_OFFBIG}, + #endif + #ifdef _SC_XBS5_LP64_OFF64 + {"SC_XBS5_LP64_OFF64", _SC_XBS5_LP64_OFF64}, + #endif + #ifdef _SC_XBS5_LPBIG_OFFBIG + {"SC_XBS5_LPBIG_OFFBIG", _SC_XBS5_LPBIG_OFFBIG}, + #endif + #ifdef _SC_XOPEN_CRYPT + {"SC_XOPEN_CRYPT", _SC_XOPEN_CRYPT}, + #endif + #ifdef _SC_XOPEN_ENH_I18N + {"SC_XOPEN_ENH_I18N", _SC_XOPEN_ENH_I18N}, + #endif + #ifdef _SC_XOPEN_LEGACY + {"SC_XOPEN_LEGACY", _SC_XOPEN_LEGACY}, + #endif + #ifdef _SC_XOPEN_REALTIME + {"SC_XOPEN_REALTIME", _SC_XOPEN_REALTIME}, + #endif + #ifdef _SC_XOPEN_REALTIME_THREADS + {"SC_XOPEN_REALTIME_THREADS", _SC_XOPEN_REALTIME_THREADS}, + #endif + #ifdef _SC_XOPEN_SHM + {"SC_XOPEN_SHM", _SC_XOPEN_SHM}, + #endif + #ifdef _SC_XOPEN_UNIX + {"SC_XOPEN_UNIX", _SC_XOPEN_UNIX}, + #endif + #ifdef _SC_XOPEN_VERSION + {"SC_XOPEN_VERSION", _SC_XOPEN_VERSION}, + #endif + #ifdef _SC_XOPEN_XCU_VERSION + {"SC_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION}, + #endif + #ifdef _SC_XOPEN_XPG2 + {"SC_XOPEN_XPG2", _SC_XOPEN_XPG2}, + #endif + #ifdef _SC_XOPEN_XPG3 + {"SC_XOPEN_XPG3", _SC_XOPEN_XPG3}, + #endif + #ifdef _SC_XOPEN_XPG4 + {"SC_XOPEN_XPG4", _SC_XOPEN_XPG4}, + #endif + }; + + static int + conv_sysconf_confname(arg, valuep) + PyObject *arg; + int *valuep; + { + return conv_confname(arg, valuep, posix_constants_sysconf, + sizeof(posix_constants_sysconf) + / sizeof(struct constdef)); + } + + static char posix_sysconf__doc__[] = "\ + sysconf(name) -> integer\n\ + Return an integer-valued system configuration variable."; + + static PyObject * + posix_sysconf(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + int name; + + if (PyArg_ParseTuple(args, "O&:sysconf", conv_sysconf_confname, &name)) { + int value; + + errno = 0; + value = sysconf(name); + if (value == -1 && errno != 0) + posix_error(); + else + result = PyInt_FromLong(value); + } + return result; + } + #endif + + static char posix_abort__doc__[] = "\ abort() -> does not return!\n\ *************** *** 3381,3384 **** --- 4225,4231 ---- {"getgid", posix_getgid, METH_VARARGS, posix_getgid__doc__}, #endif /* HAVE_GETGID */ + #ifdef HAVE_GETGROUPS + {"getgroups", posix_getgroups, METH_VARARGS, posix_getgroups__doc__}, + #endif {"getpid", posix_getpid, METH_VARARGS, posix_getpid__doc__}, #ifdef HAVE_GETPGRP *************** *** 3492,3495 **** --- 4339,4354 ---- {"tmpnam", posix_tmpnam, METH_VARARGS, posix_tmpnam__doc__}, #endif + #ifdef HAVE_CONFSTR + {"confstr", posix_confstr, METH_VARARGS, posix_confstr__doc__}, + #endif + #ifdef HAVE_SYSCONF + {"sysconf", posix_sysconf, METH_VARARGS, posix_sysconf__doc__}, + #endif + #ifdef HAVE_FPATHCONF + {"fpathconf", posix_fpathconf, METH_VARARGS, posix_fpathconf__doc__}, + #endif + #ifdef HAVE_PATHCONF + {"pathconf", posix_pathconf, METH_VARARGS, posix_pathconf__doc__}, + #endif {"abort", posix_abort, METH_VARARGS, posix_abort__doc__}, {NULL, NULL} /* Sentinel */ *************** *** 3586,3589 **** --- 4445,4451 ---- if (ins(d, "X_OK", (long)X_OK)) return -1; #endif + #ifdef NGROUPS_MAX + if (ins(d, "NGROUPS_MAX", (long)NGROUPS_MAX)) return -1; + #endif #ifdef TMP_MAX if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1; *************** *** 3683,3687 **** return; Py_DECREF(v); ! if (all_ins(d)) return; --- 4545,4549 ---- return; Py_DECREF(v); ! if (all_ins(d)) return; From fdrake@weyr.cnri.reston.va.us Mon Dec 13 16:55:27 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 13 Dec 1999 11:55:27 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.117,2.118 Message-ID: <199912131655.LAA17456@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Removed debugging prints. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.117 retrieving revision 2.118 diff -C2 -r2.117 -r2.118 *** posixmodule.c 1999/12/13 16:37:25 2.117 --- posixmodule.c 1999/12/13 16:55:24 2.118 *************** *** 3417,3425 **** int cmp, mid; char *confname = PyString_AS_STRING(arg); - printf("table: %d entries\n", tablesize); while (lo < hi) { mid = (lo + hi) / 2; - printf("%d confname='%s'; other='%s';\n", - mid, confname, table[mid].name); cmp = strcmp(confname, table[mid].name); if (cmp < 0) --- 3417,3422 ---- *************** *** 3621,3625 **** int len = confstr(name, buffer, sizeof(buffer)); - printf("confstr(%d) --> %d, '%s'\n", name, len, buffer); errno = 0; if (len == 0) { --- 3618,3621 ---- From gstein@lyra.org Mon Dec 13 18:21:57 1999 From: gstein@lyra.org (Greg Stein) Date: Mon, 13 Dec 1999 10:21:57 -0800 (PST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.117,2.118 In-Reply-To: <199912131655.LAA17456@weyr.cnri.reston.va.us> Message-ID: hoo hoo... the new diff's count for something already. I saw that in the first checkin and was about to reply... :-) On Mon, 13 Dec 1999, Fred L. Drake wrote: > Update of /projects/cvsroot/python/dist/src/Modules > In directory weyr:/home/fdrake/projects/python/Modules > > Modified Files: > posixmodule.c > Log Message: > > Removed debugging prints. > > > Index: posixmodule.c > =================================================================== > RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v > retrieving revision 2.117 > retrieving revision 2.118 > diff -C2 -r2.117 -r2.118 > *** posixmodule.c 1999/12/13 16:37:25 2.117 > --- posixmodule.c 1999/12/13 16:55:24 2.118 > *************** > *** 3417,3425 **** > int cmp, mid; > char *confname = PyString_AS_STRING(arg); > - printf("table: %d entries\n", tablesize); > while (lo < hi) { > mid = (lo + hi) / 2; > - printf("%d confname='%s'; other='%s';\n", > - mid, confname, table[mid].name); > cmp = strcmp(confname, table[mid].name); > if (cmp < 0) > --- 3417,3422 ---- > *************** > *** 3621,3625 **** > int len = confstr(name, buffer, sizeof(buffer)); > > - printf("confstr(%d) --> %d, '%s'\n", name, len, buffer); > errno = 0; > if (len == 0) { > --- 3618,3621 ---- > > > _______________________________________________ > Python-checkins mailing list > Python-checkins@python.org > http://www.python.org/mailman/listinfo/python-checkins > -- Greg Stein, http://www.lyra.org/ From gstein@lyra.org Mon Dec 13 18:26:59 1999 From: gstein@lyra.org (Greg Stein) Date: Mon, 13 Dec 1999 10:26:59 -0800 (PST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.116,2.117 In-Reply-To: <199912131637.LAA17318@weyr.cnri.reston.va.us> Message-ID: On Mon, 13 Dec 1999, Fred L. Drake wrote: > Update of /projects/cvsroot/python/dist/src/Modules > In directory weyr:/home/fdrake/projects/python/Modules > > Modified Files: > posixmodule.c > Log Message: > > Added bindings for getgroups(), fpathconf(), pathconf(), confstr(), > and sysconf(). > > *Lots* of tables to define names used by *conf*(); explanation to go > in message to python-dev list. I'm not very familiar with these APIs, but should you let go of the interpreter lock when you call them? (and for the other new funcs) Cheers, -g -- Greg Stein, http://www.lyra.org/ From guido@cnri.reston.va.us Mon Dec 13 23:27:49 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Dec 1999 18:27:49 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib imaplib.py,1.13,1.14 Message-ID: <199912132327.SAA23122@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: imaplib.py Log Message: V 2.16 from Piers: I've changed the login command to force proper quoting of the password argument. I've also added some extra debugging code, which is removed when __debug__ is false. Index: imaplib.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/imaplib.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** imaplib.py 1998/10/21 22:06:56 1.13 --- imaplib.py 1999/12/13 23:27:45 1.14 *************** *** 16,20 **** """ ! __version__ = "2.15" import binascii, re, socket, string, time, random, sys --- 16,20 ---- """ ! __version__ = "2.16" import binascii, re, socket, string, time, random, sys *************** *** 90,94 **** an IMAP4 literal. If necessary (the string contains white-space and isn't enclosed with either parentheses or ! double quotes) each string is quoted. Each command returns a tuple: (type, [data, ...]) where 'type' --- 90,95 ---- an IMAP4 literal. If necessary (the string contains white-space and isn't enclosed with either parentheses or ! double quotes) each string is quoted. However, the 'password' ! argument to the LOGIN command is always quoted. Each command returns a tuple: (type, [data, ...]) where 'type' *************** *** 102,105 **** --- 103,111 ---- .readonly(""), which is a sub-class of 'abort'. + "error" exceptions imply a program error. + "abort" exceptions imply the connection should be reset, and + the command re-tried. + "readonly" exceptions imply the command should be re-tried. + Note: to use this module, you must read the RFCs pertaining to the IMAP4 protocol, as the semantics of the arguments to *************** *** 112,115 **** --- 118,122 ---- class readonly(abort): pass # Mailbox status changed to READ-ONLY + mustquote = re.compile(r'\W') # Match any non-alphanumeric character def __init__(self, host = '', port = IMAP4_PORT): *************** *** 139,144 **** # request and store CAPABILITY response. ! if __debug__ and self.debug >= 1: ! _mesg('new IMAP4 connection, tag=%s' % self.tagpre) self.welcome = self._get_response() --- 146,152 ---- # request and store CAPABILITY response. ! if __debug__: ! if self.debug >= 1: ! _mesg('new IMAP4 connection, tag=%s' % self.tagpre) self.welcome = self._get_response() *************** *** 147,151 **** elif self.untagged_responses.has_key('OK'): self.state = 'NONAUTH' - # elif self.untagged_responses.has_key('BYE'): else: raise self.error(self.welcome) --- 155,158 ---- *************** *** 157,162 **** self.capabilities = tuple(string.split(string.upper(self.untagged_responses[cap][-1]))) ! if __debug__ and self.debug >= 3: ! _mesg('CAPABILITIES: %s' % `self.capabilities`) for version in AllowedVersions: --- 164,170 ---- self.capabilities = tuple(string.split(string.upper(self.untagged_responses[cap][-1]))) ! if __debug__: ! if self.debug >= 3: ! _mesg('CAPABILITIES: %s' % `self.capabilities`) for version in AllowedVersions: *************** *** 230,235 **** --- 238,247 ---- (typ, [data]) = .append(mailbox, flags, date_time, message) + + All args except `message' can be None. """ name = 'APPEND' + if not mailbox: + mailbox = 'INBOX' if flags: if (flags[0],flags[-1]) != ('(',')'): *************** *** 360,367 **** def login(self, user, password): """Identify client using plaintext password. ! (typ, [data]) = .list(user, password) """ ! typ, dat = self._simple_command('LOGIN', user, password) if typ != 'OK': raise self.error(dat[-1]) --- 372,383 ---- def login(self, user, password): """Identify client using plaintext password. + + (typ, [data]) = .login(user, password) ! NB: 'password' will be quoted. """ ! #if not 'AUTH=LOGIN' in self.capabilities: ! # raise self.error("Server doesn't allow LOGIN authentication." % mech) ! typ, dat = self._simple_command('LOGIN', user, self._quote(password)) if typ != 'OK': raise self.error(dat[-1]) *************** *** 404,409 **** (typ, data) = .noop() """ ! if __debug__ and self.debug >= 3: ! _dump_ur(self.untagged_responses) return self._simple_command('NOOP') --- 420,426 ---- (typ, data) = .noop() """ ! if __debug__: ! if self.debug >= 3: ! _dump_ur(self.untagged_responses) return self._simple_command('NOOP') *************** *** 465,469 **** if not self.untagged_responses.has_key('READ-WRITE') \ and not readonly: ! if __debug__ and self.debug >= 1: _dump_ur(self.untagged_responses) raise self.readonly('%s is not writable' % mailbox) return typ, self.untagged_responses.get('EXISTS', [None]) --- 482,488 ---- if not self.untagged_responses.has_key('READ-WRITE') \ and not readonly: ! if __debug__: ! if self.debug >= 1: ! _dump_ur(self.untagged_responses) raise self.readonly('%s is not writable' % mailbox) return typ, self.untagged_responses.get('EXISTS', [None]) *************** *** 547,554 **** def _append_untagged(self, typ, dat): ur = self.untagged_responses ! if __debug__ and self.debug >= 5: ! _mesg('untagged_responses[%s] %s += %s' % ! (typ, len(ur.get(typ,'')), dat)) if ur.has_key(typ): ur[typ].append(dat) --- 566,575 ---- def _append_untagged(self, typ, dat): + if dat is None: dat = '' ur = self.untagged_responses ! if __debug__: ! if self.debug >= 5: ! _mesg('untagged_responses[%s] %s += ["%s"]' % ! (typ, len(ur.get(typ,'')), dat)) if ur.has_key(typ): ur[typ].append(dat) *************** *** 557,560 **** --- 578,587 ---- + def _check_bye(self): + bye = self.untagged_responses.get('BYE') + if bye: + raise self.abort(bye[-1]) + + def _command(self, name, *args): *************** *** 575,588 **** tag = self._new_tag() data = '%s %s' % (tag, name) ! for d in args: ! if d is None: continue ! if type(d) is type(''): ! l = len(string.split(d)) ! else: ! l = 1 ! if l == 0 or l > 1 and (d[0],d[-1]) not in (('(',')'),('"','"')): ! data = '%s "%s"' % (data, d) ! else: ! data = '%s %s' % (data, d) literal = self.literal --- 602,608 ---- tag = self._new_tag() data = '%s %s' % (tag, name) ! for arg in args: ! if arg is None: continue ! data = '%s %s' % (data, self._checkquote(arg)) literal = self.literal *************** *** 595,598 **** --- 615,624 ---- data = '%s {%s}' % (data, len(literal)) + if __debug__: + if self.debug >= 4: + _mesg('> %s' % data) + else: + _log('> %s' % data) + try: self.sock.send('%s%s' % (data, CRLF)) *************** *** 600,606 **** raise self.abort('socket error: %s' % val) - if __debug__ and self.debug >= 4: - _mesg('> %s' % data) - if literal is None: return tag --- 626,629 ---- *************** *** 618,623 **** literal = literator(self.continuation_response) ! if __debug__ and self.debug >= 4: ! _mesg('write literal size %s' % len(literal)) try: --- 641,647 ---- literal = literator(self.continuation_response) ! if __debug__: ! if self.debug >= 4: ! _mesg('write literal size %s' % len(literal)) try: *************** *** 634,637 **** --- 658,662 ---- def _command_complete(self, name, tag): + self._check_bye() try: typ, data = self._get_tagged_response(tag) *************** *** 640,645 **** except self.error, val: raise self.error('command: %s => %s' % (name, val)) ! if self.untagged_responses.has_key('BYE') and name != 'LOGOUT': ! raise self.abort(self.untagged_responses['BYE'][-1]) if typ == 'BAD': raise self.error('%s command error: %s %s' % (name, typ, data)) --- 665,669 ---- except self.error, val: raise self.error('command: %s => %s' % (name, val)) ! self._check_bye() if typ == 'BAD': raise self.error('%s command error: %s %s' % (name, typ, data)) *************** *** 696,701 **** size = string.atoi(self.mo.group('size')) ! if __debug__ and self.debug >= 4: ! _mesg('read literal size %s' % size) data = self.file.read(size) --- 720,726 ---- size = string.atoi(self.mo.group('size')) ! if __debug__: ! if self.debug >= 4: ! _mesg('read literal size %s' % size) data = self.file.read(size) *************** *** 715,720 **** self._append_untagged(self.mo.group('type'), self.mo.group('data')) ! if __debug__ and self.debug >= 1 and typ in ('NO', 'BAD'): ! _mesg('%s response: %s' % (typ, dat)) return resp --- 740,746 ---- self._append_untagged(self.mo.group('type'), self.mo.group('data')) ! if __debug__: ! if self.debug >= 1 and typ in ('NO', 'BAD', 'BYE'): ! _mesg('%s response: %s' % (typ, dat)) return resp *************** *** 740,745 **** line = line[:-2] ! if __debug__ and self.debug >= 4: ! _mesg('< %s' % line) return line --- 766,774 ---- line = line[:-2] ! if __debug__: ! if self.debug >= 4: ! _mesg('< %s' % line) ! else: ! _log('< %s' % line) return line *************** *** 751,756 **** self.mo = cre.match(s) ! if __debug__ and self.mo is not None and self.debug >= 5: ! _mesg("\tmatched r'%s' => %s" % (cre.pattern, `self.mo.groups()`)) return self.mo is not None --- 780,786 ---- self.mo = cre.match(s) ! if __debug__: ! if self.mo is not None and self.debug >= 5: ! _mesg("\tmatched r'%s' => %s" % (cre.pattern, `self.mo.groups()`)) return self.mo is not None *************** *** 764,767 **** --- 794,819 ---- + def _checkquote(self, arg): + + # Must quote command args if non-alphanumeric chars present, + # and not already quoted. + + if type(arg) is not type(''): + return arg + if (arg[0],arg[-1]) in (('(',')'),('"','"')): + return arg + if self.mustquote.search(arg) is None: + return arg + return self._quote(arg) + + + def _quote(self, arg): + + arg = string.replace(arg, '\\', '\\\\') + arg = string.replace(arg, '"', '\\"') + + return '"%s"' % arg + + def _simple_command(self, name, *args): *************** *** 776,781 **** return typ, [None] data = self.untagged_responses[name] ! if __debug__ and self.debug >= 5: ! _mesg('untagged_responses[%s] => %s' % (name, data)) del self.untagged_responses[name] return typ, data --- 828,834 ---- return typ, [None] data = self.untagged_responses[name] ! if __debug__: ! if self.debug >= 5: ! _mesg('untagged_responses[%s] => %s' % (name, data)) del self.untagged_responses[name] return typ, data *************** *** 902,906 **** dttype = type(date_time) ! if dttype is type(1): tt = time.localtime(date_time) elif dttype is type(()): --- 955,959 ---- dttype = type(date_time) ! if dttype is type(1) or dttype is type(1.1): tt = time.localtime(date_time) elif dttype is type(()): *************** *** 923,929 **** if __debug__: ! def _mesg(s): ! # if len(s) > 70: s = '%.70s..' % s ! sys.stderr.write('\t'+s+'\n') sys.stderr.flush() --- 976,984 ---- if __debug__: ! def _mesg(s, secs=None): ! if secs is None: ! secs = time.time() ! tm = time.strftime('%M:%S', time.localtime(secs)) ! sys.stderr.write(' %s.%02d %s\n' % (tm, (secs*100)%100, s)) sys.stderr.flush() *************** *** 937,943 **** _mesg('untagged responses dump:%s%s' % (t, j(l, t))) ! if __debug__ and __name__ == '__main__': import getpass, sys --- 992,1012 ---- _mesg('untagged responses dump:%s%s' % (t, j(l, t))) + _cmd_log = [] # Last `_cmd_log_len' interactions + _cmd_log_len = 10 + + def _log(line): + # Keep log of last `_cmd_log_len' interactions for debugging. + if len(_cmd_log) == _cmd_log_len: + del _cmd_log[0] + _cmd_log.append((time.time(), line)) + + def print_log(): + _mesg('last %d IMAP4 interactions:' % len(_cmd_log)) + for secs,line in _cmd_log: + _mesg(line, secs) + ! if __name__ == '__main__': import getpass, sys *************** *** 955,958 **** --- 1024,1028 ---- ('CREATE', ('/tmp/yyz 2',)), ('append', ('/tmp/yyz 2', None, None, 'From: anon@x.y.z\n\ndata...')), + ('list', ('/tmp', 'yy*')), ('select', ('/tmp/yyz 2',)), ('search', (None, '(TO zork)')), *************** *** 969,972 **** --- 1039,1043 ---- ('uid', ('SEARCH', 'ALL')), ('response', ('EXISTS',)), + ('append', (None, None, None, 'From: anon@x.y.z\n\ndata...')), ('recent', ()), ('logout', ()), *************** *** 974,979 **** def run(cmd, args): typ, dat = apply(eval('M.%s' % cmd), args) ! _mesg(' %s %s\n => %s %s' % (cmd, args, typ, dat)) return dat --- 1045,1051 ---- def run(cmd, args): + _mesg('%s %s' % (cmd, args)) typ, dat = apply(eval('M.%s' % cmd), args) ! _mesg('%s => %s %s' % (cmd, typ, dat)) return dat *************** *** 997,1001 **** continue ! uid = string.split(dat[-1])[-1] ! run('uid', ('FETCH', '%s' % uid, '(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)')) --- 1069,1074 ---- continue ! uid = string.split(dat[-1]) ! if not uid: continue ! run('uid', ('FETCH', '%s' % uid[-1], '(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)')) From guido@cnri.reston.va.us Mon Dec 13 23:29:41 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 13 Dec 1999 18:29:41 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libimaplib.tex Message-ID: <199912132329.SAA23160@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory eric:/projects/python/develop/guido/Doc/lib Modified Files: libimaplib.tex Log Message: Doc update from Piers Lauder see changes for imaplib.py version 2.16. From fdrake@weyr.cnri.reston.va.us Mon Dec 13 23:34:45 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 13 Dec 1999 18:34:45 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libimaplib.tex Message-ID: <199912132334.SAA23367@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libimaplib.tex Log Message: Markup consistency nits that Guido didn't check. ;-) From fdrake@weyr.cnri.reston.va.us Tue Dec 14 20:48:21 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Dec 1999 15:48:21 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src config.h.in,2.47,2.48 configure,1.102,1.103 configure.in,1.110,1.111 Message-ID: <199912142048.PAA27828@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory weyr:/home/fdrake/projects/python Modified Files: config.h.in configure configure.in Log Message: Added detection of getlogin() and getlogin_r(). Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -r2.47 -r2.48 *** config.h.in 1999/12/13 16:23:34 2.47 --- config.h.in 1999/12/14 20:48:17 2.48 *************** *** 273,276 **** --- 273,282 ---- #undef HAVE_GETGROUPS + /* Define if you have the getlogin function. */ + #undef HAVE_GETLOGIN + + /* Define if you have the getlogin_r function. */ + #undef HAVE_GETLOGIN_R + /* Define if you have the getpgrp function. */ #undef HAVE_GETPGRP Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -r1.102 -r1.103 *** configure 1999/12/13 16:23:35 1.102 --- configure 1999/12/14 20:48:17 1.103 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.109 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.110 [...1197 lines suppressed...] #include --- 4642,4646 ---- else cat > conftest.$ac_ext < *************** *** 4660,4664 **** } EOF ! if { (eval echo configure:4663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull --- 4661,4665 ---- } EOF ! if { (eval echo configure:4664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -r1.110 -r1.111 *** configure.in 1999/12/13 16:23:34 1.110 --- configure.in 1999/12/14 20:48:17 1.111 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.110 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.111 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 682,686 **** AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \ flock fork fsync fdatasync fpathconf ftime ftruncate \ ! getgroups getpeername getpgrp getpid getpwent gettimeofday getwd \ kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \ putenv readlink \ --- 682,687 ---- AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \ flock fork fsync fdatasync fpathconf ftime ftruncate \ ! getgroups getlogin getlogin_r getpeername getpgrp getpid getpwent \ ! gettimeofday getwd \ kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \ putenv readlink \ From fdrake@weyr.cnri.reston.va.us Tue Dec 14 21:11:50 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Dec 1999 16:11:50 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src config.h.in,2.48,2.49 configure,1.103,1.104 configure.in,1.111,1.112 Message-ID: <199912142111.QAA28416@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory weyr:/home/fdrake/projects/python Modified Files: config.h.in configure configure.in Log Message: Remove test for getlogin_r(); the interface is not clearly defined, at least on Solaris (sometimes it's Unix98, sometimes it conforms to an early draft). Properly generate config.h.in using autoheader instead of editing it manually; thanks, Guido! Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.48 retrieving revision 2.49 diff -C2 -r2.48 -r2.49 *** config.h.in 1999/12/14 20:48:17 2.48 --- config.h.in 1999/12/14 21:11:46 2.49 *************** *** 216,219 **** --- 216,222 ---- #undef HAVE_CLOCK + /* Define if you have the confstr function. */ + #undef HAVE_CONFSTR + /* Define if you have the ctermid function. */ #undef HAVE_CTERMID *************** *** 240,243 **** --- 243,249 ---- #undef HAVE_FORK + /* Define if you have the fpathconf function. */ + #undef HAVE_FPATHCONF + /* Define if you have the fseek64 function. */ #undef HAVE_FSEEK64 *************** *** 267,273 **** #undef HAVE_GETCWD - /* Define if you have the getpeername function. */ - #undef HAVE_GETPEERNAME - /* Define if you have the getgroups function. */ #undef HAVE_GETGROUPS --- 273,276 ---- *************** *** 276,281 **** #undef HAVE_GETLOGIN ! /* Define if you have the getlogin_r function. */ ! #undef HAVE_GETLOGIN_R /* Define if you have the getpgrp function. */ --- 279,284 ---- #undef HAVE_GETLOGIN ! /* Define if you have the getpeername function. */ ! #undef HAVE_GETPEERNAME /* Define if you have the getpgrp function. */ *************** *** 294,309 **** #undef HAVE_GETWD - /* Define if you have the fpathconf function. */ - #undef HAVE_FPATHCONF - - /* Define if you have the pathconf function. */ - #undef HAVE_PATHCONF - - /* Define if you have the confstr function. */ - #undef HAVE_CONFSTR - - /* Define if you have the sysconf function. */ - #undef HAVE_SYSCONF - /* Define if you have the hypot function. */ #undef HAVE_HYPOT --- 297,300 ---- *************** *** 330,333 **** --- 321,327 ---- #undef HAVE_NICE + /* Define if you have the pathconf function. */ + #undef HAVE_PATHCONF + /* Define if you have the pause function. */ #undef HAVE_PAUSE *************** *** 395,398 **** --- 389,395 ---- /* Define if you have the symlink function. */ #undef HAVE_SYMLINK + + /* Define if you have the sysconf function. */ + #undef HAVE_SYSCONF /* Define if you have the tcgetpgrp function. */ Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.103 retrieving revision 1.104 diff -C2 -r1.103 -r1.104 *** configure 1999/12/14 20:48:17 1.103 --- configure 1999/12/14 21:11:46 1.104 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.110 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.111 [...1197 lines suppressed...] #include --- 4641,4645 ---- else cat > conftest.$ac_ext < *************** *** 4661,4665 **** } EOF ! if { (eval echo configure:4664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull --- 4660,4664 ---- } EOF ! if { (eval echo configure:4663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -r1.111 -r1.112 *** configure.in 1999/12/14 20:48:17 1.111 --- configure.in 1999/12/14 21:11:47 1.112 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.111 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.112 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 682,687 **** AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \ flock fork fsync fdatasync fpathconf ftime ftruncate \ ! getgroups getlogin getlogin_r getpeername getpgrp getpid getpwent \ ! gettimeofday getwd \ kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \ putenv readlink \ --- 682,686 ---- AC_CHECK_FUNCS(alarm chown clock confstr ctermid ctermid_r dlopen execv \ flock fork fsync fdatasync fpathconf ftime ftruncate \ ! getgroups getlogin getpeername getpgrp getpid getpwent gettimeofday getwd \ kill link lstat mkfifo mktime nice pathconf pause plock pthread_init \ putenv readlink \ From fdrake@weyr.cnri.reston.va.us Tue Dec 14 21:25:06 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Dec 1999 16:25:06 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.118,2.119 Message-ID: <199912142125.QAA00066@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Added support for getlogin(); does *not* use getlogin_r() where available since the interface is poorly defined on at least one major platform (Solaris). Moved table of constant names for fpathconf() & pathconf() into the conditional that defines the conv_path_confname() helper; Mark Hammond reported that defining the table when none of the constants were defined causes the compiler to complain (won't allow 0-length array, imagine that!). In posix_fpathconf(), use conv_path_confname() as the O& conversion function, instead of the conv_confname() helper, which has the wrong signature (posix_pathconf() already used the right thing). Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.118 retrieving revision 2.119 diff -C2 -r2.118 -r2.119 *** posixmodule.c 1999/12/13 16:55:24 2.118 --- posixmodule.c 1999/12/14 21:25:03 2.119 *************** *** 1831,1834 **** --- 1831,1858 ---- + #ifdef HAVE_GETLOGIN + static char posix_getlogin__doc__[] = "\ + getlogin() -> string\n\ + Return the actual login name."; + + static PyObject * + posix_getlogin(self, args) + PyObject *self; + PyObject *args; + { + PyObject *result = NULL; + + if (PyArg_ParseTuple(args, ":getlogin")) { + char *name = getlogin(); + + if (name == NULL) + posix_error(); + else + result = PyString_FromString(name); + } + return result; + } + #endif + #ifdef HAVE_GETUID static char posix_getuid__doc__[] = *************** *** 3344,3348 **** * integer values, allowing those functions to be called with the * magic names instead of poluting the module's namespace with tons of ! * rarely-used constants. */ struct constdef { --- 3368,3373 ---- * integer values, allowing those functions to be called with the * magic names instead of poluting the module's namespace with tons of ! * rarely-used constants. There are three separate tables that use ! * these definitions. */ struct constdef { *************** *** 3350,3355 **** long value; }; ! static struct constdef posix_constants_pathconf[] = { #ifdef _PC_ASYNC_IO {"PC_ASYNC_IO", _PC_ASYNC_IO}, --- 3375,3419 ---- long value; }; + + static int + conv_confname(arg, valuep, table, tablesize) + PyObject *arg; + int *valuep; + struct constdef *table; + size_t tablesize; + { + if (PyInt_Check(arg)) { + *valuep = PyInt_AS_LONG(arg); + return 1; + } + if (PyString_Check(arg)) { + /* look up the value in the table using a binary search */ + int lo = 0; + int hi = tablesize; + int cmp, mid; + char *confname = PyString_AS_STRING(arg); + while (lo < hi) { + mid = (lo + hi) / 2; + cmp = strcmp(confname, table[mid].name); + if (cmp < 0) + hi = mid; + else if (cmp > 0) + lo = mid + 1; + else { + *valuep = table[mid].value; + return 1; + } + } + PyErr_SetString(PyExc_ValueError, "unrecognized configuration name"); + } + else + PyErr_SetString(PyExc_TypeError, + "configuration names must be strings or integers"); + return 0; + } + ! #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) ! static struct constdef posix_constants_pathconf[] = { #ifdef _PC_ASYNC_IO {"PC_ASYNC_IO", _PC_ASYNC_IO}, *************** *** 3399,3443 **** }; - static int - conv_confname(arg, valuep, table, tablesize) - PyObject *arg; - int *valuep; - struct constdef *table; - size_t tablesize; - { - if (PyInt_Check(arg)) { - *valuep = PyInt_AS_LONG(arg); - return 1; - } - if (PyString_Check(arg)) { - /* look up the value in the table using a binary search */ - int lo = 0; - int hi = tablesize; - int cmp, mid; - char *confname = PyString_AS_STRING(arg); - while (lo < hi) { - mid = (lo + hi) / 2; - cmp = strcmp(confname, table[mid].name); - if (cmp < 0) - hi = mid; - else if (cmp > 0) - lo = mid + 1; - else { - *valuep = table[mid].value; - return 1; - } - } - PyErr_SetString(PyExc_ValueError, "unrecognized configuration name"); - } - else - PyErr_SetString(PyExc_TypeError, - "configuration names must be strings or integers"); - return 0; - } - - - #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) - static int conv_path_confname(arg, valuep) PyObject *arg; --- 3463,3467 ---- *************** *** 3464,3468 **** int name, fd; ! if (PyArg_ParseTuple(args, "iO&:fpathconf", &fd, conv_confname, &name)) { long limit; --- 3488,3493 ---- int name, fd; ! if (PyArg_ParseTuple(args, "iO&:fpathconf", &fd, ! conv_path_confname, &name)) { long limit; *************** *** 3500,3504 **** errno = 0; limit = pathconf(path, name); ! if (limit == -1 && errno != 0) if (errno == EINVAL) /* could be a path or name problem */ --- 3525,3529 ---- errno = 0; limit = pathconf(path, name); ! if (limit == -1 && errno != 0) { if (errno == EINVAL) /* could be a path or name problem */ *************** *** 3506,3509 **** --- 3531,3535 ---- else posix_error_with_filename(path); + } else result = PyInt_FromLong(limit); *************** *** 4234,4237 **** --- 4260,4266 ---- {"getuid", posix_getuid, METH_VARARGS, posix_getuid__doc__}, #endif /* HAVE_GETUID */ + #ifdef HAVE_GETLOGIN + {"getlogin", posix_getlogin, METH_VARARGS, posix_getlogin__doc__}, + #endif #ifdef HAVE_KILL {"kill", posix_kill, METH_VARARGS, posix_kill__doc__}, From guido@cnri.reston.va.us Tue Dec 14 22:18:40 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 14 Dec 1999 17:18:40 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib mailbox.py,1.16,1.17 Message-ID: <199912142218.RAA25264@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: mailbox.py Log Message: Only set msg.fp to None when there are no extra arguments; if there are, we must keep the file around so we can print the body. Index: mailbox.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/mailbox.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** mailbox.py 1999/03/24 16:20:45 1.16 --- mailbox.py 1999/12/14 22:18:37 1.17 *************** *** 256,260 **** break msgs.append(msg) ! msg.fp = None if len(args) > 1: num = string.atoi(args[1]) --- 256,261 ---- break msgs.append(msg) ! if len(args) <= 1: ! msg.fp = None if len(args) > 1: num = string.atoi(args[1]) From fdrake@weyr.cnri.reston.va.us Tue Dec 14 23:37:59 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 14 Dec 1999 18:37:59 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libgetopt.tex Message-ID: <199912142337.SAA00509@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libgetopt.tex Log Message: Improve explanation of what the getopt() return value includes for long options. From bwarsaw@cnri.reston.va.us Wed Dec 15 02:22:55 1999 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Date: Tue, 14 Dec 1999 21:22:55 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects stringobject.c,2.52,2.53 Message-ID: <199912150222.VAA03542@anthem.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory anthem:/home/bwarsaw/projects/python/Objects Modified Files: stringobject.c Log Message: do_strip(): Fixed cut-and-paste error; this function should check for zero arguments (found by Marc Lemburg). Index: stringobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/stringobject.c,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -r2.52 -r2.53 *** stringobject.c 1999/10/12 19:54:48 2.52 --- stringobject.c 1999/12/15 02:22:52 2.53 *************** *** 926,933 **** char *s = PyString_AS_STRING(self); int len = PyString_GET_SIZE(self), i, j; - PyObject *scobj = NULL; - int count = -1; ! if (!PyArg_ParseTuple(args, "|Oi", scobj, count)) return NULL; --- 926,931 ---- char *s = PyString_AS_STRING(self); int len = PyString_GET_SIZE(self), i, j; ! if (!PyArg_ParseTuple(args, "")) return NULL; From fdrake@weyr.cnri.reston.va.us Wed Dec 15 15:34:36 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Dec 1999 10:34:36 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.119,2.120 Message-ID: <199912151534.KAA01621@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Added table entries for Irix 6.5 names for confstr()/sysconf()/ pathconf() names, from Sjoerd. Added code to verify that these tables are properly ordered, only included and used when CHECK_CONFNAME_TABLES is defined. This is only needed to test the tables, so I haven't enabled this by default. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.119 retrieving revision 2.120 diff -C2 -r2.119 -r2.120 *** posixmodule.c 1999/12/14 21:25:03 2.119 --- posixmodule.c 1999/12/15 15:34:33 2.120 *************** *** 3416,3419 **** --- 3416,3425 ---- #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) static struct constdef posix_constants_pathconf[] = { + #ifdef _PC_ABI_AIO_XFER_MAX + {"PC_ABI_AIO_XFER_MAX", _PC_ABI_AIO_XFER_MAX}, + #endif + #ifdef _PC_ABI_ASYNC_IO + {"PC_ABI_ASYNC_IO", _PC_ABI_ASYNC_IO}, + #endif #ifdef _PC_ASYNC_IO {"PC_ASYNC_IO", _PC_ASYNC_IO}, *************** *** 3541,3544 **** --- 3547,3565 ---- #ifdef HAVE_CONFSTR static struct constdef posix_constants_confstr[] = { + #ifdef _CS_ARCHITECTURE + {"CS_ARCHITECTURE", _CS_ARCHITECTURE}, + #endif + #ifdef _CS_HOSTNAME + {"CS_HOSTNAME", _CS_HOSTNAME}, + #endif + #ifdef _CS_HW_PROVIDER + {"CS_HW_PROVIDER", _CS_HW_PROVIDER}, + #endif + #ifdef _CS_HW_SERIAL + {"CS_HW_SERIAL", _CS_HW_SERIAL}, + #endif + #ifdef _CS_INITTAB_NAME + {"CS_INITTAB_NAME", _CS_INITTAB_NAME}, + #endif #ifdef _CS_LFS64_CFLAGS {"CS_LFS64_CFLAGS", _CS_LFS64_CFLAGS}, *************** *** 3565,3571 **** --- 3586,3607 ---- {"CS_LFS_LINTFLAGS", _CS_LFS_LINTFLAGS}, #endif + #ifdef _CS_MACHINE + {"CS_MACHINE", _CS_MACHINE}, + #endif #ifdef _CS_PATH {"CS_PATH", _CS_PATH}, #endif + #ifdef _CS_RELEASE + {"CS_RELEASE", _CS_RELEASE}, + #endif + #ifdef _CS_SRPC_DOMAIN + {"CS_SRPC_DOMAIN", _CS_SRPC_DOMAIN}, + #endif + #ifdef _CS_SYSNAME + {"CS_SYSNAME", _CS_SYSNAME}, + #endif + #ifdef _CS_VERSION + {"CS_VERSION", _CS_VERSION}, + #endif #ifdef _CS_XBS5_ILP32_OFF32_CFLAGS {"CS_XBS5_ILP32_OFF32_CFLAGS", _CS_XBS5_ILP32_OFF32_CFLAGS}, *************** *** 3616,3619 **** --- 3652,3694 ---- {"CS_XBS5_LPBIG_OFFBIG_LINTFLAGS", _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS}, #endif + #ifdef _MIPS_CS_AVAIL_PROCESSORS + {"MIPS_CS_AVAIL_PROCESSORS", _MIPS_CS_AVAIL_PROCESSORS}, + #endif + #ifdef _MIPS_CS_BASE + {"MIPS_CS_BASE", _MIPS_CS_BASE}, + #endif + #ifdef _MIPS_CS_HOSTID + {"MIPS_CS_HOSTID", _MIPS_CS_HOSTID}, + #endif + #ifdef _MIPS_CS_HW_NAME + {"MIPS_CS_HW_NAME", _MIPS_CS_HW_NAME}, + #endif + #ifdef _MIPS_CS_NUM_PROCESSORS + {"MIPS_CS_NUM_PROCESSORS", _MIPS_CS_NUM_PROCESSORS}, + #endif + #ifdef _MIPS_CS_OSREL_MAJ + {"MIPS_CS_OSREL_MAJ", _MIPS_CS_OSREL_MAJ}, + #endif + #ifdef _MIPS_CS_OSREL_MIN + {"MIPS_CS_OSREL_MIN", _MIPS_CS_OSREL_MIN}, + #endif + #ifdef _MIPS_CS_OSREL_PATCH + {"MIPS_CS_OSREL_PATCH", _MIPS_CS_OSREL_PATCH}, + #endif + #ifdef _MIPS_CS_OS_NAME + {"MIPS_CS_OS_NAME", _MIPS_CS_OS_NAME}, + #endif + #ifdef _MIPS_CS_OS_PROVIDER + {"MIPS_CS_OS_PROVIDER", _MIPS_CS_OS_PROVIDER}, + #endif + #ifdef _MIPS_CS_PROCESSORS + {"MIPS_CS_PROCESSORS", _MIPS_CS_PROCESSORS}, + #endif + #ifdef _MIPS_CS_SERIAL + {"MIPS_CS_SERIAL", _MIPS_CS_SERIAL}, + #endif + #ifdef _MIPS_CS_VENDOR + {"MIPS_CS_VENDOR", _MIPS_CS_VENDOR}, + #endif }; *************** *** 3698,3701 **** --- 3773,3782 ---- {"SC_2_VERSION", _SC_2_VERSION}, #endif + #ifdef _SC_ABI_ASYNCHRONOUS_IO + {"SC_ABI_ASYNCHRONOUS_IO", _SC_ABI_ASYNCHRONOUS_IO}, + #endif + #ifdef _SC_ACL + {"SC_ACL", _SC_ACL}, + #endif #ifdef _SC_AIO_LISTIO_MAX {"SC_AIO_LISTIO_MAX", _SC_AIO_LISTIO_MAX}, *************** *** 3719,3722 **** --- 3800,3806 ---- {"SC_ATEXIT_MAX", _SC_ATEXIT_MAX}, #endif + #ifdef _SC_AUDIT + {"SC_AUDIT", _SC_AUDIT}, + #endif #ifdef _SC_AVPHYS_PAGES {"SC_AVPHYS_PAGES", _SC_AVPHYS_PAGES}, *************** *** 3734,3737 **** --- 3818,3824 ---- {"SC_BC_STRING_MAX", _SC_BC_STRING_MAX}, #endif + #ifdef _SC_CAP + {"SC_CAP", _SC_CAP}, + #endif #ifdef _SC_CHARCLASS_NAME_MAX {"SC_CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX}, *************** *** 3803,3806 **** --- 3890,3896 ---- {"SC_ICACHE_SZ", _SC_ICACHE_SZ}, #endif + #ifdef _SC_INF + {"SC_INF", _SC_INF}, + #endif #ifdef _SC_INT_MAX {"SC_INT_MAX", _SC_INT_MAX}, *************** *** 3812,3818 **** --- 3902,3917 ---- {"SC_IOV_MAX", _SC_IOV_MAX}, #endif + #ifdef _SC_IP_SECOPTS + {"SC_IP_SECOPTS", _SC_IP_SECOPTS}, + #endif #ifdef _SC_JOB_CONTROL {"SC_JOB_CONTROL", _SC_JOB_CONTROL}, #endif + #ifdef _SC_KERN_POINTERS + {"SC_KERN_POINTERS", _SC_KERN_POINTERS}, + #endif + #ifdef _SC_KERN_SIM + {"SC_KERN_SIM", _SC_KERN_SIM}, + #endif #ifdef _SC_LINE_MAX {"SC_LINE_MAX", _SC_LINE_MAX}, *************** *** 3827,3830 **** --- 3926,3932 ---- {"SC_LONG_BIT", _SC_LONG_BIT}, #endif + #ifdef _SC_MAC + {"SC_MAC", _SC_MAC}, + #endif #ifdef _SC_MAPPED_FILES {"SC_MAPPED_FILES", _SC_MAPPED_FILES}, *************** *** 3848,3851 **** --- 3950,3956 ---- {"SC_MESSAGE_PASSING", _SC_MESSAGE_PASSING}, #endif + #ifdef _SC_MMAP_FIXED_ALIGNMENT + {"SC_MMAP_FIXED_ALIGNMENT", _SC_MMAP_FIXED_ALIGNMENT}, + #endif #ifdef _SC_MQ_OPEN_MAX {"SC_MQ_OPEN_MAX", _SC_MQ_OPEN_MAX}, *************** *** 3854,3857 **** --- 3959,3965 ---- {"SC_MQ_PRIO_MAX", _SC_MQ_PRIO_MAX}, #endif + #ifdef _SC_NACLS_MAX + {"SC_NACLS_MAX", _SC_NACLS_MAX}, + #endif #ifdef _SC_NGROUPS_MAX {"SC_NGROUPS_MAX", _SC_NGROUPS_MAX}, *************** *** 3881,3884 **** --- 3989,3998 ---- {"SC_NPROCESSORS_ONLN", _SC_NPROCESSORS_ONLN}, #endif + #ifdef _SC_NPROC_CONF + {"SC_NPROC_CONF", _SC_NPROC_CONF}, + #endif + #ifdef _SC_NPROC_ONLN + {"SC_NPROC_ONLN", _SC_NPROC_ONLN}, + #endif #ifdef _SC_NZERO {"SC_NZERO", _SC_NZERO}, *************** *** 3986,3989 **** --- 4100,4106 ---- {"SC_SIGRT_MIN", _SC_SIGRT_MIN}, #endif + #ifdef _SC_SOFTPOWER + {"SC_SOFTPOWER", _SC_SOFTPOWER}, + #endif #ifdef _SC_SPLIT_CACHE {"SC_SPLIT_CACHE", _SC_SPLIT_CACHE}, *************** *** 4160,4163 **** --- 4277,4333 ---- + #ifdef CHECK_CONFNAME_TABLES + /* This code should not be enabled by default; it's only purpose is to + * test the order of constants in the configuration name tables. The + * second function defined here, check_confname_tables(), is called + * during module initialization if CHECK_CONFNAME_TABLES is defined. + * This only needs to be done when changes are made to the tables. + */ + static void + check_confname_table(table, tablesize, tablename) + struct constdef *table; + size_t tablesize; + char *tablename; + { + if (tablesize > 1) { + int i = 0; + + for (; i < (tablesize - 1); ++i) { + if (strcmp(table[i].name, table[i + 1].name) >= 0) { + char buffer[256]; + + snprintf(buffer, sizeof(buffer), + "confname table '%s' out of order!\n", tablename); + Py_FatalError(buffer); + } + } + } + } + + static void + check_confname_tables() + { + #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) + check_confname_table(posix_constants_pathconf, + sizeof(posix_constants_pathconf) + / sizeof(struct constdef), + "pathconf"); + #endif + #ifdef HAVE_CONFSTR + check_confname_table(posix_constants_confstr, + sizeof(posix_constants_confstr) + / sizeof(struct constdef), + "confstr"); + #endif + #ifdef HAVE_SYSCONF + check_confname_table(posix_constants_sysconf, + sizeof(posix_constants_sysconf) + / sizeof(struct constdef), + "sysconf"); + #endif + } + #endif + + static char posix_abort__doc__[] = "\ abort() -> does not return!\n\ *************** *** 4577,4579 **** --- 4747,4753 ---- posix_putenv_garbage = PyDict_New(); + + #ifdef CHECK_CONFNAME_TABLES + check_confname_tables(); + #endif } From fdrake@weyr.cnri.reston.va.us Wed Dec 15 18:31:13 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Dec 1999 13:31:13 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.120,2.121 Message-ID: <199912151831.NAA02685@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: Rip out the code to check the ordering of the tables used to map strings to integers for the *conf*() functions. Added code to sort the tables at module initialization. Three dictionaries, confstr_names, sysconf_names, and pathconf_names, are added to the module as well. These map known configuration setting names to the numeric value which is used to represent the setting in the system call. This code is always called. Updated related comments. Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.120 retrieving revision 2.121 diff -C2 -r2.120 -r2.121 *** posixmodule.c 1999/12/15 15:34:33 2.120 --- posixmodule.c 1999/12/15 18:31:10 2.121 *************** *** 3370,3373 **** --- 3370,3377 ---- * rarely-used constants. There are three separate tables that use * these definitions. + * + * This code is always included, even if none of the interfaces that + * need it are included. The #if hackery needed to avoid it would be + * sufficiently pervasive that it's not worth the loss of readability. */ struct constdef { *************** *** 4277,4331 **** ! #ifdef CHECK_CONFNAME_TABLES ! /* This code should not be enabled by default; it's only purpose is to ! * test the order of constants in the configuration name tables. The ! * second function defined here, check_confname_tables(), is called ! * during module initialization if CHECK_CONFNAME_TABLES is defined. ! * This only needs to be done when changes are made to the tables. */ ! static void ! check_confname_table(table, tablesize, tablename) struct constdef *table; size_t tablesize; ! char *tablename; { ! if (tablesize > 1) { int i = 0; ! for (; i < (tablesize - 1); ++i) { ! if (strcmp(table[i].name, table[i + 1].name) >= 0) { ! char buffer[256]; ! ! snprintf(buffer, sizeof(buffer), ! "confname table '%s' out of order!\n", tablename); ! Py_FatalError(buffer); } } } } ! static void ! check_confname_tables() { #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) ! check_confname_table(posix_constants_pathconf, sizeof(posix_constants_pathconf) / sizeof(struct constdef), ! "pathconf"); #endif #ifdef HAVE_CONFSTR ! check_confname_table(posix_constants_confstr, sizeof(posix_constants_confstr) / sizeof(struct constdef), ! "confstr"); #endif #ifdef HAVE_SYSCONF ! check_confname_table(posix_constants_sysconf, sizeof(posix_constants_sysconf) / sizeof(struct constdef), ! "sysconf"); #endif } - #endif --- 4281,4366 ---- ! /* This code is used to ensure that the tables of configuration value names ! * are in sorted order as required by conv_confname(), and also to build the ! * the exported dictionaries that are used to publish information about the ! * names available on the host platform. ! * ! * Sorting the table at runtime ensures that the table is properly ordered ! * when used, even for platforms we're not able to test on. It also makes ! * it easier to add additional entries to the tables. */ ! ! static int ! cmp_constdefs(v1, v2) ! const void *v1; ! const void *v2; ! { ! const struct constdef *c1 = ! (const struct constdef *) v1; ! const struct constdef *c2 = ! (const struct constdef *) v2; ! ! return strcmp(c1->name, c2->name); ! } ! ! static int ! setup_confname_table(table, tablesize, tablename, moddict) struct constdef *table; size_t tablesize; ! char * tablename; ! PyObject *moddict; { ! PyObject *d = NULL; ! ! qsort(table, tablesize, sizeof(struct constdef), cmp_constdefs); ! d = PyDict_New(); ! if (d != NULL) { ! PyObject *o; int i = 0; ! for (; i < tablesize; ++i) { ! o = PyInt_FromLong(table[i].value); ! if (o == NULL ! || PyDict_SetItemString(d, table[i].name, o) == -1) { ! Py_DECREF(d); ! d = NULL; ! return -1; } } + if (PyDict_SetItemString(moddict, tablename, d) == -1) + return -1; + return 0; } + return -1; } ! /* Return -1 on failure, 0 on success. */ ! static int ! setup_confname_tables(moddict) ! PyObject *moddict; { #if defined(HAVE_FPATHCONF) || defined(HAVE_PATHCONF) ! if (setup_confname_table(posix_constants_pathconf, sizeof(posix_constants_pathconf) / sizeof(struct constdef), ! "pathconf_names", moddict)) ! return -1; #endif #ifdef HAVE_CONFSTR ! if (setup_confname_table(posix_constants_confstr, sizeof(posix_constants_confstr) / sizeof(struct constdef), ! "confstr_names", moddict)) ! return -1; #endif #ifdef HAVE_SYSCONF ! if (setup_confname_table(posix_constants_sysconf, sizeof(posix_constants_sysconf) / sizeof(struct constdef), ! "sysconf_names", moddict)) ! return -1; #endif + return 0; } *************** *** 4347,4352 **** return NULL; } - static PyMethodDef posix_methods[] = { {"access", posix_access, METH_VARARGS, posix_access__doc__}, --- 4382,4387 ---- return NULL; } + static PyMethodDef posix_methods[] = { {"access", posix_access, METH_VARARGS, posix_access__doc__}, *************** *** 4744,4753 **** return; PyDict_SetItemString(d, "error", PyExc_OSError); posix_putenv_garbage = PyDict_New(); - - #ifdef CHECK_CONFNAME_TABLES - check_confname_tables(); - #endif } --- 4779,4787 ---- return; + if (setup_confname_tables(d)) + return; + PyDict_SetItemString(d, "error", PyExc_OSError); posix_putenv_garbage = PyDict_New(); } From fdrake@weyr.cnri.reston.va.us Wed Dec 15 19:39:07 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 15 Dec 1999 14:39:07 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libos.tex Message-ID: <199912151939.OAA03319@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libos.tex Log Message: Document getgroups(), getlogin(), fpathconf(), pathconf(), pathconf_names, confstr(), confstr_names, sysconf(), sysconf_names. From gstein@lyra.org Thu Dec 16 03:11:53 1999 From: gstein@lyra.org (Greg Stein) Date: Wed, 15 Dec 1999 19:11:53 -0800 (PST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.120,2.121 In-Reply-To: <199912151831.NAA02685@weyr.cnri.reston.va.us> Message-ID: But this means that your tables no long reside in "const" space. Yet More Per-Process Memory... It would be nice to have those tables marked as "const". -g On Wed, 15 Dec 1999, Fred L. Drake wrote: > Update of /projects/cvsroot/python/dist/src/Modules > In directory weyr:/home/fdrake/projects/python/Modules > > Modified Files: > posixmodule.c > Log Message: > > Rip out the code to check the ordering of the tables used to map > strings to integers for the *conf*() functions. > > Added code to sort the tables at module initialization. Three > dictionaries, confstr_names, sysconf_names, and pathconf_names, are > added to the module as well. These map known configuration setting > names to the numeric value which is used to represent the setting in > the system call. This code is always called. -- Greg Stein, http://www.lyra.org/ From guido@CNRI.Reston.VA.US Thu Dec 16 15:53:51 1999 From: guido@CNRI.Reston.VA.US (Guido van Rossum) Date: Thu, 16 Dec 1999 10:53:51 -0500 Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.120,2.121 In-Reply-To: Your message of "Wed, 15 Dec 1999 19:11:53 PST." References: Message-ID: <199912161553.KAA08428@eric.cnri.reston.va.us> > But this means that your tables no long reside in "const" space. Yet More > Per-Process Memory... & size python 1046211 + 117992 + 13640 = 1177843 I don't think there's much of a need to worry about this. Why are you always bringing up this subject? No-one else that I know has ever had this concern... --Guido van Rossum (home page: http://www.python.org/~guido/) From fdrake@weyr.cnri.reston.va.us Thu Dec 16 16:11:08 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 16 Dec 1999 11:11:08 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libmath.tex Message-ID: <199912161611.LAA10485@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libmath.tex Log Message: Add a discussion about the non-acceptance of complex numbers (yes, I know there is one in the cmath documentation as well). Needed here so that people can find this material more easily. Includes hyperlink to the cmath module. From guido@cnri.reston.va.us Thu Dec 16 17:49:05 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Thu, 16 Dec 1999 12:49:05 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.24,1.25 Message-ID: <199912161749.MAA11088@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: acconfig.h Log Message: Correct stupid typo (HAVE_GETHOSTBTNAME). Index: acconfig.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/acconfig.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** acconfig.h 1999/11/16 15:55:00 1.24 --- acconfig.h 1999/12/16 17:49:02 1.25 *************** *** 40,44 **** /* Define this if you have gethostbyname() */ ! #undef HAVE_GETHOSTBTNAME /* Define this if you have some version of gethostbyname_r() */ --- 40,44 ---- /* Define this if you have gethostbyname() */ ! #undef HAVE_GETHOSTBYNAME /* Define this if you have some version of gethostbyname_r() */ From guido@cnri.reston.va.us Thu Dec 16 17:49:30 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Thu, 16 Dec 1999 12:49:30 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src config.h.in,2.49,2.50 Message-ID: <199912161749.MAA11112@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: config.h.in Log Message: Regenerated after new acconfig.h. Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.49 retrieving revision 2.50 diff -C2 -r2.49 -r2.50 *** config.h.in 1999/12/14 21:11:46 2.49 --- config.h.in 1999/12/16 17:49:27 2.50 *************** *** 100,103 **** --- 100,106 ---- #undef HAVE_ALTZONE + /* Define this if you have gethostbyname() */ + #undef HAVE_GETHOSTBYNAME + /* Define this if you have some version of gethostbyname_r() */ #undef HAVE_GETHOSTBYNAME_R From guido@cnri.reston.va.us Thu Dec 16 17:50:56 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Thu, 16 Dec 1999 12:50:56 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src configure,1.104,1.105 configure.in,1.112,1.113 Message-ID: <199912161750.MAA11140@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: configure configure.in Log Message: Patch by Geoff Furnish to make compiling with C++ more gentle. (The configure script is regenerated, not from his patch.) Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.104 retrieving revision 1.105 diff -C2 -r1.104 -r1.105 *** configure 1999/12/14 21:11:46 1.104 --- configure 1999/12/16 17:50:52 1.105 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.111 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.113 [...3156 lines suppressed...] --- 4703,4707 ---- } EOF ! if { (eval echo configure:4706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull *************** *** 4824,4828 **** s%@MACHDEP@%$MACHDEP%g s%@SGI_ABI@%$SGI_ABI%g ! s%@SET_CCC@%$SET_CCC%g s%@CC@%$CC%g s%@MAKE_LDLIBRARY@%$MAKE_LDLIBRARY%g --- 4867,4872 ---- s%@MACHDEP@%$MACHDEP%g s%@SGI_ABI@%$SGI_ABI%g ! s%@SET_CXX@%$SET_CXX%g ! s%@MAINOBJ@%$MAINOBJ%g s%@CC@%$CC%g s%@MAKE_LDLIBRARY@%$MAKE_LDLIBRARY%g Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -r1.112 -r1.113 *** configure.in 1999/12/14 21:11:47 1.112 --- configure.in 1999/12/16 17:50:52 1.113 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.112 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.113 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 83,99 **** # Not all make programs have this predefined. # ! AC_SUBST(SET_CCC) ! AC_MSG_CHECKING(CCC) ! if test -z "$CCC" ! then ! case $ac_sys_system in ! IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";; ! Linux*) SET_CCC="CCC= g++";; ! *) SET_CCC="" ! esac ! else ! SET_CCC="CCC= ${CCC}" ! fi ! AC_MSG_RESULT($SET_CCC) --- 83,99 ---- # Not all make programs have this predefined. # ! #AC_SUBST(SET_CCC) ! #AC_MSG_CHECKING(CCC) ! #if test -z "$CCC" ! #then ! # case $ac_sys_system in ! # IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";; ! # Linux*) SET_CCC="CCC= g++";; ! # *) SET_CCC="" ! # esac ! #else ! # SET_CCC="CCC= ${CCC}" ! #fi ! #AC_MSG_RESULT($SET_CCC) *************** *** 153,156 **** --- 153,186 ---- AC_MSG_RESULT($without_gcc) + AC_SUBST(SET_CXX) + AC_SUBST(MAINOBJ) + MAINOBJ=python.o + AC_MSG_CHECKING(for --with-cxx=) + AC_ARG_WITH(cxx, [--with-cxx= enable C++ support],[ + case $withval in + no) CXX= + with_cxx=no;; + *) CXX=$withval + MAINOBJ=ccpython.o + with_cxx=$withval;; + esac], [ + with_cxx=no + ]) + AC_MSG_RESULT($with_cxx) + SET_CXX="CXX = $CXX" + + #AC_MSG_CHECKING(CCC) + #if test -z "$CCC" + #then + # case $ac_sys_system in + # IRIX*) SET_CCC="CCC= CC ${SGI_ABI}";; + # Linux*) SET_CCC="CCC= g++";; + # *) SET_CCC="" + # esac + #else + # SET_CCC="CCC= ${CCC}" + #fi + #AC_MSG_RESULT($SET_CCC) + # If the user switches compilers, we can't believe the cache if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" *************** *** 193,196 **** --- 223,230 ---- AC_SUBST(LINKCC) AC_MSG_CHECKING(LINKCC) + if test -z "$LINKCC" -a ! -z "$CXX" + then + LINKCC="$CXX" + fi if test -z "$LINKCC" then From guido@cnri.reston.va.us Thu Dec 16 17:52:10 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Thu, 16 Dec 1999 12:52:10 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules ccpython.cc,NONE,2.1 Makefile.pre.in,1.59,1.60 Message-ID: <199912161752.MAA11170@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory eric:/projects/python/develop/guido/src/Modules Modified Files: Makefile.pre.in Added Files: ccpython.cc Log Message: Patch and new file by Geoff Furnish for C++ compilation. Index: Makefile.pre.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/Makefile.pre.in,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -r1.59 -r1.60 *** Makefile.pre.in 1999/04/12 16:42:13 1.59 --- Makefile.pre.in 1999/12/16 17:52:08 1.60 *************** *** 18,22 **** VPATH= @srcdir@ ! @SET_CCC@ CC= @CC@ RANLIB= @RANLIB@ --- 18,22 ---- VPATH= @srcdir@ ! @SET_CXX@ CC= @CC@ RANLIB= @RANLIB@ *************** *** 96,100 **** OBJS= $(MODOBJS) $(FIXOBJS) ! MAINOBJ= python.o SYSLIBS= $(LIBM) $(LIBC) --- 96,101 ---- OBJS= $(MODOBJS) $(FIXOBJS) ! #MAINOBJ= python.o ! MAINOBJ= @MAINOBJ@ SYSLIBS= $(LIBM) $(LIBC) *************** *** 243,246 **** --- 244,250 ---- fi; \ done + + ccpython.o: ccpython.cc + $(CXX) $(CFLAGS) -c $*.cc # Stuff is appended here by makesetup and make depend From gstein@lyra.org Thu Dec 16 18:05:23 1999 From: gstein@lyra.org (Greg Stein) Date: Thu, 16 Dec 1999 10:05:23 -0800 (PST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.120,2.121 In-Reply-To: <199912161553.KAA08428@eric.cnri.reston.va.us> Message-ID: On Thu, 16 Dec 1999, Guido van Rossum wrote: > > But this means that your tables no long reside in "const" space. Yet More > > Per-Process Memory... > > & size python > 1046211 + 117992 + 13640 = 1177843 > > I don't think there's much of a need to worry about this. Why are you > always bringing up this subject? No-one else that I know has ever had > this concern... Somebody has to :-) Keeping the working set low is more efficient from a system standpoint. If you have 50 Python processes running, then you want them sharing as much as possible and you want the per-process working set as small as possible. A smaller working set means that you can start more processes before paging (i.e. it scales better), and it also leads to a faster startup time (less initialization and page allocation). Cheers, -g -- Greg Stein, http://www.lyra.org/ From fdrake@weyr.cnri.reston.va.us Mon Dec 20 18:02:32 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Mon, 20 Dec 1999 13:02:32 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libcgi.tex Message-ID: <199912201802.NAA17248@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libcgi.tex Log Message: Typo: vales --> values Reported by Roy Smith . From guido@cnri.reston.va.us Mon Dec 20 20:40:15 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 15:40:15 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python compile.c,2.98,2.99 Message-ID: <199912202040.PAA10361@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: compile.c Log Message: The cleanup code in com-init() at label fail_0000 should remove c_varnames, not c_lnotab. Index: compile.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/compile.c,v retrieving revision 2.98 retrieving revision 2.99 diff -C2 -r2.98 -r2.99 *** compile.c 1999/09/15 22:48:09 2.98 --- compile.c 1999/12/20 20:40:12 2.99 *************** *** 458,462 **** fail_0000: ! Py_DECREF(c->c_lnotab); fail_000: Py_DECREF(c->c_locals); --- 458,462 ---- fail_0000: ! Py_DECREF(c->c_varnames); fail_000: Py_DECREF(c->c_locals); From guido@cnri.reston.va.us Mon Dec 20 21:18:52 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:18:52 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python dynload_aix.c,NONE,2.1 dynload_beos.c,NONE,2.1 dynload_dl.c,NONE,2.1 dynload_hpux.c,NONE,2.1 dynload_mac.c,NONE,2.1 dynload_next.c,NONE,2.1 dynload_os2.c,NONE,2.1 dynload_shlib.c,NONE,2.1 dynload_stub.c,NONE,2.1 dynload_win.c,NONE,2.1 Message-ID: <199912202118.QAA10565@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Added Files: dynload_aix.c dynload_beos.c dynload_dl.c dynload_hpux.c dynload_mac.c dynload_next.c dynload_os2.c dynload_shlib.c dynload_stub.c dynload_win.c Log Message: The old platform-specific contents of importdl.c, broken down into one file per platform (really: per style of Dl API; e.g. all platforms using dlopen() are grouped together in dynload_shlib.c.). This is part of a set of patches by Greg Stein. From guido@cnri.reston.va.us Mon Dec 20 21:20:45 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:20:45 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python importdl.c,2.62,2.63 Message-ID: <199912202120.QAA10598@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: importdl.c Log Message: Moved most of the platform-specific code to dynload_.c files. (A few nite remain, these will probably disappear soon.) This is part of a set of patches by Greg Stein. Index: importdl.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/importdl.c,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -r2.62 -r2.63 *** importdl.c 1999/11/16 15:54:16 2.62 --- importdl.c 1999/12/20 21:20:42 2.63 *************** *** 34,43 **** #include "Python.h" - - #ifdef HAVE_SYS_PARAM_H - /* osdefs.h will define MAXPATHLEN if it's not already defined. */ - #include - #endif - #include "osdefs.h" #include "importdl.h" [...1154 lines suppressed...] - beos_nuke_dyn( py_id ); - retval = PyDict_DelItemString( beos_dyn_images, name ); - } - - py_id = PyInt_FromLong( (long)id ); - if( py_id ) { - retval = PyDict_SetItemString( beos_dyn_images, name, py_id ); - } - - #ifdef WITH_THREAD - PyThread_release_lock( beos_dyn_lock ); - #endif - } - - #endif /* __BEOS__ */ --- 161,164 ---- Py_INCREF(m); return m; ! #endif /* HAVE_DYNAMIC_LOADING */ } From guido@cnri.reston.va.us Mon Dec 20 21:22:27 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:22:27 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python importdl.h,2.10,2.11 Message-ID: <199912202122.QAA10620@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: importdl.h Log Message: Some rearrangements for the importdl.c restructuring. This is part of a set of patches by Greg Stein. Index: importdl.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/importdl.h,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -r2.10 -r2.11 *** importdl.h 1998/08/06 13:36:43 2.10 --- importdl.h 1999/12/20 21:22:24 2.11 *************** *** 1,2 **** --- 1,9 ---- + #ifndef Py_IMPORTDL_H + #define Py_IMPORTDL_H + + #ifdef __cplusplus + extern "C" { + #endif + /*********************************************************** Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, *************** *** 43,51 **** }; ! extern struct filedescr { char *suffix; char *mode; enum filetype type; ! } _PyImport_Filetab[]; extern PyObject *_PyImport_LoadDynamicModule --- 50,60 ---- }; ! struct filedescr { char *suffix; char *mode; enum filetype type; ! }; ! extern struct filedescr * _PyImport_Filetab; ! extern const struct filedescr _PyImport_DynLoadFiletab[]; extern PyObject *_PyImport_LoadDynamicModule *************** *** 54,55 **** --- 63,80 ---- /* Max length of module suffix searched for -- accommodates "module.slb" */ #define MAXSUFFIXSIZE 12 + + #ifdef MS_WINDOWS + typedef FARPROC dl_funcptr; + #else + #ifdef PYOS_OS2 + typedef int (* APIENTRY dl_funcptr)(); + #else + typedef void (*dl_funcptr)(void); + #endif + #endif + + + #ifdef __cplusplus + } + #endif + #endif /* !Py_IMPORTDL_H */ From guido@cnri.reston.va.us Mon Dec 20 21:23:44 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:23:44 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python import.c,2.126,2.127 Message-ID: <199912202123.QAA10644@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: import.c Log Message: In _PyImport_Init(), dynamically construct the table of legal suffixes from two static tables (one standard, one provided by the platform's dynload_*.c variant). This is part of a set of patches by Greg Stein. Index: import.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/import.c,v retrieving revision 2.126 retrieving revision 2.127 diff -C2 -r2.126 -r2.127 *** import.c 1999/04/07 16:07:20 2.126 --- import.c 1999/12/20 21:23:41 2.127 *************** *** 95,98 **** --- 95,106 ---- struct _inittab *PyImport_Inittab = _PyImport_Inittab; + /* these tables define the module suffixes that Python recognizes */ + struct filedescr * _PyImport_Filetab = NULL; + static const struct filedescr _PyImport_StandardFiletab[] = { + {".py", "r", PY_SOURCE}, + {".pyc", "rb", PY_COMPILED}, + {0, 0} + }; + /* Initialize things */ *************** *** 100,109 **** _PyImport_Init() { if (Py_OptimizeFlag) { ! /* Replace ".pyc" with ".pyo" in import_filetab */ ! struct filedescr *p; ! for (p = _PyImport_Filetab; p->suffix != NULL; p++) { ! if (strcmp(p->suffix, ".pyc") == 0) ! p->suffix = ".pyo"; } } --- 108,137 ---- _PyImport_Init() { + const struct filedescr *scan; + struct filedescr *filetab; + int countD = 0; + int countS = 0; + + /* prepare _PyImport_Filetab: copy entries from + _PyImport_DynLoadFiletab and _PyImport_StandardFiletab. + */ + for (scan = _PyImport_DynLoadFiletab; scan->suffix != NULL; ++scan) + ++countD; + for (scan = _PyImport_StandardFiletab; scan->suffix != NULL; ++scan) + ++countS; + filetab = malloc((countD + countS + 1) * sizeof(struct filedescr)); + memcpy(filetab, _PyImport_DynLoadFiletab, + countD * sizeof(struct filedescr)); + memcpy(filetab + countD, _PyImport_StandardFiletab, + countS * sizeof(struct filedescr)); + filetab[countD + countS].suffix = NULL; + + _PyImport_Filetab = filetab; + if (Py_OptimizeFlag) { ! /* Replace ".pyc" with ".pyo" in _PyImport_Filetab */ ! for (; filetab->suffix != NULL; filetab++) { ! if (strcmp(filetab->suffix, ".pyc") == 0) ! filetab->suffix = ".pyo"; } } From guido@cnri.reston.va.us Mon Dec 20 21:24:12 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:24:12 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python Makefile.in,2.21,2.22 Message-ID: <199912202124.QAA10667@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: Makefile.in Log Message: Support for selecting the correct dynload_.c file. This is part of a set of patches by Greg Stein. Index: Makefile.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/Makefile.in,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -r2.21 -r2.22 *** Makefile.in 1998/10/07 22:51:56 2.21 --- Makefile.in 1999/12/20 21:24:09 2.22 *************** *** 18,21 **** --- 18,22 ---- LIBS= @LIBS@ DLINCLDIR= @DLINCLDIR@ + DYNLOADFILE= @DYNLOADFILE@ # Machine-dependent subdirectories *************** *** 47,50 **** --- 48,52 ---- structmember.o sysmodule.o \ traceback.o \ + $(DYNLOADFILE) \ $(LIBOBJS) OBJS= $(AROBJS) sigcheck.o *************** *** 92,95 **** --- 94,107 ---- compile.o: compile.c dup2.o: dup2.c + dynload_aix.o: dynload_aix.c + dynload_beos.o: dynload_beos.c + dynload_dl.o: dynload_dl.c + dynload_hpux.o: dynload_hpux.c + dynload_mac.o: dynload_mac.c + dynload_next.o: dynload_next.c + dynload_os2.o: dynload_os2.c + dynload_shlib.o: dynload_shlib.c + dynload_stub.o: dynload_stub.c + dynload_win.o: dynload_win.c errors.o: errors.c fmod.o: fmod.c From guido@cnri.reston.va.us Mon Dec 20 21:24:39 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:24:39 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src acconfig.h,1.25,1.26 Message-ID: <199912202124.QAA10690@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: acconfig.h Log Message: Define HAVE_DYNAMIC_LOADING. This is part of a set of patches by Greg Stein. Index: acconfig.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/acconfig.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** acconfig.h 1999/12/16 17:49:02 1.25 --- acconfig.h 1999/12/20 21:24:37 1.26 *************** *** 143,146 **** --- 143,149 ---- #undef HAVE_LARGEFILE_SUPPORT + /* Defined when any dynamic module loading is enabled */ + #undef HAVE_DYNAMIC_LOADING + /* Leave that blank line there-- autoheader needs it! */ From guido@cnri.reston.va.us Mon Dec 20 21:26:01 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:26:01 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src config.h.in,2.50,2.51 Message-ID: <199912202126.QAA11142@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: config.h.in Log Message: Add line for HAVE_DYNAMIC_LOADING (result of editing acconfig.h). This is part of a set of patches by Greg Stein. Index: config.h.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/config.h.in,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -r2.50 -r2.51 *** config.h.in 1999/12/16 17:49:27 2.50 --- config.h.in 1999/12/20 21:25:59 2.51 *************** *** 198,201 **** --- 198,204 ---- #undef HAVE_LARGEFILE_SUPPORT + /* Defined when any dynamic module loading is enabled */ + #undef HAVE_DYNAMIC_LOADING + /* The number of bytes in a int. */ #undef SIZEOF_INT From guido@cnri.reston.va.us Mon Dec 20 21:27:25 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 16:27:25 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src configure,1.105,1.106 configure.in,1.113,1.114 Message-ID: <199912202127.QAA11170@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src In directory eric:/projects/python/develop/guido/src Modified Files: configure configure.in Log Message: Changes to auto-detect the correct dynload_.c file. NOTE: Windows, Mac and OS/2 build procedures must be adapted manually! This is part of a set of patches by Greg Stein. Index: configure =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -r1.105 -r1.106 *** configure 1999/12/16 17:50:52 1.105 --- configure 1999/12/20 21:27:22 1.106 *************** *** 1,5 **** #! /bin/sh ! # From configure.in Revision: 1.113 # Guess values for system-dependent variables and create Makefiles. --- 1,5 ---- #! /bin/sh ! # From configure.in Revision: 1.114 [...1309 lines suppressed...] *** 4703,4707 **** } EOF ! if { (eval echo configure:4706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull --- 4787,4791 ---- } EOF ! if { (eval echo configure:4790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_malloc_zero=nonnull *************** *** 4889,4892 **** --- 4973,4977 ---- s%@LDLAST@%$LDLAST%g s%@DLINCLDIR@%$DLINCLDIR%g + s%@DYNLOADFILE@%$DYNLOADFILE%g s%@LIBOBJS@%$LIBOBJS%g s%@HAVE_GETHOSTBYNAME_R_6_ARG@%$HAVE_GETHOSTBYNAME_R_6_ARG%g Index: configure.in =================================================================== RCS file: /projects/cvsroot/python/dist/src/configure.in,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -r1.113 -r1.114 *** configure.in 1999/12/16 17:50:52 1.113 --- configure.in 1999/12/20 21:27:22 1.114 *************** *** 1,4 **** dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.113 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) --- 1,4 ---- dnl Process this file with autoconf 2.0 or later to make a configure script. ! AC_REVISION($Revision: 1.114 $) AC_PREREQ(2.0) AC_INIT(Include/object.h) *************** *** 692,695 **** --- 692,696 ---- AC_MSG_RESULT($withval) AC_DEFINE(WITH_SGI_DL) + DYNLOADFILE="dynload_dl.o" dldir=$withval if test -d "$dldir" *************** *** 704,707 **** --- 705,709 ---- AC_MSG_RESULT($withval) AC_DEFINE(WITH_DL_DLD) + DYNLOADFILE="dynload_dl.o" dldir=`echo "$withval" | sed 's/,.*//'` dlddir=`echo "$withval" | sed 's/.*,//'` *************** *** 712,715 **** --- 714,748 ---- DLINCLDIR=${dldir} LIBS="$LIBS -ldl -ldld"], AC_MSG_RESULT(no)) + + # the dlopen() function means we might want to use dynload_shlib.o. some + # platforms, such as AIX, have dlopen(), but don't want to use it. + AC_CHECK_FUNC(dlopen) + + # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic + # loading of modules. + AC_SUBST(DYNLOADFILE) + AC_MSG_CHECKING(DYNLOADFILE) + if test -z "$DYNLOADFILE" + then + case $ac_sys_system/$ac_sys_release in + AIX*) DYNLOADFILE="dynload_aix.o";; + BeOS*) DYNLOADFILE="dynload_beos.o";; + hp*|HP*) DYNLOADFILE="dynload_hpux.o";; + next/*) DYNLOADFILE="dynload_next.o";; + *) + # use dynload_shlib.c and dlopen() if we have it; otherwise stub + # out any dynamic loading + if test "$ac_cv_func_dlopen" = yes + then DYNLOADFILE="dynload_shlib.o" + else DYNLOADFILE="dynload_stub.o" + fi + ;; + esac + fi + AC_MSG_RESULT($DYNLOADFILE) + if test "$DYNLOADFILE" != "dynload_stub.o" + then + AC_DEFINE(HAVE_DYNAMIC_LOADING) + fi # checks for library functions From akuchlin@CNRI.Reston.VA.US Mon Dec 20 22:13:41 1999 From: akuchlin@CNRI.Reston.VA.US (Andrew M. Kuchling) Date: Mon, 20 Dec 1999 17:13:41 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules zlibmodule.c,2.27,2.28 Message-ID: <199912202213.RAA03311@amarok.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory amarok:/home/akuchlin/src/Python-1.5/Modules Modified Files: zlibmodule.c Log Message: Fix typo in docstring: wbites -> wbits Index: zlibmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/zlibmodule.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -r2.27 -r2.28 *** zlibmodule.c 1999/04/12 14:35:48 2.27 --- zlibmodule.c 1999/12/20 22:13:38 2.28 *************** *** 854,858 **** "crc32(string) -- Compute a CRC-32 checksum.\n" "crc32(string, start) -- Compute a CRC-32 checksum using a given starting value.\n" ! "decompress(string,[wbites],[bufsize]) -- Decompresses a compressed string.\n" "decompressobj([wbits]) -- Return a decompressor object (wbits=window buffer size).\n\n" "Compressor objects support compress() and flush() methods; decompressor \n" --- 854,858 ---- "crc32(string) -- Compute a CRC-32 checksum.\n" "crc32(string, start) -- Compute a CRC-32 checksum using a given starting value.\n" ! "decompress(string,[wbits],[bufsize]) -- Decompresses a compressed string.\n" "decompressobj([wbits]) -- Return a decompressor object (wbits=window buffer size).\n\n" "Compressor objects support compress() and flush() methods; decompressor \n" From guido@cnri.reston.va.us Mon Dec 20 22:55:05 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 17:55:05 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python importdl.h,2.11,2.12 Message-ID: <199912202255.RAA11664@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: importdl.h Log Message: For Windows, need to add #include . Index: importdl.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/importdl.h,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -r2.11 -r2.12 *** importdl.h 1999/12/20 21:22:24 2.11 --- importdl.h 1999/12/20 22:55:03 2.12 *************** *** 65,68 **** --- 65,69 ---- #ifdef MS_WINDOWS + #include typedef FARPROC dl_funcptr; #else From guido@cnri.reston.va.us Mon Dec 20 22:57:43 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 17:57:43 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/PC config.h,1.29,1.30 Message-ID: <199912202257.RAA11694@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/PC In directory eric:/projects/python/develop/guido/src/PC Modified Files: config.h Log Message: Add HAVE_DYNAMIC_LOADING. Define Py_DEBUG when compiling in debug mode. (Is that a good idea?) Index: config.h =================================================================== RCS file: /projects/cvsroot/python/dist/src/PC/config.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** config.h 1999/06/09 15:36:37 1.29 --- config.h 1999/12/20 22:57:41 1.30 *************** *** 214,217 **** --- 214,218 ---- /* So nobody needs to specify the .lib in their Makefile any more */ #ifdef _DEBUG + #define Py_DEBUG #pragma comment(lib,"python15_d.lib") #else *************** *** 378,381 **** --- 379,385 ---- /* Define if you have clock. */ /* #define HAVE_CLOCK */ + + /* Define when any dynamic module loading is enabled */ + #define HAVE_DYNAMIC_LOADING /* Define if you have ftime. */ From guido@cnri.reston.va.us Mon Dec 20 23:00:13 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 18:00:13 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/PCbuild python15.dsp,1.8,1.9 Message-ID: <199912202300.SAA11742@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/PCbuild In directory eric:/projects/python/develop/guido/src/PCbuild Modified Files: python15.dsp Log Message: Add dynload_win.c to project. Index: python15.dsp =================================================================== RCS file: /projects/cvsroot/python/dist/src/PCbuild/python15.dsp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** python15.dsp 1999/04/13 15:44:21 1.8 --- python15.dsp 1999/12/20 23:00:10 1.9 *************** *** 174,177 **** --- 174,181 ---- # Begin Source File + SOURCE=..\Python\dynload_win.c + # End Source File + # Begin Source File + SOURCE=..\Modules\errnomodule.c # End Source File *************** *** 380,390 **** SOURCE=..\PC\python_nt.rc - - !IF "$(CFG)" == "python15 - Win32 Release" - - !ELSEIF "$(CFG)" == "python15 - Win32 Debug" - - !ENDIF - # End Source File # Begin Source File --- 384,387 ---- From guido@cnri.reston.va.us Mon Dec 20 23:02:44 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Mon, 20 Dec 1999 18:02:44 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/PCbuild python.dsp,1.5,1.6 Message-ID: <199912202302.SAA11772@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/PCbuild In directory eric:/projects/python/develop/guido/src/PCbuild Modified Files: python.dsp Log Message: Added setargv.obj to the link link. This causes * etc. on the command line to be expanded, link on Unix. Index: python.dsp =================================================================== RCS file: /projects/cvsroot/python/dist/src/PCbuild/python.dsp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** python.dsp 1998/08/13 18:54:50 1.5 --- python.dsp 1999/12/20 23:02:41 1.6 *************** *** 50,54 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"Release" !ELSEIF "$(CFG)" == "python - Win32 Debug" --- 50,54 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ! # ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /libpath:"Release" !ELSEIF "$(CFG)" == "python - Win32 Debug" *************** *** 74,78 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"./python_d.exe" /pdbtype:sept /libpath:"Debug" !ENDIF --- 74,78 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 setargv.obj kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"./python_d.exe" /pdbtype:sept /libpath:"Debug" !ENDIF From guido@cnri.reston.va.us Tue Dec 21 15:55:49 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 21 Dec 1999 10:55:49 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python dynload_aix.c,2.1,2.2 Message-ID: <199912211555.KAA12467@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: dynload_aix.c Log Message: Vladimir Marangozov: Here's a patch that avoids a warning caused by the "const char* pathname" declaration for _PyImport_GetDynLoadFunc (in dynload_aix). The "aix_load" function's 1st arg is prototyped as "char *pathname". Index: dynload_aix.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_aix.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_aix.c 1999/12/20 21:18:48 2.1 --- dynload_aix.c 1999/12/21 15:55:47 2.2 *************** *** 222,226 **** if (aix_getoldmodules(&staticmodlistptr) == -1) return NULL; ! p = (dl_funcptr) aix_load(pathname, L_NOAUTODEFER, 0); if (p == NULL) { aix_loaderror(pathname); --- 222,226 ---- if (aix_getoldmodules(&staticmodlistptr) == -1) return NULL; ! p = (dl_funcptr) aix_load((char *)pathname, L_NOAUTODEFER, 0); if (p == NULL) { aix_loaderror(pathname); From fdrake@weyr.cnri.reston.va.us Tue Dec 21 15:59:41 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 21 Dec 1999 10:59:41 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/html style.css Message-ID: <199912211559.KAA23895@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/html In directory weyr:/home/fdrake/projects/python/Doc-152p1/html Modified Files: Tag: release152p1-patches style.css Log Message: Typo: avantgarge --> avantgarde From fdrake@weyr.cnri.reston.va.us Tue Dec 21 18:31:33 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 21 Dec 1999 13:31:33 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libaifc.tex libwave.tex Message-ID: <199912211831.NAA24968@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libaifc.tex libwave.tex Log Message: Document that the |mode| parameter to open() is optional and explain how the default value is determined. From fdrake@weyr.cnri.reston.va.us Tue Dec 21 18:45:19 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 21 Dec 1999 13:45:19 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libfpformat.tex Message-ID: <199912211845.NAA25069@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libfpformat.tex Log Message: Document 1.5.2+ aspects of the NotANumber exception. (Note that this is in the development branch, not the maintenance branch!) From guido@cnri.reston.va.us Tue Dec 21 22:38:43 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Tue, 21 Dec 1999 17:38:43 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib getopt.py,1.7,1.8 Message-ID: <199912212238.RAA13660@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory eric:/projects/python/develop/guido/src/Lib Modified Files: getopt.py Log Message: Contribution from Gerrit Holl: This patch changes the string-based exceptions to class-based exceptions, so that you can fetch the unknown option as an attribute. As far as I know, it is backward compatible. [The new exception class is called GetoptError; the name error is an alias for compatibility.] Index: getopt.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/getopt.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** getopt.py 1998/11/17 04:16:37 1.7 --- getopt.py 1999/12/21 22:38:40 1.8 *************** *** 8,13 **** provides a single function and an exception: getopt() -- Parse command line options ! error -- Exception (string) raised when bad options are found """ --- 8,17 ---- provides a single function and an exception: + Gerrit Holl moved the string-based exceptions + to class-based exceptions. + getopt() -- Parse command line options ! GetoptError -- exception (class) raised with 'opt' attribute, which is the ! option involved with the exception. """ *************** *** 15,20 **** import string ! error = 'getopt.error' def getopt(args, shortopts, longopts = []): --- 19,38 ---- import string + + class GetoptError(Exception): + opt = '' + msg = '' + def __init__(self, *args): + self.args = args + if len(args) == 1: + self.msg = args[0] + elif len(args) == 2: + self.msg = args[0] + self.opt = args[1] + + def __str__(self): + return self.msg ! error = GetoptError # backward compatibility def getopt(args, shortopts, longopts = []): *************** *** 73,80 **** if optarg is None: if not args: ! raise error, 'option --%s requires argument' % opt optarg, args = args[0], args[1:] elif optarg: ! raise error, 'option --%s must not have an argument' % opt opts.append(('--' + opt, optarg or '')) return opts, args --- 91,98 ---- if optarg is None: if not args: ! raise GetoptError('option --%s requires argument' % opt, opt) optarg, args = args[0], args[1:] elif optarg: ! raise GetoptError('option --%s must not have an argument' % opt, opt) opts.append(('--' + opt, optarg or '')) return opts, args *************** *** 91,99 **** if y != '' and y != '=' and i+1 < len(longopts): if opt == longopts[i+1][:optlen]: ! raise error, 'option --%s not a unique prefix' % opt if longopts[i][-1:] in ('=', ): return 1, longopts[i][:-1] return 0, longopts[i] ! raise error, 'option --' + opt + ' not recognized' def do_shorts(opts, optstring, shortopts, args): --- 109,117 ---- if y != '' and y != '=' and i+1 < len(longopts): if opt == longopts[i+1][:optlen]: ! raise GetoptError('option --%s not a unique prefix' % opt, opt) if longopts[i][-1:] in ('=', ): return 1, longopts[i][:-1] return 0, longopts[i] ! raise GetoptError('option --%s not recognized' % opt, opt) def do_shorts(opts, optstring, shortopts, args): *************** *** 103,107 **** if optstring == '': if not args: ! raise error, 'option -%s requires argument' % opt optstring, args = args[0], args[1:] optarg, optstring = optstring, '' --- 121,125 ---- if optstring == '': if not args: ! raise GetoptError('option -%s requires argument' % opt, opt) optstring, args = args[0], args[1:] optarg, optstring = optstring, '' *************** *** 115,119 **** if opt == shortopts[i] != ':': return shortopts[i+1:i+2] == ':' ! raise error, 'option -%s not recognized' % opt if __name__ == '__main__': --- 133,137 ---- if opt == shortopts[i] != ':': return shortopts[i+1:i+2] == ':' ! raise GetoptError('option -%s not recognized' % opt, opt) if __name__ == '__main__': From fdrake@weyr.cnri.reston.va.us Tue Dec 21 22:50:08 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 21 Dec 1999 17:50:08 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libgetopt.tex Message-ID: <199912212250.RAA03054@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc/lib Modified Files: libgetopt.tex Log Message: Document GetoptError and label error an alias. From fdrake@weyr.cnri.reston.va.us Tue Dec 21 23:02:41 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Tue, 21 Dec 1999 18:02:41 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc TODO Message-ID: <199912212302.SAA03360@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc In directory weyr:/home/fdrake/projects/python/Doc Modified Files: TODO Log Message: Removed a couple of items that got done(!). Moved a couple to a new "Not worth it" section (explanations were already there). From guido@cnri.reston.va.us Wed Dec 22 14:09:39 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Wed, 22 Dec 1999 09:09:39 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python dynload_aix.c,2.2,2.3 dynload_beos.c,2.1,2.2 dynload_dl.c,2.1,2.2 dynload_hpux.c,2.1,2.2 dynload_mac.c,2.1,2.2 dynload_next.c,2.1,2.2 dynload_os2.c,2.1,2.2 dynload_shlib.c,2.1,2.2 dynload_win.c,2.1,2.2 import.c,2.127,2.128 importdl.c,2.63,2.64 Message-ID: <199912221409.JAA16115@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory eric:/projects/python/develop/guido/src/Python Modified Files: dynload_aix.c dynload_beos.c dynload_dl.c dynload_hpux.c dynload_mac.c dynload_next.c dynload_os2.c dynload_shlib.c dynload_win.c import.c importdl.c Log Message: Cleanup patches from Greg Stein: * in import.c, #ifdef out references to dynamic loading based on HAVE_DYNAMIC_LOADING * clean out the platform-specific crud from importdl.c. [ maybe fold this function into import.c and drop the importdl.c file? Greg.] * change GetDynLoadFunc's "funcname" parameter to "shortname". change "name" to "fqname" for clarification. * each GetDynLoadFunc now creates its own funcname value. WARNING: as I mentioned previously, we may run into an issue with a missing "_" on some platforms. Testing will show this pretty quickly, however. * move pathname munging into dynload_shlib.c Index: dynload_aix.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_aix.c,v retrieving revision 2.2 retrieving revision 2.3 diff -C2 -r2.2 -r2.3 *** dynload_aix.c 1999/12/21 15:55:47 2.2 --- dynload_aix.c 1999/12/22 14:09:35 2.3 *************** *** 203,207 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { --- 203,207 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { Index: dynload_beos.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_beos.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_beos.c 1999/12/20 21:18:48 2.1 --- dynload_beos.c 1999/12/22 14:09:35 2.2 *************** *** 186,190 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { --- 186,190 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { *************** *** 193,196 **** --- 193,197 ---- status_t retval; char fullpath[PATH_MAX]; + char funcname[258]; if( Py_VerboseFlag ) { *************** *** 237,240 **** --- 238,242 ---- } + sprintf(funcname, "init%.200s", shortname); if( Py_VerboseFlag ) { printf( "get_image_symbol( %s )\n", funcname ); *************** *** 275,279 **** * gracefully. */ ! beos_add_dyn( name, the_id ); return p; --- 277,281 ---- * gracefully. */ ! beos_add_dyn( fqname, the_id ); return p; Index: dynload_dl.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_dl.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_dl.c 1999/12/20 21:18:48 2.1 --- dynload_dl.c 1999/12/22 14:09:35 2.2 *************** *** 47,53 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { return dl_loadmod(Py_GetProgramName(), pathname, funcname); } --- 47,56 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { + char funcname[258]; + + sprintf(funcname, "init%.200s", shortname); return dl_loadmod(Py_GetProgramName(), pathname, funcname); } Index: dynload_hpux.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_hpux.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_hpux.c 1999/12/20 21:18:48 2.1 --- dynload_hpux.c 1999/12/22 14:09:35 2.2 *************** *** 38,41 **** --- 38,46 ---- #include "importdl.h" + #if defined(__hp9000s300) + #define FUNCNAME_PATTERN "_init%.200s" + #else + #define FUNCNAME_PATTERN "init%.200s" + #endif const struct filedescr _PyImport_DynLoadFiletab[] = { *************** *** 45,49 **** }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { --- 50,54 ---- }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { *************** *** 51,54 **** --- 56,60 ---- shl_t lib; int flags; + char funcname[258]; flags = BIND_FIRST | BIND_DEFERRED; *************** *** 68,71 **** --- 74,78 ---- return NULL; } + sprintf(funcname, FUNCNAME_PATTERN, shortname); if (Py_VerboseFlag) printf("shl_findsym %s\n", funcname); Index: dynload_mac.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_mac.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_mac.c 1999/12/20 21:18:48 2.1 --- dynload_mac.c 1999/12/22 14:09:35 2.2 *************** *** 60,67 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { dl_funcptr p; /* --- 60,68 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { dl_funcptr p; + char funcname[258]; /* *************** *** 122,125 **** --- 123,127 ---- } /* Locate the address of the correct init function */ + sprintf(funcname, "init%.200s", shortname); err = FindSymbol(connID, Pstring(funcname), &symAddr, &class); if ( err ) { Index: dynload_next.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_next.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_next.c 1999/12/20 21:18:48 2.1 --- dynload_next.c 1999/12/22 14:09:35 2.2 *************** *** 69,76 **** }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { dl_funcptr p = NULL; #ifdef USE_RLD --- 69,79 ---- }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { dl_funcptr p = NULL; + char funcname[258]; + + sprintf(funcname, "_init%.200s", shortname); #ifdef USE_RLD Index: dynload_os2.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_os2.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_os2.c 1999/12/20 21:18:48 2.1 --- dynload_os2.c 1999/12/22 14:09:35 2.2 *************** *** 46,50 **** }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { --- 46,50 ---- }; ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { *************** *** 53,56 **** --- 53,57 ---- HMODULE hDLL; char failreason[256]; + char funcname[258]; rc = DosLoadModule(failreason, *************** *** 68,71 **** --- 69,73 ---- } + sprintf(funcname, "init%.200s", shortname); rc = DosQueryProcAddr(hDLL, 0L, funcname, &p); if (rc != NO_ERROR) Index: dynload_shlib.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_shlib.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_shlib.c 1999/12/20 21:18:48 2.1 --- dynload_shlib.c 1999/12/22 14:09:35 2.2 *************** *** 66,74 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { dl_funcptr p; void *handle; if (fp != NULL) { --- 66,85 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { dl_funcptr p; void *handle; + char funcname[258]; + char pathbuf[260]; + + if (strchr(pathname, '/') == NULL) { + /* Prefix bare filename with "./" */ + sprintf(pathbuf, "./%-.255s", pathname); + pathname = pathbuf; + } + + /* ### should there be a leading underscore for some platforms? */ + sprintf(funcname, "init%.200s", shortname); if (fp != NULL) { Index: dynload_win.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/dynload_win.c,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -r2.1 -r2.2 *** dynload_win.c 1999/12/20 21:18:49 2.1 --- dynload_win.c 1999/12/22 14:09:35 2.2 *************** *** 50,57 **** ! dl_funcptr _PyImport_GetDynLoadFunc(const char *name, const char *funcname, const char *pathname, FILE *fp) { dl_funcptr p; #ifdef MS_WIN32 --- 50,60 ---- ! dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, const char *pathname, FILE *fp) { dl_funcptr p; + char funcname[258]; + + sprintf(funcname, "init%.200s", shortname); #ifdef MS_WIN32 Index: import.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/import.c,v retrieving revision 2.127 retrieving revision 2.128 diff -C2 -r2.127 -r2.128 *** import.c 1999/12/20 21:23:41 2.127 --- import.c 1999/12/22 14:09:35 2.128 *************** *** 1235,1241 **** --- 1235,1243 ---- break; + #ifdef HAVE_DYNAMIC_LOADING case C_EXTENSION: m = _PyImport_LoadDynamicModule(name, buf, fp); break; + #endif #ifdef macintosh *************** *** 2159,2162 **** --- 2161,2166 ---- } + #ifdef HAVE_DYNAMIC_LOADING + static PyObject * imp_load_dynamic(self, args) *************** *** 2181,2184 **** --- 2185,2190 ---- } + #endif /* HAVE_DYNAMIC_LOADING */ + static PyObject * imp_load_source(self, args) *************** *** 2331,2335 **** --- 2337,2343 ---- {"is_frozen", imp_is_frozen, 1}, {"load_compiled", imp_load_compiled, 1}, + #ifdef HAVE_DYNAMIC_LOADING {"load_dynamic", imp_load_dynamic, 1}, + #endif {"load_package", imp_load_package, 1}, #ifdef macintosh Index: importdl.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/importdl.c,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -r2.63 -r2.64 *** importdl.c 1999/12/20 21:20:42 2.63 --- importdl.c 1999/12/22 14:09:35 2.64 *************** *** 31,89 **** /* Support for dynamic loading of extension modules */ - /* If no dynamic linking is supported, this file still generates some code! */ #include "Python.h" - #include "importdl.h" - - /* Explanation of some of the the various #defines used by dynamic linking... ! symbol -- defined for: ! ! HAVE_DYNAMIC_LOADING -- any kind of dynamic linking (from ./configure) ! USE_SHLIB -- SunOS or IRIX 5 (SVR4?) shared libraries ! _AIX -- AIX style dynamic linking ! __NetBSD__ -- NetBSD shared libraries ! (assuming dlerror() was introduced between 1.2 and 1.3) ! __BEOS__ -- BeOS shared libraries - defined by the compiler */ - - /* Configure dynamic linking */ - #ifdef HAVE_DYNAMIC_LOADING extern dl_funcptr _PyImport_GetDynLoadFunc(const char *name, ! const char *funcname, const char *pathname, FILE *fp); - /* ### given NeXT, is WITH_DYLD not necessary? */ - - #if defined(__hp9000s300) || (defined(__NetBSD__) || defined(__FreeBSD__)) && !defined(__ELF__) || defined(__OpenBSD__) || defined(__BORLANDC__) || defined(NeXT) || defined(WITH_DYLD) - #define FUNCNAME_PATTERN "_init%.200s" - #else - #define FUNCNAME_PATTERN "init%.200s" - #endif - - /* ### temporary, for setting USE_SHLIB */ - #if defined(__NetBSD__) && (NetBSD < 199712) - #define USE_SHLIB - #else - #if defined(HAVE_DLOPEN) || defined(M_UNIX) - #define USE_SHLIB - #endif - #endif - #ifdef _AIX - #undef USE_SHLIB - #endif - #ifdef __BEOS__ - #undef USE_SHLIB - #endif - #endif /* HAVE_DYNAMIC_LOADING */ - - #ifdef NO_DYNAMIC_LINK - #undef HAVE_DYNAMIC_LOADING - #endif - PyObject * _PyImport_LoadDynamicModule(name, pathname, fp) --- 31,52 ---- /* Support for dynamic loading of extension modules */ #include "Python.h" ! /* ./configure sets HAVE_DYNAMIC_LOADING if dynamic loading of modules is ! supported on this platform. configure will then compile and link in one ! of the dynload_*.c files, as appropriate. We will call a function in ! those modules to get a function pointer to the module's init function. */ #ifdef HAVE_DYNAMIC_LOADING + #include "importdl.h" + extern dl_funcptr _PyImport_GetDynLoadFunc(const char *name, ! const char *shortname, const char *pathname, FILE *fp); PyObject * _PyImport_LoadDynamicModule(name, pathname, fp) *************** *** 92,113 **** FILE *fp; { - #ifndef HAVE_DYNAMIC_LOADING - PyErr_SetString(PyExc_ImportError, - "dynamically linked modules not supported"); - return NULL; - #else PyObject *m, *d, *s; - char funcname[258]; char *lastdot, *shortname, *packagecontext; ! dl_funcptr p = NULL; ! ! #ifdef USE_SHLIB ! char pathbuf[260]; ! if (strchr(pathname, '/') == NULL) { ! /* Prefix bare filename with "./" */ ! sprintf(pathbuf, "./%-.255s", pathname); ! pathname = pathbuf; ! } ! #endif /* USE_SHLIB */ if ((m = _PyImport_FindExtension(name, pathname)) != NULL) { --- 55,61 ---- FILE *fp; { PyObject *m, *d, *s; char *lastdot, *shortname, *packagecontext; ! dl_funcptr p; if ((m = _PyImport_FindExtension(name, pathname)) != NULL) { *************** *** 124,136 **** shortname = lastdot+1; } - sprintf(funcname, FUNCNAME_PATTERN, shortname); ! p = _PyImport_GetDynLoadFunc(name, funcname, pathname, fp); if (PyErr_Occurred()) return NULL; if (p == NULL) { PyErr_Format(PyExc_ImportError, ! "dynamic module does not define init function (%.200s)", ! funcname); return NULL; } --- 72,83 ---- shortname = lastdot+1; } ! p = _PyImport_GetDynLoadFunc(name, shortname, pathname, fp); if (PyErr_Occurred()) return NULL; if (p == NULL) { PyErr_Format(PyExc_ImportError, ! "dynamic module does not define init function (init%.200s)", ! shortname); return NULL; } *************** *** 161,164 **** Py_INCREF(m); return m; - #endif /* HAVE_DYNAMIC_LOADING */ } --- 108,112 ---- Py_INCREF(m); return m; } + + #endif /* HAVE_DYNAMIC_LOADING */ From fdrake@weyr.cnri.reston.va.us Wed Dec 22 16:13:57 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 22 Dec 1999 11:13:57 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules zlibmodule.c,2.28,2.29 Message-ID: <199912221613.LAA06244@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: zlibmodule.c Log Message: For ZlibError and ZLIB_VERSION, only attempt to add entry to the module dict if the inserted object isn't NULL (basic defensive programming!). Index: zlibmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/zlibmodule.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -r2.28 -r2.29 *** zlibmodule.c 1999/12/20 22:13:38 2.28 --- zlibmodule.c 1999/12/22 16:13:54 2.29 *************** *** 871,875 **** d = PyModule_GetDict(m); ZlibError = PyErr_NewException("zlib.error", NULL, NULL); ! PyDict_SetItemString(d, "error", ZlibError); insint(d, "MAX_WBITS", MAX_WBITS); --- 871,876 ---- d = PyModule_GetDict(m); ZlibError = PyErr_NewException("zlib.error", NULL, NULL); ! if (ZlibError != NULL) ! PyDict_SetItemString(d, "error", ZlibError); insint(d, "MAX_WBITS", MAX_WBITS); *************** *** 889,893 **** ver = PyString_FromString(ZLIB_VERSION); ! PyDict_SetItemString(d, "ZLIB_VERSION", ver); ! Py_DECREF(ver); } --- 890,896 ---- ver = PyString_FromString(ZLIB_VERSION); ! if (ver != NULL) { ! PyDict_SetItemString(d, "ZLIB_VERSION", ver); ! Py_DECREF(ver); ! } } From akuchlin@CNRI.Reston.VA.US Wed Dec 22 16:56:57 1999 From: akuchlin@CNRI.Reston.VA.US (Andrew M. Kuchling) Date: Wed, 22 Dec 1999 11:56:57 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libzlib.tex Message-ID: <199912221656.LAA06792@amarok.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory amarok:/home/akuchlin/src/Python-1.5/Doc/lib Modified Files: Tag: release152p1-patches libzlib.tex Log Message: Document the Decompress.unused_data attribute. Explain the wbits and bufsize parameters. From fdrake@weyr.cnri.reston.va.us Wed Dec 22 21:52:35 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Wed, 22 Dec 1999 16:52:35 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib pprint.py,1.9,1.10 Message-ID: <199912222152.QAA08327@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib In directory weyr:/home/fdrake/projects/python/Lib Modified Files: pprint.py Log Message: Don't call len() if the value is already cached! Caught by Gerrit Holl . Index: pprint.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/pprint.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** pprint.py 1999/09/02 15:09:44 1.9 --- pprint.py 1999/12/22 21:52:32 1.10 *************** *** 142,146 **** self.__format(object[0], stream, indent, allowance + 1, context, level) ! if len(object) > 1: for ent in object[1:]: stream.write(',\n' + ' '*indent) --- 142,146 ---- self.__format(object[0], stream, indent, allowance + 1, context, level) ! if length > 1: for ent in object[1:]: stream.write(',\n' + ' '*indent) From fdrake@weyr.cnri.reston.va.us Thu Dec 23 14:16:58 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 09:16:58 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.146,2.147 Message-ID: <199912231416.JAA11661@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Python In directory weyr:/home/fdrake/projects/python/Python Modified Files: bltinmodule.c Log Message: Adjusted apply() docstring based on comments from Gerrit Holl . Index: bltinmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.146 retrieving revision 2.147 diff -C2 -r2.146 -r2.147 *** bltinmodule.c 1999/10/12 19:54:53 2.146 --- bltinmodule.c 1999/12/23 14:16:55 2.147 *************** *** 131,138 **** static char apply_doc[] = ! "apply(function, args[, kwargs]) -> value\n\ \n\ ! Call a function with positional arguments taken from the tuple args,\n\ ! and keyword arguments taken from the optional dictionary kwargs."; --- 131,139 ---- static char apply_doc[] = ! "apply(object, args[, kwargs]) -> value\n\ \n\ ! Call a callable object with positional arguments taken from the tuple args,\n\ ! and keyword arguments taken from the optional dictionary kwargs.\n\ ! Note that classes are callable, as are instances with a __call__() method."; From fdrake@weyr.cnri.reston.va.us Thu Dec 23 15:36:46 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 10:36:46 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Lib/test test_b2.py,1.14,1.15 test_long.py,1.2,1.3 test_pow.py,1.3,1.4 Message-ID: <199912231536.KAA16379@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Lib/test In directory weyr:/home/fdrake/projects/python/Lib/test Modified Files: test_b2.py test_long.py test_pow.py Log Message: Revise tests to support str() not appending "L". Index: test_b2.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_b2.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** test_b2.py 1998/05/22 15:05:36 1.14 --- test_b2.py 1999/12/23 15:36:42 1.15 *************** *** 210,214 **** if str('') <> '': raise TestFailed, 'str(\'\')' if str(0) <> '0': raise TestFailed, 'str(0)' ! if str(0L) <> '0L': raise TestFailed, 'str(0L)' if str(()) <> '()': raise TestFailed, 'str(())' if str([]) <> '[]': raise TestFailed, 'str([])' --- 210,214 ---- if str('') <> '': raise TestFailed, 'str(\'\')' if str(0) <> '0': raise TestFailed, 'str(0)' ! if str(0L) <> '0': raise TestFailed, 'str(0L)' if str(()) <> '()': raise TestFailed, 'str(())' if str([]) <> '[]': raise TestFailed, 'str([])' Index: test_long.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_long.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** test_long.py 1998/10/02 01:19:46 1.2 --- test_long.py 1999/12/23 15:36:42 1.3 *************** *** 160,164 **** test_bitop_identities_3(x, y, getran((lenx + leny)/2)) ! # ------------------------------------------------------ hex oct str atol def slow_format(x, base): --- 160,164 ---- test_bitop_identities_3(x, y, getran((lenx + leny)/2)) ! # ------------------------------------------------- hex oct repr str atol def slow_format(x, base): *************** *** 182,186 **** def test_format_1(x): from string import atol ! for base, mapper in (8, oct), (10, str), (16, hex): got = mapper(x) expected = slow_format(x, base) --- 182,186 ---- def test_format_1(x): from string import atol ! for base, mapper in (8, oct), (10, repr), (16, hex): got = mapper(x) expected = slow_format(x, base) *************** *** 188,191 **** --- 188,197 ---- got, "but expected", expected, "for", x) check(atol(got, 0) == x, 'atol("%s", 0) !=' % got, x) + # str() has to be checked a little differently since there's no + # trailing "L" + got = str(x) + expected = slow_format(x, 10)[:-1] + check(got == expected, mapper.__name__, "returned", + got, "but expected", expected, "for", x) def test_format(maxdigits=MAXDIGITS): Index: test_pow.py =================================================================== RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_pow.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** test_pow.py 1998/03/26 19:42:30 1.3 --- test_pow.py 1999/12/23 15:36:42 1.4 *************** *** 57,74 **** print 'The number in both columns should match.' ! print pow(3,3) % 8, pow(3,3,8) ! print pow(3,3) % -8, pow(3,3,-8) ! print pow(3,2) % -2, pow(3,2,-2) ! print pow(-3,3) % 8, pow(-3,3,8) ! print pow(-3,3) % -8, pow(-3,3,-8) ! print pow(5,2) % -8, pow(5,2,-8) print ! print pow(3L,3L) % 8, pow(3L,3L,8) ! print pow(3L,3L) % -8, pow(3L,3L,-8) ! print pow(3L,2) % -2, pow(3L,2,-2) ! print pow(-3L,3L) % 8, pow(-3L,3L,8) ! print pow(-3L,3L) % -8, pow(-3L,3L,-8) ! print pow(5L,2) % -8, pow(5L,2,-8) print --- 57,74 ---- print 'The number in both columns should match.' ! print `pow(3,3) % 8`, `pow(3,3,8)` ! print `pow(3,3) % -8`, `pow(3,3,-8)` ! print `pow(3,2) % -2`, `pow(3,2,-2)` ! print `pow(-3,3) % 8`, `pow(-3,3,8)` ! print `pow(-3,3) % -8`, `pow(-3,3,-8)` ! print `pow(5,2) % -8`, `pow(5,2,-8)` print ! print `pow(3L,3L) % 8`, `pow(3L,3L,8)` ! print `pow(3L,3L) % -8`, `pow(3L,3L,-8)` ! print `pow(3L,2) % -2`, `pow(3L,2,-2)` ! print `pow(-3L,3L) % 8`, `pow(-3L,3L,8)` ! print `pow(-3L,3L) % -8`, `pow(-3L,3L,-8)` ! print `pow(5L,2) % -8`, `pow(5L,2,-8)` print From fdrake@weyr.cnri.reston.va.us Thu Dec 23 15:41:31 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 10:41:31 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects longobject.c,1.53,1.54 Message-ID: <199912231541.KAA16419@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory weyr:/home/fdrake/projects/python/Objects Modified Files: longobject.c Log Message: long_format(): Now takes a third parameter, addL; iff true, a trailing 'L' is appended to the representation, otherwise not. All existing call sites are modified to pass true for addL. Remove incorrect statement about external use of this function from elsewhere; it's static! long_str(): Handler for the tp_str slot in the type object. Identical to long_repr(), but passes false as the addL parameter of long_format(). Index: longobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/longobject.c,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -r1.53 -r1.54 *** longobject.c 1999/10/11 22:34:41 1.53 --- longobject.c 1999/12/23 15:41:28 1.54 *************** *** 48,52 **** static PyLongObject *muladd1 Py_PROTO((PyLongObject *, wdigit, wdigit)); static PyLongObject *divrem1 Py_PROTO((PyLongObject *, wdigit, digit *)); ! static PyObject *long_format Py_PROTO((PyObject *aa, int base)); static int ticker; /* XXX Could be shared with ceval? */ --- 48,52 ---- static PyLongObject *muladd1 Py_PROTO((PyLongObject *, wdigit, wdigit)); static PyLongObject *divrem1 Py_PROTO((PyLongObject *, wdigit, digit *)); ! static PyObject *long_format Py_PROTO((PyObject *aa, int base, int addL)); static int ticker; /* XXX Could be shared with ceval? */ *************** *** 571,581 **** /* Convert a long int object to a string, using a given conversion base. Return a string object. ! If base is 8 or 16, add the proper prefix '0' or '0x'. ! External linkage: used in bltinmodule.c by hex() and oct(). */ static PyObject * ! long_format(aa, base) PyObject *aa; int base; { register PyLongObject *a = (PyLongObject *)aa; --- 571,581 ---- /* Convert a long int object to a string, using a given conversion base. Return a string object. ! If base is 8 or 16, add the proper prefix '0' or '0x'. */ static PyObject * ! long_format(aa, base, addL) PyObject *aa; int base; + int addL; { register PyLongObject *a = (PyLongObject *)aa; *************** *** 600,604 **** i >>= 1; } ! i = 6 + (size_a*SHIFT + bits-1) / bits; str = (PyStringObject *) PyString_FromStringAndSize((char *)0, i); if (str == NULL) --- 600,604 ---- i >>= 1; } ! i = 5 + (addL ? 1 : 0) + (size_a*SHIFT + bits-1) / bits; str = (PyStringObject *) PyString_FromStringAndSize((char *)0, i); if (str == NULL) *************** *** 606,610 **** p = PyString_AS_STRING(str) + i; *p = '\0'; ! *--p = 'L'; if (a->ob_size < 0) sign = '-'; --- 606,611 ---- p = PyString_AS_STRING(str) + i; *p = '\0'; ! if (addL) ! *--p = 'L'; if (a->ob_size < 0) sign = '-'; *************** *** 975,981 **** PyObject *v; { ! return long_format(v, 10); } static int long_compare(a, b) --- 976,989 ---- PyObject *v; { ! return long_format(v, 10, 1); } + static PyObject * + long_str(v) + PyObject *v; + { + return long_format(v, 10, 0); + } + static int long_compare(a, b) *************** *** 1757,1761 **** PyObject *v; { ! return long_format(v, 8); } --- 1765,1769 ---- PyObject *v; { ! return long_format(v, 8, 1); } *************** *** 1764,1768 **** PyObject *v; { ! return long_format(v, 16); } --- 1772,1776 ---- PyObject *v; { ! return long_format(v, 16, 1); } *************** *** 1818,1820 **** --- 1826,1830 ---- (long (*) Py_FPROTO((PyObject *))) (hashfunc)long_hash, /*tp_hash*/ + 0, /*tp_call*/ + (reprfunc)long_str, /*tp_str*/ }; From fdrake@weyr.cnri.reston.va.us Thu Dec 23 16:45:59 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 11:45:59 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex Message-ID: <199912231645.LAA16824@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/api In directory weyr:/home/fdrake/projects/python/Doc-152p1/api Modified Files: Tag: release152p1-patches api.tex Log Message: PyString_AsString(): Clarified that the return value points to memory owned by Python, not a copy that needs to be freed. Point out that the contents must not be modified. Need for clarity pointed out by Greg Kochanski . From fdrake@weyr.cnri.reston.va.us Thu Dec 23 16:50:36 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 11:50:36 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/api api.tex Message-ID: <199912231650.LAA16911@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/api In directory weyr:/home/fdrake/projects/python/Doc-152p1/api Modified Files: Tag: release152p1-patches api.tex Log Message: PyString_AsString(): Strings are *not* NULL terminated; just say it's null-terminated. We *really* need a good proofreader for this stuff! From fdrake@weyr.cnri.reston.va.us Thu Dec 23 17:22:15 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 12:22:15 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc TODO Message-ID: <199912231722.MAA17061@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc In directory weyr:/home/fdrake/projects/python/Doc Modified Files: TODO Log Message: Added item about specific missing entries in the C API manual. From fdrake@weyr.cnri.reston.va.us Thu Dec 23 17:37:41 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 23 Dec 1999 12:37:41 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/ext ext.tex Message-ID: <199912231737.MAA17235@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/ext In directory weyr:/home/fdrake/projects/python/Doc-152p1/ext Modified Files: Tag: release152p1-patches ext.tex Log Message: In the section on PyArg_ParseTuple(), point out that object references are *borrowed* and should not be decrefed. Omission pointed out by Greg Kochanski . From guido@cnri.reston.va.us Thu Dec 23 19:00:31 1999 From: guido@cnri.reston.va.us (Guido van Rossum) Date: Thu, 23 Dec 1999 14:00:31 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Objects floatobject.c,2.52,2.53 Message-ID: <199912231900.OAA23159@eric.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Objects In directory eric:/projects/python/develop/guido/src/Objects Modified Files: floatobject.c Log Message: Implement the other easy thing: repr() of a float now uses %.17g, while str() uses %.12g as before. Index: floatobject.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/floatobject.c,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -r2.52 -r2.53 *** floatobject.c 1999/10/12 19:54:48 2.52 --- floatobject.c 1999/12/23 19:00:28 2.53 *************** *** 244,250 **** void ! PyFloat_AsString(buf, v) char *buf; PyFloatObject *v; { register char *cp; --- 244,251 ---- void ! PyFloat_AsStringEx(buf, v, precision) char *buf; PyFloatObject *v; + int precision; { register char *cp; *************** *** 254,258 **** However, %g may print the number as an integer; in such cases, we append ".0" to the string. */ ! sprintf(buf, "%.12g", v->ob_fval); cp = buf; if (*cp == '-') --- 255,259 ---- However, %g may print the number as an integer; in such cases, we append ".0" to the string. */ ! sprintf(buf, "%.*g", precision, v->ob_fval); cp = buf; if (*cp == '-') *************** *** 271,274 **** --- 272,300 ---- } + /* Precisions used by repr() and str(), respectively. + + The repr() precision (17 significant decimal digits) is the minimal number + that is guaranteed to have enough precision so that if the number is read + back in the exact same binary value is recreated. This is true for IEEE + floating point by design, and also happens to work for all other modern + hardware. + + The str() precision is chosen so that in most cases, the rounding noise + created by various operations is suppressed, while giving plenty of + precision for practical use. + + */ + + #define PREC_REPR 17 + #define PREC_STR 12 + + void + PyFloat_AsString(buf, v) + char *buf; + PyFloatObject *v; + { + PyFloat_AsStringEx(buf, v, PREC_STR); + } + /* ARGSUSED */ static int *************** *** 279,283 **** { char buf[100]; ! PyFloat_AsString(buf, v); fputs(buf, fp); return 0; --- 305,309 ---- { char buf[100]; ! PyFloat_AsStringEx(buf, v, flags&Py_PRINT_RAW ? PREC_STR : PREC_REPR); fputs(buf, fp); return 0; *************** *** 288,293 **** PyFloatObject *v; { char buf[100]; ! PyFloat_AsString(buf, v); return PyString_FromString(buf); } --- 314,328 ---- PyFloatObject *v; { + char buf[100]; + PyFloat_AsStringEx(buf, v, PREC_REPR); + return PyString_FromString(buf); + } + + static PyObject * + float_str(v) + PyFloatObject *v; + { char buf[100]; ! PyFloat_AsStringEx(buf, v, PREC_STR); return PyString_FromString(buf); } *************** *** 674,682 **** 0, /*tp_setattr*/ (cmpfunc)float_compare, /*tp_compare*/ ! (reprfunc)float_repr, /*tp_repr*/ &float_as_number, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ ! (hashfunc)float_hash, /*tp_hash*/ }; --- 709,719 ---- 0, /*tp_setattr*/ (cmpfunc)float_compare, /*tp_compare*/ ! (reprfunc)float_repr, /*tp_repr*/ &float_as_number, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ ! (hashfunc)float_hash, /*tp_hash*/ ! 0, /*tp_call*/ ! (reprfunc)float_str, /*tp_str*/ }; From fdrake@weyr.cnri.reston.va.us Thu Dec 30 18:05:46 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 30 Dec 1999 13:05:46 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Modules posixmodule.c,2.121,2.122 Message-ID: <199912301805.NAA04906@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Modules In directory weyr:/home/fdrake/projects/python/Modules Modified Files: posixmodule.c Log Message: setup_confname_table(): Use size_t instead of int for an index when building the dicts used to inform the user about the defined constants when using the *conf*() APIs. Thanks to Mark Hammond . Index: posixmodule.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.121 retrieving revision 2.122 diff -C2 -r2.121 -r2.122 *** posixmodule.c 1999/12/15 18:31:10 2.121 --- posixmodule.c 1999/12/30 18:05:43 2.122 *************** *** 4317,4321 **** if (d != NULL) { PyObject *o; ! int i = 0; for (; i < tablesize; ++i) { --- 4317,4321 ---- if (d != NULL) { PyObject *o; ! size_t i = 0; for (; i < tablesize; ++i) { From fdrake@weyr.cnri.reston.va.us Thu Dec 30 19:18:03 1999 From: fdrake@weyr.cnri.reston.va.us (Fred L. Drake) Date: Thu, 30 Dec 1999 14:18:03 -0500 (EST) Subject: [Python-checkins] CVS: python/dist/src/Doc/lib libqueue.tex Message-ID: <199912301918.OAA05040@weyr.cnri.reston.va.us> Update of /projects/cvsroot/python/dist/src/Doc/lib In directory weyr:/home/fdrake/projects/python/Doc-152p1/lib Modified Files: Tag: release152p1-patches libqueue.tex Log Message: The Full exception is raised by put_nowait(), not get_nowait(). Error reported by Justin Sheehy .