From loewis at users.sourceforge.net Tue Jun 1 00:36:54 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 1 00:36:57 2004 Subject: [Python-checkins] python/dist/src/Lib cookielib.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22544 Modified Files: cookielib.py Log Message: Silence noise in regrtest. Index: cookielib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cookielib.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cookielib.py 31 May 2004 18:22:40 -0000 1.1 --- cookielib.py 1 Jun 2004 04:36:51 -0000 1.2 *************** *** 35,39 **** from calendar import timegm - logging.getLogger("cookielib").addHandler(logging.StreamHandler()) debug = logging.getLogger("cookielib").debug --- 35,38 ---- From rhettinger at users.sourceforge.net Tue Jun 1 02:36:26 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 1 02:36:31 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.979,1.980 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4903/Misc Modified Files: NEWS Log Message: SF bug #942952: Weakness in tuple hash (Basic approach and test concept by Tim Peters.) * Improved the hash to reduce collisions. * Added the torture test to the test suite. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.979 retrieving revision 1.980 diff -C2 -d -r1.979 -r1.980 *** NEWS 31 May 2004 19:27:59 -0000 1.979 --- NEWS 1 Jun 2004 06:36:23 -0000 1.980 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - Improved the tuple hashing algorithm to give fewer collisions in + common cases. Fixes bug #942952. + - Implemented generator expressions (PEP 289). Coded by Jiwon Seo. From rhettinger at users.sourceforge.net Tue Jun 1 02:36:26 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 1 02:36:33 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_tuple.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4903/Lib/test Modified Files: test_tuple.py Log Message: SF bug #942952: Weakness in tuple hash (Basic approach and test concept by Tim Peters.) * Improved the hash to reduce collisions. * Added the torture test to the test suite. Index: test_tuple.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tuple.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_tuple.py 18 Jan 2004 21:03:23 -0000 1.2 --- test_tuple.py 1 Jun 2004 06:36:24 -0000 1.3 *************** *** 42,45 **** --- 42,64 ---- self.assertEqual(list(tuple(f())), range(1000)) + def test_hash(self): + # See SF bug 942952: Weakness in tuple hash + # The hash should: + # be non-commutative + # should spread-out closely spaced values + # should not exhibit cancellation in tuples like (x,(x,y)) + # should be distinct from element hashes: hash(x)!=hash((x,)) + # This test exercises those cases. + # For a pure random hash and N=50, the expected number of collisions + # is 7.3. Here we allow twice that number. + # Any worse and the hash function is sorely suspect. + + N=50 + base = range(N) + xp = [(i, j) for i in base for j in base] + inps = base + [(i, j) for i in base for j in xp] + \ + [(i, j) for i in xp for j in base] + xp + zip(base) + collisions = len(inps) - len(set(map(hash, inps))) + self.assert_(collisions <= 15) def test_main(): From rhettinger at users.sourceforge.net Tue Jun 1 02:36:26 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 1 02:36:35 2004 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c,2.90,2.91 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4903/Objects Modified Files: tupleobject.c Log Message: SF bug #942952: Weakness in tuple hash (Basic approach and test concept by Tim Peters.) * Improved the hash to reduce collisions. * Added the torture test to the test suite. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.90 retrieving revision 2.91 diff -C2 -d -r2.90 -r2.91 *** tupleobject.c 21 Mar 2004 22:29:05 -0000 2.90 --- tupleobject.c 1 Jun 2004 06:36:24 -0000 2.91 *************** *** 263,266 **** --- 263,267 ---- register int len = v->ob_size; register PyObject **p; + long mult = 1000003L; x = 0x345678L; p = v->ob_item; *************** *** 269,275 **** if (y == -1) return -1; ! x = (1000003*x) ^ y; } - x ^= v->ob_size; if (x == -1) x = -2; --- 270,276 ---- if (y == -1) return -1; ! x = (x ^ y) * mult; ! mult += 69068L + len + len; } if (x == -1) x = -2; From 9uakfcanu at dbzmail.com Tue Jun 1 13:46:02 2004 From: 9uakfcanu at dbzmail.com (Julio Harris) Date: Tue Jun 1 04:41:50 2004 Subject: [Python-checkins] When I Fall In Love With You Message-ID: <3$epys1-$7-$d59ww$ft8@m6lcy> ThereÿFFFF92s a whole new world on the Internet Where people fall in love with compatible people. What are you waiting for? Click below and weÿFFFF92ll take you on a magic carpet ride. http://powerfulthing.com/web/?oc=53033998 From akuchling at users.sourceforge.net Tue Jun 1 08:48:24 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Jun 1 08:48:31 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_sax.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9250 Modified Files: test_sax.py Log Message: [Bug #962631] Fix typo reported by Bryan Blackburn Index: test_sax.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_sax.py 20 Mar 2004 08:15:29 -0000 1.25 --- test_sax.py 1 Jun 2004 12:48:19 -0000 1.26 *************** *** 28,32 **** if outcome: if verbose: ! print "Failed", name else: failures.append(name) --- 28,32 ---- if outcome: if verbose: ! print "Passed", name else: failures.append(name) From akuchling at users.sourceforge.net Tue Jun 1 08:58:20 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Jun 1 08:58:25 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_sax.py, 1.24.16.1, 1.24.16.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10984 Modified Files: Tag: release23-maint test_sax.py Log Message: [Bug #962631] Fix typo reported by Bryan Blackburn Index: test_sax.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sax.py,v retrieving revision 1.24.16.1 retrieving revision 1.24.16.2 diff -C2 -d -r1.24.16.1 -r1.24.16.2 *** test_sax.py 20 Mar 2004 08:20:03 -0000 1.24.16.1 --- test_sax.py 1 Jun 2004 12:58:18 -0000 1.24.16.2 *************** *** 28,32 **** if outcome: if verbose: ! print "Failed", name else: failures.append(name) --- 28,32 ---- if outcome: if verbose: ! print "Passed", name else: failures.append(name) From akuchling at users.sourceforge.net Tue Jun 1 09:00:20 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Jun 1 09:00:26 2004 Subject: [Python-checkins] python/dist/src/Modules mmapmodule.c, 2.46, 2.46.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11696 Modified Files: Tag: release23-maint mmapmodule.c Log Message: Set data pointer to NULL after an error; this keeps the mmap_dealloc() function from trying to do msync(-1);munmap(-1). Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.46 retrieving revision 2.46.6.1 diff -C2 -d -r2.46 -r2.46.6.1 *** mmapmodule.c 15 Jul 2003 12:37:46 -0000 2.46 --- mmapmodule.c 1 Jun 2004 13:00:16 -0000 2.46.6.1 *************** *** 918,921 **** --- 918,922 ---- fd, 0); if (m_obj->data == (char *)-1) { + m_obj->data = NULL; Py_DECREF(m_obj); PyErr_SetFromErrno(mmap_module_error); From loewis at users.sourceforge.net Tue Jun 1 11:22:43 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 1 11:22:58 2004 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11725/Doc/api Modified Files: concrete.tex Log Message: Patch #957398: Add public API for Generator Object/Type. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** concrete.tex 25 Mar 2004 08:51:22 -0000 1.39 --- concrete.tex 1 Jun 2004 15:22:40 -0000 1.40 *************** *** 2604,2605 **** --- 2604,2636 ---- \var{cell} must be non-\NULL{} and must be a cell object. \end{cfuncdesc} + + + \subsection{Generator Objects \label{gen-objects}} + + Generator objects are what Python uses to implement generator iterators. + They are normally created by iterating over a function that yields values, + rather than explicitly calling \cfunction{PyGen_New}. + + \begin{ctypedesc}{PyGenObject} + The C structure used for generator objects. + \end{ctypedesc} + + \begin{cvardesc}{PyTypeObject}{PyGen_Type} + The type object corresponding to generator objects + \end{cvardesc} + + \begin{cfuncdesc}{int}{PyGen_Check}{ob} + Return true if \var{ob} is a generator object; \var{ob} must not be + \NULL. + \end{cfuncdesc} + + \begin{cfuncdesc}{int}{PyGen_CheckExact}{ob} + Return true if \var{ob}'s type is \var{PyGen_Type} + is a generator object; \var{ob} must not be + \NULL. + \end{cfuncdesc} + + \begin{cfuncdesc}{PyObject*}{PyGen_New}{PyFrameObject *frame} + Create and return a new generator object based on the \var{frame} object. + The parameter must not be \NULL. + \end{cfuncdesc} From loewis at users.sourceforge.net Tue Jun 1 11:22:43 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 1 11:23:00 2004 Subject: [Python-checkins] python/dist/src/Include genobject.h, NONE, 2.1 ceval.h, 2.50, 2.51 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11725/Include Modified Files: ceval.h Added Files: genobject.h Log Message: Patch #957398: Add public API for Generator Object/Type. --- NEW FILE: genobject.h --- /* Generator object interface */ #ifndef Py_GENOBJECT_H #define Py_GENOBJECT_H #ifdef __cplusplus extern "C" { #endif typedef struct { PyObject_HEAD /* The gi_ prefix is intended to remind of generator-iterator. */ PyFrameObject *gi_frame; /* True if generator is being executed. */ int gi_running; /* List of weak reference. */ PyObject *gi_weakreflist; } PyGenObject; PyAPI_DATA(PyTypeObject) PyGen_Type; #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) #define PyGen_CheckExact(op) ((op)->ob_type == &PyGen_Type) PyAPI_FUNC(PyObject *) PyGen_New(PyFrameObject *); #ifdef __cplusplus } #endif #endif /* !Py_GENOBJECT_H */ Index: ceval.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/ceval.h,v retrieving revision 2.50 retrieving revision 2.51 diff -C2 -d -r2.50 -r2.51 *** ceval.h 28 Oct 2003 12:05:46 -0000 2.50 --- ceval.h 1 Jun 2004 15:22:40 -0000 2.51 *************** *** 65,68 **** --- 65,69 ---- PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *); + PyAPI_FUNC(PyObject *) PyEval_EvaluateFrame(PyObject *); /* this used to be handled on a per-thread basis - now just two globals */ From loewis at users.sourceforge.net Tue Jun 1 11:22:44 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 1 11:23:03 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.980,1.981 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11725/Misc Modified Files: NEWS Log Message: Patch #957398: Add public API for Generator Object/Type. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.980 retrieving revision 1.981 diff -C2 -d -r1.980 -r1.981 *** NEWS 1 Jun 2004 06:36:23 -0000 1.980 --- NEWS 1 Jun 2004 15:22:41 -0000 1.981 *************** *** 498,501 **** --- 498,504 ---- ----- + - New public functions PyEval_EvaluateFrame and PyGen_New to expose + generator objects. + - New public functions Py_IncRef() and Py_DecRef(), exposing the functionality of the Py_XINCREF() and Py_XDECREF macros. Useful for From loewis at users.sourceforge.net Tue Jun 1 11:22:44 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 1 11:23:05 2004 Subject: [Python-checkins] python/dist/src/Objects genobject.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11725/Objects Added Files: genobject.c Log Message: Patch #957398: Add public API for Generator Object/Type. --- NEW FILE: genobject.c --- /* Generator object implementation */ #include "Python.h" #include "frameobject.h" #include "genobject.h" #include "ceval.h" #include "structmember.h" static int gen_traverse(PyGenObject *gen, visitproc visit, void *arg) { return visit((PyObject *)gen->gi_frame, arg); } static void gen_dealloc(PyGenObject *gen) { _PyObject_GC_UNTRACK(gen); if (gen->gi_weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) gen); Py_DECREF(gen->gi_frame); PyObject_GC_Del(gen); } static PyObject * gen_iternext(PyGenObject *gen) { PyThreadState *tstate = PyThreadState_GET(); PyFrameObject *f = gen->gi_frame; PyObject *result; if (gen->gi_running) { PyErr_SetString(PyExc_ValueError, "generator already executing"); return NULL; } if (f->f_stacktop == NULL) return NULL; /* Generators always return to their most recent caller, not * necessarily their creator. */ Py_XINCREF(tstate->frame); assert(f->f_back == NULL); f->f_back = tstate->frame; gen->gi_running = 1; result = PyEval_EvaluateFrame((PyObject *)f); gen->gi_running = 0; /* Don't keep the reference to f_back any longer than necessary. It * may keep a chain of frames alive or it could create a reference * cycle. */ Py_XDECREF(f->f_back); f->f_back = NULL; /* If the generator just returned (as opposed to yielding), signal * that the generator is exhausted. */ if (result == Py_None && f->f_stacktop == NULL) { Py_DECREF(result); result = NULL; } return result; } static PyObject * gen_getiter(PyObject *gen) { Py_INCREF(gen); return gen; } static PyMemberDef gen_memberlist[] = { {"gi_frame", T_OBJECT, offsetof(PyGenObject, gi_frame), RO}, {"gi_running", T_INT, offsetof(PyGenObject, gi_running), RO}, {NULL} /* Sentinel */ }; PyTypeObject PyGen_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, /* ob_size */ "generator", /* tp_name */ sizeof(PyGenObject), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)gen_dealloc, /* tp_dealloc */ 0, /* tp_print */ 0, /* tp_getattr */ 0, /* tp_setattr */ 0, /* tp_compare */ 0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ 0, /* tp_doc */ (traverseproc)gen_traverse, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ offsetof(PyGenObject, gi_weakreflist), /* tp_weaklistoffset */ (getiterfunc)gen_getiter, /* tp_iter */ (iternextfunc)gen_iternext, /* tp_iternext */ 0, /* tp_methods */ gen_memberlist, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ }; PyObject * PyGen_New(PyFrameObject *f) { PyGenObject *gen = PyObject_GC_New(PyGenObject, &PyGen_Type); if (gen == NULL) { Py_DECREF(f); return NULL; } gen->gi_frame = f; gen->gi_running = 0; gen->gi_weakreflist = NULL; _PyObject_GC_TRACK(gen); return (PyObject *)gen; } From loewis at users.sourceforge.net Tue Jun 1 11:22:45 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 1 11:23:07 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.396,2.397 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11725/Python Modified Files: ceval.c Log Message: Patch #957398: Add public API for Generator Object/Type. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.396 retrieving revision 2.397 diff -C2 -d -r2.396 -r2.397 *** ceval.c 11 Apr 2004 14:59:33 -0000 2.396 --- ceval.c 1 Jun 2004 15:22:42 -0000 2.397 *************** *** 11,14 **** --- 11,15 ---- #include "compile.h" #include "frameobject.h" + #include "genobject.h" #include "eval.h" #include "opcode.h" *************** *** 140,280 **** #endif - static PyTypeObject gentype; - - typedef struct { - PyObject_HEAD - /* The gi_ prefix is intended to remind of generator-iterator. */ - - PyFrameObject *gi_frame; - - /* True if generator is being executed. */ - int gi_running; - - /* List of weak reference. */ - PyObject *gi_weakreflist; - } genobject; - - static PyObject * - gen_new(PyFrameObject *f) - { - genobject *gen = PyObject_GC_New(genobject, &gentype); - if (gen == NULL) { - Py_DECREF(f); - return NULL; - } - gen->gi_frame = f; - gen->gi_running = 0; - gen->gi_weakreflist = NULL; - _PyObject_GC_TRACK(gen); - return (PyObject *)gen; - } - - static int - gen_traverse(genobject *gen, visitproc visit, void *arg) - { - return visit((PyObject *)gen->gi_frame, arg); - } - - static void - gen_dealloc(genobject *gen) - { - _PyObject_GC_UNTRACK(gen); - if (gen->gi_weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) gen); - Py_DECREF(gen->gi_frame); - PyObject_GC_Del(gen); - } - - static PyObject * - gen_iternext(genobject *gen) - { - PyThreadState *tstate = PyThreadState_GET(); - PyFrameObject *f = gen->gi_frame; - PyObject *result; - - if (gen->gi_running) { - PyErr_SetString(PyExc_ValueError, - "generator already executing"); - return NULL; - } - if (f->f_stacktop == NULL) - return NULL; - - /* Generators always return to their most recent caller, not - * necessarily their creator. */ - Py_XINCREF(tstate->frame); - assert(f->f_back == NULL); - f->f_back = tstate->frame; - - gen->gi_running = 1; - result = eval_frame(f); - gen->gi_running = 0; - - /* Don't keep the reference to f_back any longer than necessary. It - * may keep a chain of frames alive or it could create a reference - * cycle. */ - Py_XDECREF(f->f_back); - f->f_back = NULL; - - /* If the generator just returned (as opposed to yielding), signal - * that the generator is exhausted. */ - if (result == Py_None && f->f_stacktop == NULL) { - Py_DECREF(result); - result = NULL; - } - - return result; - } - - static PyObject * - gen_getiter(PyObject *gen) - { - Py_INCREF(gen); - return gen; - } - - static PyMemberDef gen_memberlist[] = { - {"gi_frame", T_OBJECT, offsetof(genobject, gi_frame), RO}, - {"gi_running", T_INT, offsetof(genobject, gi_running), RO}, - {NULL} /* Sentinel */ - }; - - static PyTypeObject gentype = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /* ob_size */ - "generator", /* tp_name */ - sizeof(genobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)gen_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)gen_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(genobject, gi_weakreflist), /* tp_weaklistoffset */ - (getiterfunc)gen_getiter, /* tp_iter */ - (iternextfunc)gen_iternext, /* tp_iternext */ - 0, /* tp_methods */ - gen_memberlist, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - }; - #ifdef WITH_THREAD --- 141,144 ---- *************** *** 2674,2678 **** /* Create a new generator that owns the ready to run frame * and return that as the value. */ ! return gen_new(f); } --- 2538,2542 ---- /* Create a new generator that owns the ready to run frame * and return that as the value. */ ! return PyGen_New(f); } *************** *** 3408,3411 **** --- 3272,3281 ---- } + PyObject * + PyEval_EvaluateFrame(PyObject *fo) + { + return eval_frame((PyFrameObject *)fo); + } + #define EXT_POP(STACK_POINTER) (*--(STACK_POINTER)) From loewis at users.sourceforge.net Tue Jun 1 11:23:13 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 1 11:23:17 2004 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.142,1.143 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11725 Modified Files: Makefile.pre.in Log Message: Patch #957398: Add public API for Generator Object/Type. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.142 retrieving revision 1.143 diff -C2 -d -r1.142 -r1.143 *** Makefile.pre.in 18 Mar 2004 07:51:27 -0000 1.142 --- Makefile.pre.in 1 Jun 2004 15:22:39 -0000 1.143 *************** *** 262,265 **** --- 262,266 ---- Objects/descrobject.o \ Objects/enumobject.o \ + Objects/genobject.o \ Objects/fileobject.o \ Objects/floatobject.o \ *************** *** 479,482 **** --- 480,484 ---- Include/dictobject.h \ Include/enumobject.h \ + Include/genobject.h \ Include/fileobject.h \ Include/floatobject.h \ From rhettinger at users.sourceforge.net Tue Jun 1 12:30:00 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 1 12:30:05 2004 Subject: [Python-checkins] python/dist/src/PC/VC6 pythoncore.dsp,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/PC/VC6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27164 Modified Files: pythoncore.dsp Log Message: Add genobject.c to the MSVC++ 6.0 build. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/VC6/pythoncore.dsp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pythoncore.dsp 27 Apr 2004 04:52:47 -0000 1.8 --- pythoncore.dsp 1 Jun 2004 16:29:57 -0000 1.9 *************** *** 362,365 **** --- 362,369 ---- # Begin Source File + SOURCE=..\..\Objects\genobject.c + # End Source File + # Begin Source File + SOURCE=..\..\Python\getargs.c # End Source File From loewis at users.sourceforge.net Tue Jun 1 13:21:17 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 1 13:21:19 2004 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.vcproj, 1.7, 1.8 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5828 Modified Files: pythoncore.vcproj Log Message: Add genobject.c Index: pythoncore.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.vcproj,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pythoncore.vcproj 27 Apr 2004 18:34:08 -0000 1.7 --- pythoncore.vcproj 1 Jun 2004 17:21:13 -0000 1.8 *************** *** 994,997 **** --- 994,1000 ---- + + Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28241 Modified Files: test_tuple.py Log Message: test_hash(): The test here is different enough from the one in the bug report that the stats for expected # of collisions are a little higher. Updated comments accordingly. Index: test_tuple.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tuple.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_tuple.py 1 Jun 2004 06:36:24 -0000 1.3 --- test_tuple.py 1 Jun 2004 18:58:04 -0000 1.4 *************** *** 50,56 **** # should be distinct from element hashes: hash(x)!=hash((x,)) # This test exercises those cases. ! # For a pure random hash and N=50, the expected number of collisions ! # is 7.3. Here we allow twice that number. ! # Any worse and the hash function is sorely suspect. N=50 --- 50,60 ---- # should be distinct from element hashes: hash(x)!=hash((x,)) # This test exercises those cases. ! # For a pure random hash and N=50, the expected number of occupied ! # buckets when tossing 252,600 balls into 2**32 buckets ! # is 252,592.6, or about 7.4 expected collisions. The ! # standard deviation is 2.73. On a box with 64-bit hash ! # codes, no collisions are expected. Here we accept no ! # more than 15 collisions. Any worse and the hash function ! # is sorely suspect. N=50 From pierslauder at users.sourceforge.net Tue Jun 1 20:42:38 2004 From: pierslauder at users.sourceforge.net (pierslauder@users.sourceforge.net) Date: Tue Jun 1 20:42:42 2004 Subject: [Python-checkins] python/dist/src/Lib imaplib.py,1.69,1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30614/dist/src/Lib Modified Files: imaplib.py Log Message: Added IMAP4_stream to __all__ Index: imaplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** imaplib.py 20 May 2004 11:32:35 -0000 1.69 --- imaplib.py 2 Jun 2004 00:42:36 -0000 1.70 *************** *** 24,28 **** import binascii, os, random, re, socket, sys, time ! __all__ = ["IMAP4", "IMAP4_SSL", "Internaldate2tuple", "Int2AP", "ParseFlags", "Time2Internaldate"] --- 24,28 ---- import binascii, os, random, re, socket, sys, time ! __all__ = ["IMAP4", "IMAP4_SSL", "IMAP4_stream", "Internaldate2tuple", "Int2AP", "ParseFlags", "Time2Internaldate"] From loewis at users.sourceforge.net Wed Jun 2 05:57:59 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 06:00:07 2004 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.317, 2.318 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20167/Modules Modified Files: posixmodule.c Log Message: Patch #954115: Fix os.stat handling of UNC roots. Will backport to 2.3. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.317 retrieving revision 2.318 diff -C2 -d -r2.317 -r2.318 *** posixmodule.c 4 May 2004 08:10:37 -0000 2.317 --- posixmodule.c 2 Jun 2004 09:57:56 -0000 2.318 *************** *** 893,896 **** --- 893,956 ---- } + #ifdef MS_WINDOWS + + /* IsUNCRoot -- test whether the supplied path is of the form \\SERVER\SHARE\, + where / can be used in place of \ and the trailing slash is optional. + Both SERVER and SHARE must have at least one character. + */ + + #define ISSLASHA(c) ((c) == '\\' || (c) == '/') + #define ISSLASHW(c) ((c) == L'\\' || (c) == L'/') + #define ARRAYSIZE(a) (sizeof(a) / sizeof(a[0])) + + static BOOL + IsUNCRootA(char *path, int pathlen) + { + #define ISSLASH ISSLASHA + + int i, share; + + if (pathlen < 5 || !ISSLASH(path[0]) || !ISSLASH(path[1])) + /* minimum UNCRoot is \\x\y */ + return FALSE; + for (i = 2; i < pathlen ; i++) + if (ISSLASH(path[i])) break; + if (i == 2 || i == pathlen) + /* do not allow \\\SHARE or \\SERVER */ + return FALSE; + share = i+1; + for (i = share; i < pathlen; i++) + if (ISSLASH(path[i])) break; + return (i != share && (i == pathlen || i == pathlen-1)); + + #undef ISSLASH + } + + #ifdef Py_WIN_WIDE_FILENAMES + static BOOL + IsUNCRootW(Py_UNICODE *path, int pathlen) + { + #define ISSLASH ISSLASHW + + int i, share; + + if (pathlen < 5 || !ISSLASH(path[0]) || !ISSLASH(path[1])) + /* minimum UNCRoot is \\x\y */ + return FALSE; + for (i = 2; i < pathlen ; i++) + if (ISSLASH(path[i])) break; + if (i == 2 || i == pathlen) + /* do not allow \\\SHARE or \\SERVER */ + return FALSE; + share = i+1; + for (i = share; i < pathlen; i++) + if (ISSLASH(path[i])) break; + return (i != share && (i == pathlen || i == pathlen-1)); + + #undef ISSLASH + } + #endif /* Py_WIN_WIDE_FILENAMES */ + #endif /* MS_WINDOWS */ + static PyObject * posix_do_stat(PyObject *self, PyObject *args, *************** *** 932,944 **** drive root (/ or \) or a specific drive's root (like c:\ or c:/). */ ! if (pathlen > 0 && ! (wpath[pathlen-1]== L'\\' || wpath[pathlen-1] == L'/')) { ! /* It does end with a slash -- exempt the root drive cases. */ ! /* XXX UNC root drives should also be exempted? */ ! if (pathlen == 1 || (pathlen == 3 && wpath[1] == L':')) ! /* leave it alone */; ! else { ! /* nuke the trailing backslash */ ! wpath[pathlen-1] = L'\0'; } } --- 992,1011 ---- drive root (/ or \) or a specific drive's root (like c:\ or c:/). */ ! if (pathlen > 0) { ! if (ISSLASHW(wpath[pathlen-1])) { ! /* It does end with a slash -- exempt the root drive cases. */ ! if (pathlen == 1 || (pathlen == 3 && wpath[1] == L':') || ! IsUNCRootW(wpath, pathlen)) ! /* leave it alone */; ! else { ! /* nuke the trailing backslash */ ! wpath[pathlen-1] = L'\0'; ! } ! } ! else if (ISSLASHW(wpath[1]) && pathlen < ARRAYSIZE(wpath)-1 && ! IsUNCRootW(wpath, pathlen)) { ! /* UNC root w/o trailing slash: add one when there's room */ ! wpath[pathlen++] = L'\\'; ! wpath[pathlen] = L'\0'; } } *************** *** 975,988 **** drive root (/ or \) or a specific drive's root (like c:\ or c:/). */ ! if (pathlen > 0 && ! (path[pathlen-1]== '\\' || path[pathlen-1] == '/')) { ! /* It does end with a slash -- exempt the root drive cases. */ ! /* XXX UNC root drives should also be exempted? */ ! if (pathlen == 1 || (pathlen == 3 && path[1] == ':')) ! /* leave it alone */; ! else { ! /* nuke the trailing backslash */ strncpy(pathcopy, path, pathlen); ! pathcopy[pathlen-1] = '\0'; path = pathcopy; } --- 1042,1064 ---- drive root (/ or \) or a specific drive's root (like c:\ or c:/). */ ! if (pathlen > 0) { ! if (ISSLASHA(path[pathlen-1])) { ! /* It does end with a slash -- exempt the root drive cases. */ ! if (pathlen == 1 || (pathlen == 3 && path[1] == ':') || ! IsUNCRootA(path, pathlen)) ! /* leave it alone */; ! else { ! /* nuke the trailing backslash */ ! strncpy(pathcopy, path, pathlen); ! pathcopy[pathlen-1] = '\0'; ! path = pathcopy; ! } ! } ! else if (ISSLASHA(path[1]) && pathlen < ARRAYSIZE(pathcopy)-1 && ! IsUNCRootA(path, pathlen)) { ! /* UNC root w/o trailing slash: add one when there's room */ strncpy(pathcopy, path, pathlen); ! pathcopy[pathlen++] = '\\'; ! pathcopy[pathlen] = '\0'; path = pathcopy; } From loewis at users.sourceforge.net Wed Jun 2 05:57:59 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 06:00:28 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.981,1.982 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20167/Misc Modified Files: NEWS Log Message: Patch #954115: Fix os.stat handling of UNC roots. Will backport to 2.3. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.981 retrieving revision 1.982 diff -C2 -d -r1.981 -r1.982 *** NEWS 1 Jun 2004 15:22:41 -0000 1.981 --- NEWS 2 Jun 2004 09:57:55 -0000 1.982 *************** *** 211,214 **** --- 211,216 ---- ----------------- + - nt now properly allows to refer to UNC roots, e.g. in nt.stat(). + - the weakref module now supports additional objects: array.array, sre.pattern_objects, file objects, and sockets. From loewis at users.sourceforge.net Wed Jun 2 06:07:19 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 06:07:26 2004 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.300.8.9, 2.300.8.10 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21802/Modules Modified Files: Tag: release23-maint posixmodule.c Log Message: Patch #954115: Fix os.stat handling of UNC roots. Closes #513572. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.300.8.9 retrieving revision 2.300.8.10 diff -C2 -d -r2.300.8.9 -r2.300.8.10 *** posixmodule.c 4 May 2004 08:07:49 -0000 2.300.8.9 --- posixmodule.c 2 Jun 2004 10:07:01 -0000 2.300.8.10 *************** *** 903,906 **** --- 903,966 ---- } + #ifdef MS_WINDOWS + + /* IsUNCRoot -- test whether the supplied path is of the form \\SERVER\SHARE\, + where / can be used in place of \ and the trailing slash is optional. + Both SERVER and SHARE must have at least one character. + */ + + #define ISSLASHA(c) ((c) == '\\' || (c) == '/') + #define ISSLASHW(c) ((c) == L'\\' || (c) == L'/') + #define ARRAYSIZE(a) (sizeof(a) / sizeof(a[0])) + + static BOOL + IsUNCRootA(char *path, int pathlen) + { + #define ISSLASH ISSLASHA + + int i, share; + + if (pathlen < 5 || !ISSLASH(path[0]) || !ISSLASH(path[1])) + /* minimum UNCRoot is \\x\y */ + return FALSE; + for (i = 2; i < pathlen ; i++) + if (ISSLASH(path[i])) break; + if (i == 2 || i == pathlen) + /* do not allow \\\SHARE or \\SERVER */ + return FALSE; + share = i+1; + for (i = share; i < pathlen; i++) + if (ISSLASH(path[i])) break; + return (i != share && (i == pathlen || i == pathlen-1)); + + #undef ISSLASH + } + + #ifdef Py_WIN_WIDE_FILENAMES + static BOOL + IsUNCRootW(Py_UNICODE *path, int pathlen) + { + #define ISSLASH ISSLASHW + + int i, share; + + if (pathlen < 5 || !ISSLASH(path[0]) || !ISSLASH(path[1])) + /* minimum UNCRoot is \\x\y */ + return FALSE; + for (i = 2; i < pathlen ; i++) + if (ISSLASH(path[i])) break; + if (i == 2 || i == pathlen) + /* do not allow \\\SHARE or \\SERVER */ + return FALSE; + share = i+1; + for (i = share; i < pathlen; i++) + if (ISSLASH(path[i])) break; + return (i != share && (i == pathlen || i == pathlen-1)); + + #undef ISSLASH + } + #endif /* Py_WIN_WIDE_FILENAMES */ + #endif /* MS_WINDOWS */ + static PyObject * posix_do_stat(PyObject *self, PyObject *args, *************** *** 942,954 **** drive root (/ or \) or a specific drive's root (like c:\ or c:/). */ ! if (pathlen > 0 && ! (wpath[pathlen-1]== L'\\' || wpath[pathlen-1] == L'/')) { ! /* It does end with a slash -- exempt the root drive cases. */ ! /* XXX UNC root drives should also be exempted? */ ! if (pathlen == 1 || (pathlen == 3 && wpath[1] == L':')) ! /* leave it alone */; ! else { ! /* nuke the trailing backslash */ ! wpath[pathlen-1] = L'\0'; } } --- 1002,1021 ---- drive root (/ or \) or a specific drive's root (like c:\ or c:/). */ ! if (pathlen > 0) { ! if (ISSLASHW(wpath[pathlen-1])) { ! /* It does end with a slash -- exempt the root drive cases. */ ! if (pathlen == 1 || (pathlen == 3 && wpath[1] == L':') || ! IsUNCRootW(wpath, pathlen)) ! /* leave it alone */; ! else { ! /* nuke the trailing backslash */ ! wpath[pathlen-1] = L'\0'; ! } ! } ! else if (ISSLASHW(wpath[1]) && pathlen < ARRAYSIZE(wpath)-1 && ! IsUNCRootW(wpath, pathlen)) { ! /* UNC root w/o trailing slash: add one when there's room */ ! wpath[pathlen++] = L'\\'; ! wpath[pathlen] = L'\0'; } } *************** *** 985,998 **** drive root (/ or \) or a specific drive's root (like c:\ or c:/). */ ! if (pathlen > 0 && ! (path[pathlen-1]== '\\' || path[pathlen-1] == '/')) { ! /* It does end with a slash -- exempt the root drive cases. */ ! /* XXX UNC root drives should also be exempted? */ ! if (pathlen == 1 || (pathlen == 3 && path[1] == ':')) ! /* leave it alone */; ! else { ! /* nuke the trailing backslash */ strncpy(pathcopy, path, pathlen); ! pathcopy[pathlen-1] = '\0'; path = pathcopy; } --- 1052,1074 ---- drive root (/ or \) or a specific drive's root (like c:\ or c:/). */ ! if (pathlen > 0) { ! if (ISSLASHA(path[pathlen-1])) { ! /* It does end with a slash -- exempt the root drive cases. */ ! if (pathlen == 1 || (pathlen == 3 && path[1] == ':') || ! IsUNCRootA(path, pathlen)) ! /* leave it alone */; ! else { ! /* nuke the trailing backslash */ ! strncpy(pathcopy, path, pathlen); ! pathcopy[pathlen-1] = '\0'; ! path = pathcopy; ! } ! } ! else if (ISSLASHA(path[1]) && pathlen < ARRAYSIZE(pathcopy)-1 && ! IsUNCRootA(path, pathlen)) { ! /* UNC root w/o trailing slash: add one when there's room */ strncpy(pathcopy, path, pathlen); ! pathcopy[pathlen++] = '\\'; ! pathcopy[pathlen] = '\0'; path = pathcopy; } From loewis at users.sourceforge.net Wed Jun 2 06:07:34 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 06:07:41 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.112, 1.831.4.113 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21802/Misc Modified Files: Tag: release23-maint NEWS Log Message: Patch #954115: Fix os.stat handling of UNC roots. Closes #513572. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.112 retrieving revision 1.831.4.113 diff -C2 -d -r1.831.4.112 -r1.831.4.113 *** NEWS 25 May 2004 18:36:41 -0000 1.831.4.112 --- NEWS 2 Jun 2004 10:07:00 -0000 1.831.4.113 *************** *** 8,11 **** --- 8,21 ---- =================================== + *Release date: xx-xxx-2004* + + Extension modules + ----------------- + + - Patch #954115: Properly handle UNC roots in nt.stat. + + What's New in Python 2.3.4 (final)? + =================================== + *Release date: 27-May-2004* From jmmgekcabknrn at apollo.lv Wed Jun 2 07:34:45 2004 From: jmmgekcabknrn at apollo.lv (Beulah Mcallister) Date: Wed Jun 2 06:36:04 2004 Subject: [Python-checkins] Get Your Diploma Today mitten ferreira Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040602/955107ea/attachment.html From vsajip at users.sourceforge.net Wed Jun 2 06:51:12 2004 From: vsajip at users.sourceforge.net (vsajip@users.sourceforge.net) Date: Wed Jun 2 06:51:17 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_logging.py, 1.13, 1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28928 Modified Files: test_logging.py Log Message: Copyright year changed Index: test_logging.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_logging.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_logging.py 20 Feb 2004 13:19:16 -0000 1.13 --- test_logging.py 2 Jun 2004 10:51:05 -0000 1.14 *************** *** 1,5 **** #!/usr/bin/env python # ! # Copyright 2001-2002 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its --- 1,5 ---- #!/usr/bin/env python # ! # Copyright 2001-2004 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its From loewis at users.sourceforge.net Wed Jun 2 08:35:34 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 08:35:40 2004 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c, 1.289, 1.290 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13779/Modules Modified Files: socketmodule.c Log Message: Patch #924294: Do not check for AF_INET6 if it is not defined. Will backport to 2.3. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.289 retrieving revision 1.290 diff -C2 -d -r1.289 -r1.290 *** socketmodule.c 26 May 2004 17:06:31 -0000 1.289 --- socketmodule.c 2 Jun 2004 12:35:29 -0000 1.290 *************** *** 3101,3105 **** } ! #ifndef ENABLE_IPV6 if(af == AF_INET6) { PyErr_SetString(socket_error, --- 3101,3105 ---- } ! #if !defined(ENABLE_IPV6) && defined(AF_INET6) if(af == AF_INET6) { PyErr_SetString(socket_error, From loewis at users.sourceforge.net Wed Jun 2 08:36:51 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 08:36:55 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.113, 1.831.4.114 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14087/Misc Modified Files: Tag: release23-maint NEWS Log Message: Patch #924294: Do not check for AF_INET6 if it is not defined. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.113 retrieving revision 1.831.4.114 diff -C2 -d -r1.831.4.113 -r1.831.4.114 *** NEWS 2 Jun 2004 10:07:00 -0000 1.831.4.113 --- NEWS 2 Jun 2004 12:36:48 -0000 1.831.4.114 *************** *** 13,16 **** --- 13,18 ---- ----------------- + - Patch #924294: Do no check for AF_INET6 if it is not defined. + - Patch #954115: Properly handle UNC roots in nt.stat. From loewis at users.sourceforge.net Wed Jun 2 08:36:51 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 08:36:56 2004 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c, 1.271.6.7, 1.271.6.8 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14087/Modules Modified Files: Tag: release23-maint socketmodule.c Log Message: Patch #924294: Do not check for AF_INET6 if it is not defined. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.271.6.7 retrieving revision 1.271.6.8 diff -C2 -d -r1.271.6.7 -r1.271.6.8 *** socketmodule.c 11 Apr 2004 12:10:03 -0000 1.271.6.7 --- socketmodule.c 2 Jun 2004 12:36:49 -0000 1.271.6.8 *************** *** 2976,2980 **** } ! #ifndef ENABLE_IPV6 if(af == AF_INET6) { PyErr_SetString(socket_error, --- 2976,2980 ---- } ! #if !defined(ENABLE_IPV6) && defined(AF_INET6) if(af == AF_INET6) { PyErr_SetString(socket_error, From loewis at users.sourceforge.net Wed Jun 2 08:45:30 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 08:45:33 2004 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15579 Modified Files: concrete.tex Log Message: Document PyModule_AddIntConstant to take a long. Fixes #962471. Will backport to 2.3. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** concrete.tex 1 Jun 2004 15:22:40 -0000 1.40 --- concrete.tex 2 Jun 2004 12:45:27 -0000 1.41 *************** *** 2264,2268 **** \begin{cfuncdesc}{int}{PyModule_AddIntConstant}{PyObject *module, ! char *name, int value} Add an integer constant to \var{module} as \var{name}. This convenience function can be used from the module's initialization --- 2264,2268 ---- \begin{cfuncdesc}{int}{PyModule_AddIntConstant}{PyObject *module, ! char *name, long value} Add an integer constant to \var{module} as \var{name}. This convenience function can be used from the module's initialization From loewis at users.sourceforge.net Wed Jun 2 08:45:50 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 08:45:53 2004 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex, 1.25.10.7, 1.25.10.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15695 Modified Files: Tag: release23-maint concrete.tex Log Message: Document PyModule_AddIntConstant to take a long. Fixes #962471. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.25.10.7 retrieving revision 1.25.10.8 diff -C2 -d -r1.25.10.7 -r1.25.10.8 *** concrete.tex 25 Mar 2004 08:55:58 -0000 1.25.10.7 --- concrete.tex 2 Jun 2004 12:45:46 -0000 1.25.10.8 *************** *** 2236,2240 **** \begin{cfuncdesc}{int}{PyModule_AddIntConstant}{PyObject *module, ! char *name, int value} Add an integer constant to \var{module} as \var{name}. This convenience function can be used from the module's initialization --- 2236,2240 ---- \begin{cfuncdesc}{int}{PyModule_AddIntConstant}{PyObject *module, ! char *name, long value} Add an integer constant to \var{module} as \var{name}. This convenience function can be used from the module's initialization From loewis at users.sourceforge.net Wed Jun 2 08:48:36 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 08:48:39 2004 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16133 Modified Files: ref2.tex Log Message: Fix typo reported in #964592. Will backport to 2.3. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** ref2.tex 8 Feb 2004 20:18:26 -0000 1.51 --- ref2.tex 2 Jun 2004 12:48:20 -0000 1.52 *************** *** 349,353 **** \item[\code{__*}] Class-private names. Names in this category, when used within the ! context of a class definition, are re-written to use a mangled for to help avoid name clashes between ``private'' attributes of base and derived classes. --- 349,353 ---- \item[\code{__*}] Class-private names. Names in this category, when used within the ! context of a class definition, are re-written to use a mangled form to help avoid name clashes between ``private'' attributes of base and derived classes. From loewis at users.sourceforge.net Wed Jun 2 08:48:44 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 08:48:48 2004 Subject: [Python-checkins] python/dist/src/Doc/ref ref2.tex, 1.48.10.2, 1.48.10.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16254 Modified Files: Tag: release23-maint ref2.tex Log Message: Fix typo reported in #964592. Index: ref2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref2.tex,v retrieving revision 1.48.10.2 retrieving revision 1.48.10.3 diff -C2 -d -r1.48.10.2 -r1.48.10.3 *** ref2.tex 8 Feb 2004 20:19:42 -0000 1.48.10.2 --- ref2.tex 2 Jun 2004 12:48:41 -0000 1.48.10.3 *************** *** 349,353 **** \item[\code{__*}] Class-private names. Names in this category, when used within the ! context of a class definition, are re-written to use a mangled for to help avoid name clashes between ``private'' attributes of base and derived classes. --- 349,353 ---- \item[\code{__*}] Class-private names. Names in this category, when used within the ! context of a class definition, are re-written to use a mangled form to help avoid name clashes between ``private'' attributes of base and derived classes. From loewis at users.sourceforge.net Wed Jun 2 08:54:35 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 08:54:39 2004 Subject: [Python-checkins] python/dist/src/Doc/ref ref5.tex,1.80,1.81 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17127 Modified Files: ref5.tex Log Message: Move grammar rule for lambda_form into section on lambdas. Fixes #964525. Index: ref5.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref5.tex,v retrieving revision 1.80 retrieving revision 1.81 diff -C2 -d -r1.80 -r1.81 *** ref5.tex 23 Apr 2004 17:11:47 -0000 1.80 --- ref5.tex 2 Jun 2004 12:54:33 -0000 1.81 *************** *** 968,973 **** \production{not_test} {\token{comparison} | "not" \token{not_test}} - \production{lambda_form} - {"lambda" [\token{parameter_list}]: \token{expression}} \end{productionlist} --- 968,971 ---- *************** *** 1007,1010 **** --- 1005,1013 ---- \indexii{anonymous}{function} + \begin{productionlist} + \production{lambda_form} + {"lambda" [\token{parameter_list}]: \token{expression}} + \end{productionlist} + Lambda forms (lambda expressions) have the same syntactic position as expressions. They are a shorthand to create anonymous functions; the From loewis at users.sourceforge.net Wed Jun 2 09:00:02 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 09:00:06 2004 Subject: [Python-checkins] python/dist/src/Doc/ref ref7.tex,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17951 Modified Files: ref7.tex Log Message: The expression list in inheritance is not optional. Fixes #960448. Will backport to 2.3. Index: ref7.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref7.tex,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** ref7.tex 24 Sep 2003 04:11:47 -0000 1.37 --- ref7.tex 2 Jun 2004 12:59:59 -0000 1.38 *************** *** 413,417 **** \token{suite}} \production{inheritance} ! {"(" [\token{expression_list}] ")"} \production{classname} {\token{identifier}} --- 413,417 ---- \token{suite}} \production{inheritance} ! {"(" \token{expression_list} ")"} \production{classname} {\token{identifier}} From loewis at users.sourceforge.net Wed Jun 2 09:00:35 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 2 09:00:42 2004 Subject: [Python-checkins] python/dist/src/Doc/ref ref7.tex, 1.35.16.1, 1.35.16.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18341 Modified Files: Tag: release23-maint ref7.tex Log Message: The expression list in inheritance is not optional. Fixes #960448. Index: ref7.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref7.tex,v retrieving revision 1.35.16.1 retrieving revision 1.35.16.2 diff -C2 -d -r1.35.16.1 -r1.35.16.2 *** ref7.tex 11 Aug 2003 23:57:01 -0000 1.35.16.1 --- ref7.tex 2 Jun 2004 13:00:32 -0000 1.35.16.2 *************** *** 413,417 **** \token{suite}} \production{inheritance} ! {"(" [\token{expression_list}] ")"} \production{classname} {\token{identifier}} --- 413,417 ---- \token{suite}} \production{inheritance} ! {"(" \token{expression_list} ")"} \production{classname} {\token{identifier}} From theller at users.sourceforge.net Wed Jun 2 09:21:44 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed Jun 2 09:21:47 2004 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt,1.57,1.58 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22747 Modified Files: BUILDno.txt Log Message: Record Python 2.3.4 (final) build number. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** BUILDno.txt 12 May 2004 20:12:10 -0000 1.57 --- BUILDno.txt 2 Jun 2004 13:21:41 -0000 1.58 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 53 2.3.4 (final) + 27-May-2004 52 2.3.4c1 13-May-2004 From jackjansen at users.sourceforge.net Wed Jun 2 09:42:49 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Jun 2 09:42:54 2004 Subject: [Python-checkins] python/dist/src/Mac/Modules macosmodule.c, 1.66, 1.66.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27029/Mac/Modules Modified Files: Tag: release23-maint macosmodule.c Log Message: CGMainDisplayID() doesn't exist on 10.1, so don't try to call it when building for that platform. Index: macosmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macosmodule.c,v retrieving revision 1.66 retrieving revision 1.66.12.1 diff -C2 -d -r1.66 -r1.66.12.1 *** macosmodule.c 19 Mar 2003 22:51:42 -0000 1.66 --- macosmodule.c 2 Jun 2004 13:42:47 -0000 1.66.12.1 *************** *** 546,552 **** --- 546,559 ---- ** no need for us to cache. */ + #ifdef kCGNullDirectDisplay + /* On 10.1 CGMainDisplayID() isn't available, and + ** kCGNullDirectDisplay isn't defined. + */ if (CGMainDisplayID() == 0) { rv = Py_False; } else { + #else + { + #endif if (GetCurrentProcess(&psn) < 0 || SetFrontProcess(&psn) < 0) { From jackjansen at users.sourceforge.net Wed Jun 2 09:44:08 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Jun 2 09:44:12 2004 Subject: [Python-checkins] python/dist/src/Mac/Modules macosmodule.c, 1.70, 1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27347 Modified Files: macosmodule.c Log Message: CGMainDisplayID() doesn't exist on 10.1, so don't try to call it when building for that platform. Index: macosmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macosmodule.c,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** macosmodule.c 20 Nov 2003 13:30:55 -0000 1.70 --- macosmodule.c 2 Jun 2004 13:44:05 -0000 1.71 *************** *** 440,446 **** --- 440,453 ---- ** no need for us to cache. */ + #ifdef kCGNullDirectDisplay + /* On 10.1 CGMainDisplayID() isn't available, and + ** kCGNullDirectDisplay isn't defined. + */ if (CGMainDisplayID() == 0) { rv = Py_False; } else { + #else + { + #endif if (GetCurrentProcess(&psn) < 0 || SetFrontProcess(&psn) < 0) { From anthonybaxter at users.sourceforge.net Wed Jun 2 10:48:20 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Wed Jun 2 10:48:23 2004 Subject: [Python-checkins] python/nondist/peps pep-0004.txt, 1.10, 1.11 pep-0320.txt, 1.12, 1.13 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7496 Modified Files: pep-0004.txt pep-0320.txt Log Message: un-deprecate audioop, as it's now being used (as discussed at pycon). Note ast compiler status. Index: pep-0004.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0004.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pep-0004.txt 19 Nov 2003 17:12:46 -0000 1.10 --- pep-0004.txt 2 Jun 2004 14:48:11 -0000 1.11 *************** *** 86,95 **** Documentation: TBD - Module name: audioop - Rationale: The module is not actively being used, no mention - of it was found on deja.com on Oct-1-2000. - Date: 1-Oct-2000 - Documentation: TBD - Module name: rgbimgmodule Rationale: In a 2001-04-24 c.l.py post, Jason Petrone mentions --- 86,89 ---- Index: pep-0320.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0320.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pep-0320.txt 26 May 2004 00:11:02 -0000 1.12 --- pep-0320.txt 2 Jun 2004 14:48:16 -0000 1.13 *************** *** 65,69 **** Deprecate and/or remove the modules listed in PEP 4 (posixfile, ! gopherlib, audioop, pre, others) Remove support for platforms as described in PEP 11. --- 65,69 ---- Deprecate and/or remove the modules listed in PEP 4 (posixfile, ! gopherlib, pre, others) Remove support for platforms as described in PEP 11. *************** *** 87,90 **** --- 87,92 ---- AST-based compiler: if this branch can land in the trunk by early May, it can go in. Otherwise it can wait for a future release. + This will not be in 2.4, but will land on the trunk some time after + 2.4 final is out, for inclusion in 2.5. From akuchling at users.sourceforge.net Wed Jun 2 11:34:02 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Jun 2 11:34:06 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew21.tex, 1.32, 1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18775 Modified Files: whatsnew21.tex Log Message: Remove old reminder Index: whatsnew21.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew21.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** whatsnew21.tex 2 Jan 2004 06:57:50 -0000 1.32 --- whatsnew21.tex 2 Jun 2004 15:33:59 -0000 1.33 *************** *** 605,610 **** the Distutils SIG at \url{http://www.python.org/sigs/distutils-sig/}. - % XXX update when I actually release 1.0.2 - \begin{seealso} --- 605,608 ---- From akuchling at users.sourceforge.net Wed Jun 2 11:37:06 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Jun 2 11:37:10 2004 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.262,1.263 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19737 Modified Files: ACKS Log Message: Add a name (old change sitting in my tree) Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.262 retrieving revision 1.263 diff -C2 -d -r1.262 -r1.263 *** ACKS 19 May 2004 08:20:10 -0000 1.262 --- ACKS 2 Jun 2004 15:37:04 -0000 1.263 *************** *** 280,283 **** --- 280,284 ---- David Jacobs Kevin Jacobs + Kjetil Jacobsen Geert Jansen Jack Jansen From perky at users.sourceforge.net Wed Jun 2 12:49:19 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed Jun 2 12:49:28 2004 Subject: [Python-checkins] python/dist/src/Modules unicodedata_db.h, 1.9, 1.10 unicodename_db.h, 1.6, 1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32555/Modules Modified Files: unicodedata_db.h unicodename_db.h Log Message: - SF #962502: Add two more methods for unicode type; width() and iswide() for east asian width manipulation. (Inspired by David Goodger, Reviewed by Martin v. Loewis) - Move _PyUnicode_TypeRecord.flags to the end of the struct so that no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis) Index: unicodedata_db.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodedata_db.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** unicodedata_db.h 25 Nov 2002 09:13:35 -0000 1.9 --- unicodedata_db.h 2 Jun 2004 16:49:12 -0000 1.10 *************** *** 1,3 **** ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.2 */ #define UNIDATA_VERSION "3.2.0" --- 1,3 ---- ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.3 */ #define UNIDATA_VERSION "3.2.0" Index: unicodename_db.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/unicodename_db.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** unicodename_db.h 25 Nov 2002 09:13:36 -0000 1.6 --- unicodename_db.h 2 Jun 2004 16:49:13 -0000 1.7 *************** *** 1,3 **** ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.2 */ #define NAME_MAXLEN 256 --- 1,3 ---- ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.3 */ #define NAME_MAXLEN 256 From perky at users.sourceforge.net Wed Jun 2 12:49:19 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed Jun 2 12:49:30 2004 Subject: [Python-checkins] python/dist/src/Tools/unicode makeunicodedata.py, 1.17, 1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/unicode In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32555/Tools/unicode Modified Files: makeunicodedata.py Log Message: - SF #962502: Add two more methods for unicode type; width() and iswide() for east asian width manipulation. (Inspired by David Goodger, Reviewed by Martin v. Loewis) - Move _PyUnicode_TypeRecord.flags to the end of the struct so that no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis) Index: makeunicodedata.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/unicode/makeunicodedata.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** makeunicodedata.py 25 Nov 2002 09:13:37 -0000 1.17 --- makeunicodedata.py 2 Jun 2004 16:49:17 -0000 1.18 *************** *** 19,22 **** --- 19,23 ---- # 2002-11-24 mvl expand all ranges, sort names version-independently # 2002-11-25 mvl add UNIDATA_VERSION + # 2004-05-29 perky add east asian width information # # written by Fredrik Lundh (fredrik@pythonware.com) *************** *** 26,30 **** SCRIPT = sys.argv[0] ! VERSION = "2.2" # The Unicode Database --- 27,31 ---- SCRIPT = sys.argv[0] ! VERSION = "2.3" # The Unicode Database *************** *** 32,35 **** --- 33,37 ---- UNICODE_DATA = "UnicodeData.txt" COMPOSITION_EXCLUSIONS = "CompositionExclusions.txt" + EASTASIAN_WIDTH = "EastAsianWidth.txt" CATEGORY_NAMES = [ "Cn", "Lu", "Ll", "Lt", "Mn", "Mc", "Me", "Nd", *************** *** 51,54 **** --- 53,57 ---- TITLE_MASK = 0x40 UPPER_MASK = 0x80 + WIDE_MASK = 0x100 def maketables(trace=0): *************** *** 56,60 **** print "--- Reading", UNICODE_DATA, "..." ! unicode = UnicodeData(UNICODE_DATA, COMPOSITION_EXCLUSIONS) print len(filter(None, unicode.table)), "characters" --- 59,64 ---- print "--- Reading", UNICODE_DATA, "..." ! unicode = UnicodeData(UNICODE_DATA, COMPOSITION_EXCLUSIONS, ! EASTASIAN_WIDTH) print len(filter(None, unicode.table)), "characters" *************** *** 331,336 **** flags |= DIGIT_MASK digit = int(record[7]) item = ( ! flags, upper, lower, title, decimal, digit ) # add entry to index and item tables --- 335,342 ---- flags |= DIGIT_MASK digit = int(record[7]) + if record[15] in ('W', 'F'): # Wide or Full width + flags |= WIDE_MASK item = ( ! upper, lower, title, decimal, digit, flags ) # add entry to index and item tables *************** *** 539,543 **** class UnicodeData: ! def __init__(self, filename, exclusions, expand=1): file = open(filename) table = [None] * 0x110000 --- 545,549 ---- class UnicodeData: ! def __init__(self, filename, exclusions, eastasianwidth, expand=1): file = open(filename) table = [None] * 0x110000 *************** *** 582,585 **** --- 588,610 ---- self.exclusions[char] = 1 + widths = [None] * 0x110000 + for s in open(eastasianwidth): + s = s.strip() + if not s: + continue + if s[0] == '#': + continue + s = s.split()[0].split(';') + if '..' in s[0]: + first, last = [int(c, 16) for c in s[0].split('..')] + chars = range(first, last+1) + else: + chars = [int(s[0], 16)] + for char in chars: + widths[char] = s[1] + for i in range(0, 0x110000): + if table[i] is not None: + table[i].append(widths[i]) + def uselatin1(self): # restrict character range to ISO Latin 1 From perky at users.sourceforge.net Wed Jun 2 12:49:20 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed Jun 2 12:49:32 2004 Subject: [Python-checkins] python/dist/src/Objects unicodectype.c, 2.14, 2.15 unicodeobject.c, 2.211, 2.212 unicodetype_db.h, 1.7, 1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32555/Objects Modified Files: unicodectype.c unicodeobject.c unicodetype_db.h Log Message: - SF #962502: Add two more methods for unicode type; width() and iswide() for east asian width manipulation. (Inspired by David Goodger, Reviewed by Martin v. Loewis) - Move _PyUnicode_TypeRecord.flags to the end of the struct so that no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis) Index: unicodectype.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodectype.c,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** unicodectype.c 29 Dec 2003 01:36:01 -0000 2.14 --- unicodectype.c 2 Jun 2004 16:49:16 -0000 2.15 *************** *** 20,26 **** #define TITLE_MASK 0x40 #define UPPER_MASK 0x80 typedef struct { - const unsigned short flags; const Py_UNICODE upper; const Py_UNICODE lower; --- 20,26 ---- #define TITLE_MASK 0x40 #define UPPER_MASK 0x80 + #define WIDE_MASK 0x100 typedef struct { const Py_UNICODE upper; const Py_UNICODE lower; *************** *** 28,31 **** --- 28,32 ---- const unsigned char decimal; const unsigned char digit; + const unsigned short flags; } _PyUnicode_TypeRecord; *************** *** 323,326 **** --- 324,336 ---- } + /* Returns 1 for Unicode characters having Full or Wide width, 0 otherwise */ + + int _PyUnicode_IsWide(Py_UNICODE ch) + { + const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); + + return (ctype->flags & WIDE_MASK) != 0; + } + #ifndef WANT_WCTYPE_FUNCTIONS Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.211 retrieving revision 2.212 diff -C2 -d -r2.211 -r2.212 *** unicodeobject.c 6 Apr 2004 07:24:51 -0000 2.211 --- unicodeobject.c 2 Jun 2004 16:49:16 -0000 2.212 *************** *** 656,659 **** --- 656,680 ---- } + int PyUnicode_GetWidth(PyObject *unicode) + { + const Py_UNICODE *p, *e; + int width; + + if (!PyUnicode_Check(unicode)) { + PyErr_BadArgument(); + return -1; + } + + p = PyUnicode_AS_UNICODE(unicode); + e = p + PyUnicode_GET_SIZE(unicode); + for (width = 0; p < e; p++) + if (Py_UNICODE_ISWIDE(*p)) + width += 2; + else + width++; + + return width; + } + const char *PyUnicode_GetDefaultEncoding(void) { *************** *** 5317,5320 **** --- 5338,5370 ---- } + PyDoc_STRVAR(iswide__doc__, + "S.iswide() -> bool\n\ + \n\ + Return True if all characters in S are wide width\n\ + and there is at least one character in S, False otherwise."); + + static PyObject* + unicode_iswide(PyUnicodeObject *self) + { + register const Py_UNICODE *p = PyUnicode_AS_UNICODE(self); + register const Py_UNICODE *e; + + /* Shortcut for single character strings */ + if (PyUnicode_GET_SIZE(self) == 1 && + Py_UNICODE_ISWIDE(*p)) + Py_RETURN_TRUE; + + /* Special case for empty strings */ + if (PyString_GET_SIZE(self) == 0) + Py_RETURN_FALSE; + + e = p + PyUnicode_GET_SIZE(self); + for (; p < e; p++) { + if (!Py_UNICODE_ISWIDE(*p)) + Py_RETURN_FALSE; + } + Py_RETURN_TRUE; + } + PyDoc_STRVAR(join__doc__, "S.join(sequence) -> unicode\n\ *************** *** 5336,5340 **** PyDoc_STRVAR(ljust__doc__, ! "S.ljust(width[, fillchar]) -> unicode\n\ \n\ Return S left justified in a Unicode string of length width. Padding is\n\ --- 5386,5390 ---- PyDoc_STRVAR(ljust__doc__, ! "S.ljust(width[, fillchar]) -> int\n\ \n\ Return S left justified in a Unicode string of length width. Padding is\n\ *************** *** 5928,5931 **** --- 5978,5996 ---- } + PyDoc_STRVAR(width__doc__, + "S.width() -> unicode\n\ + \n\ + Return a fixed-width representation length of S."); + + static PyObject* + unicode_width(PyObject *self) + { + int width = PyUnicode_GetWidth(self); + if (width == -1) + return NULL; + else + return PyInt_FromLong((long)width); + } + PyDoc_STRVAR(zfill__doc__, "S.zfill(width) -> unicode\n\ *************** *** 6091,6094 **** --- 6156,6161 ---- {"isalpha", (PyCFunction) unicode_isalpha, METH_NOARGS, isalpha__doc__}, {"isalnum", (PyCFunction) unicode_isalnum, METH_NOARGS, isalnum__doc__}, + {"iswide", (PyCFunction) unicode_iswide, METH_NOARGS, iswide__doc__}, + {"width", (PyCFunction) unicode_width, METH_NOARGS, width__doc__}, {"zfill", (PyCFunction) unicode_zfill, METH_VARARGS, zfill__doc__}, #if 0 Index: unicodetype_db.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodetype_db.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** unicodetype_db.h 25 Nov 2002 09:13:36 -0000 1.7 --- unicodetype_db.h 2 Jun 2004 16:49:16 -0000 1.8 *************** *** 1,3 **** ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.2 */ /* a list of unique character type descriptors */ --- 1,3 ---- ! /* this file was generated by Tools/unicode/makeunicodedata.py 2.3 */ /* a list of unique character type descriptors */ *************** *** 5,131 **** {0, 0, 0, 0, 0, 0}, [...1225 lines suppressed...] 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ! 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, *************** *** 1086,1090 **** 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 1, 0, 0, }; --- 1147,1151 ---- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ! 1, 1, 1, 1, 1, 0, 0, }; From perky at users.sourceforge.net Wed Jun 2 12:49:40 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed Jun 2 12:49:45 2004 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32555/Doc/api Modified Files: concrete.tex Log Message: - SF #962502: Add two more methods for unicode type; width() and iswide() for east asian width manipulation. (Inspired by David Goodger, Reviewed by Martin v. Loewis) - Move _PyUnicode_TypeRecord.flags to the end of the struct so that no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis) Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** concrete.tex 2 Jun 2004 12:45:27 -0000 1.41 --- concrete.tex 2 Jun 2004 16:49:07 -0000 1.42 *************** *** 851,854 **** --- 851,859 ---- \end{cfuncdesc} + \begin{cfuncdesc}{int}{Py_UNICODE_ISWIDE}{Py_UNICODE ch} + Returns 1/0 depending on whether \var{ch} is a wide or full-width + character. + \end{cfuncdesc} + These APIs can be used for fast direct character conversions: *************** *** 909,912 **** --- 914,921 ---- \end{cfuncdesc} + \begin{cfuncdesc}{int}{PyUnicode_GetWidth}{PyObject *unicode} + Return the fixed-width representation length of the Unicode object. + \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyUnicode_FromEncodedObject}{PyObject *obj, const char *encoding, From perky at users.sourceforge.net Wed Jun 2 12:49:41 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed Jun 2 12:49:50 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.153, 1.154 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32555/Doc/lib Modified Files: libstdtypes.tex Log Message: - SF #962502: Add two more methods for unicode type; width() and iswide() for east asian width manipulation. (Inspired by David Goodger, Reviewed by Martin v. Loewis) - Move _PyUnicode_TypeRecord.flags to the end of the struct so that no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis) Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** libstdtypes.tex 12 May 2004 02:48:29 -0000 1.153 --- libstdtypes.tex 2 Jun 2004 16:49:08 -0000 1.154 *************** *** 643,646 **** --- 643,652 ---- \end{methoddesc} + \begin{methoddesc}[string]{iswide}{} + Return true if all characters in the string are wide or full width and + there is at least one wide or full width character, false otherwise. + This method is supported by unicode type only. + \end{methoddesc} + \begin{methoddesc}[string]{join}{seq} Return a string which is the concatenation of the strings in the *************** *** 775,778 **** --- 781,789 ---- \end{methoddesc} + \begin{methoddesc}[string]{width}{} + Return length of fixed-width representation of the string. This method + is supported by unicode type only. + \end{methoddesc} + \begin{methoddesc}[string]{zfill}{width} Return the numeric string left filled with zeros in a string From perky at users.sourceforge.net Wed Jun 2 12:49:41 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed Jun 2 12:49:54 2004 Subject: [Python-checkins] python/dist/src/Include unicodeobject.h, 2.42, 2.43 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32555/Include Modified Files: unicodeobject.h Log Message: - SF #962502: Add two more methods for unicode type; width() and iswide() for east asian width manipulation. (Inspired by David Goodger, Reviewed by Martin v. Loewis) - Move _PyUnicode_TypeRecord.flags to the end of the struct so that no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis) Index: unicodeobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v retrieving revision 2.42 retrieving revision 2.43 diff -C2 -d -r2.42 -r2.43 *** unicodeobject.h 15 Dec 2003 18:49:19 -0000 2.42 --- unicodeobject.h 2 Jun 2004 16:49:08 -0000 2.43 *************** *** 181,184 **** --- 181,185 ---- # define PyUnicode_GetMax PyUnicodeUCS2_GetMax # define PyUnicode_GetSize PyUnicodeUCS2_GetSize + # define PyUnicode_GetWidth PyUnicodeUCS2_GetWidth # define PyUnicode_Join PyUnicodeUCS2_Join # define PyUnicode_Replace PyUnicodeUCS2_Replace *************** *** 200,203 **** --- 201,205 ---- # define _PyUnicode_IsLowercase _PyUnicodeUCS2_IsLowercase # define _PyUnicode_IsNumeric _PyUnicodeUCS2_IsNumeric + # define _PyUnicode_IsWide _PyUnicodeUCS2_IsWide # define _PyUnicode_IsTitlecase _PyUnicodeUCS2_IsTitlecase # define _PyUnicode_IsUppercase _PyUnicodeUCS2_IsUppercase *************** *** 253,256 **** --- 255,259 ---- # define PyUnicode_GetMax PyUnicodeUCS4_GetMax # define PyUnicode_GetSize PyUnicodeUCS4_GetSize + # define PyUnicode_GetWidth PyUnicodeUCS4_GetWidth # define PyUnicode_Join PyUnicodeUCS4_Join # define PyUnicode_Replace PyUnicodeUCS4_Replace *************** *** 271,274 **** --- 274,278 ---- # define _PyUnicode_IsLowercase _PyUnicodeUCS4_IsLowercase # define _PyUnicode_IsNumeric _PyUnicodeUCS4_IsNumeric + # define _PyUnicode_IsWide _PyUnicodeUCS4_IsWide # define _PyUnicode_IsTitlecase _PyUnicodeUCS4_IsTitlecase # define _PyUnicode_IsUppercase _PyUnicodeUCS4_IsUppercase *************** *** 316,319 **** --- 320,325 ---- #define Py_UNICODE_ISALPHA(ch) iswalpha(ch) + #define Py_UNICODE_ISWIDE(ch) _PyUnicode_IsWide(ch) + #else *************** *** 339,342 **** --- 345,350 ---- #define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch) + #define Py_UNICODE_ISWIDE(ch) _PyUnicode_IsWide(ch) + #endif *************** *** 431,434 **** --- 439,448 ---- ); + /* Get the fixed-width representation length of the Unicode object */ + + PyAPI_FUNC(int) PyUnicode_GetWidth( + PyObject *unicode /* Unicode object */ + ); + /* Get the maximum ordinal for a Unicode character. */ PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); *************** *** 1152,1155 **** --- 1166,1173 ---- ); + PyAPI_FUNC(int) _PyUnicode_IsWide( + Py_UNICODE ch /* Unicode character */ + ); + #ifdef __cplusplus } From perky at users.sourceforge.net Wed Jun 2 12:49:42 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed Jun 2 12:49:57 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py, 1.87, 1.88 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32555/Lib/test Modified Files: test_unicode.py Log Message: - SF #962502: Add two more methods for unicode type; width() and iswide() for east asian width manipulation. (Inspired by David Goodger, Reviewed by Martin v. Loewis) - Move _PyUnicode_TypeRecord.flags to the end of the struct so that no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis) Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** test_unicode.py 5 Feb 2004 17:36:00 -0000 1.87 --- test_unicode.py 2 Jun 2004 16:49:09 -0000 1.88 *************** *** 292,295 **** --- 292,315 ---- self.assertRaises(TypeError, u"abc".isnumeric, 42) + def test_iswide(self): + self.checkequalnofix(False, u'', 'iswide') + self.checkequalnofix(False, u'\x1f', 'iswide') # Neutral + self.checkequalnofix(False, u'\x20', 'iswide') # Narrow + self.checkequalnofix(True, u'\u2329', 'iswide') # Wide + self.checkequalnofix(False, u'\uff64', 'iswide') # Half + self.checkequalnofix(True, u'\u3000', 'iswide') # Full + self.checkequalnofix(False, u'\u2460', 'iswide') # Ambiguous + self.checkequalnofix(True, u'\ud55c\uae00', 'iswide') + self.checkequalnofix(False, u'\ud55c\u2606\uae00', 'iswide') + + def test_wide(self): + self.assertEqual(u''.width(), 0) + self.assertEqual(u'abcd'.width(), 4) + self.assertEqual(u'\u0187\u01c9'.width(), 2) + self.assertEqual(u'\u2460\u2329'.width(), 3) + self.assertEqual(u'\u2329\u2460'.width(), 3) + self.assertEqual(u'\ud55c\uae00'.width(), 4) + self.assertEqual(u'\ud55c\u2606\uae00'.width(), 5) + def test_contains(self): # Testing Unicode contains method From perky at users.sourceforge.net Wed Jun 2 12:49:45 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed Jun 2 12:49:59 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.982,1.983 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32555/Misc Modified Files: NEWS Log Message: - SF #962502: Add two more methods for unicode type; width() and iswide() for east asian width manipulation. (Inspired by David Goodger, Reviewed by Martin v. Loewis) - Move _PyUnicode_TypeRecord.flags to the end of the struct so that no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.982 retrieving revision 1.983 diff -C2 -d -r1.982 -r1.983 *** NEWS 2 Jun 2004 09:57:55 -0000 1.982 --- NEWS 2 Jun 2004 16:49:09 -0000 1.983 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - Unicode type got two new methods; iswide() and width(). They + manipulate east asian width information as of Unicode TR11. + - Improved the tuple hashing algorithm to give fewer collisions in common cases. Fixes bug #942952. From perky at users.sourceforge.net Wed Jun 2 12:52:52 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed Jun 2 12:52:55 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.983,1.984 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1595/Misc Modified Files: NEWS Log Message: Fix grammar hopefully. :) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.983 retrieving revision 1.984 diff -C2 -d -r1.983 -r1.984 *** NEWS 2 Jun 2004 16:49:09 -0000 1.983 --- NEWS 2 Jun 2004 16:52:49 -0000 1.984 *************** *** 13,18 **** ----------------- ! - Unicode type got two new methods; iswide() and width(). They ! manipulate east asian width information as of Unicode TR11. - Improved the tuple hashing algorithm to give fewer collisions in --- 13,18 ---- ----------------- ! - Unicode type got two new methods now; iswide() and width(). They ! manipulate east asian width information from Unicode TR11. - Improved the tuple hashing algorithm to give fewer collisions in From akuchling at users.sourceforge.net Wed Jun 2 13:40:16 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Jun 2 13:40:20 2004 Subject: [Python-checkins] python/dist/src/Lib pre.py,1.16,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8765 Removed Files: pre.py Log Message: Remove pre module --- pre.py DELETED --- From akuchling at users.sourceforge.net Wed Jun 2 13:40:17 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Jun 2 13:40:21 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_sundry.py, 1.13, 1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8765/test Modified Files: test_sundry.py Log Message: Remove pre module Index: test_sundry.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sundry.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_sundry.py 13 Feb 2003 18:36:22 -0000 1.13 --- test_sundry.py 2 Jun 2004 17:40:14 -0000 1.14 *************** *** 6,11 **** warnings.filterwarnings('ignore', r".*statcache module", DeprecationWarning, 'statcache$') - warnings.filterwarnings('ignore', r".*'re' module", - DeprecationWarning, 'pre$') from test.test_support import verbose --- 6,9 ---- *************** *** 65,69 **** #import poplib import posixfile - import pre import profile import pstats --- 63,66 ---- From akuchling at users.sourceforge.net Wed Jun 2 13:40:48 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Jun 2 13:40:51 2004 Subject: [Python-checkins] python/dist/src/Lib rexec.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8839 Modified Files: rexec.py Log Message: Remove reference to pcre module Index: rexec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/rexec.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** rexec.py 12 Feb 2004 17:35:07 -0000 1.49 --- rexec.py 2 Jun 2004 17:40:43 -0000 1.50 *************** *** 137,141 **** 'cmath', 'errno', 'imageop', 'marshal', 'math', 'md5', 'operator', ! 'parser', 'regex', 'pcre', 'rotor', 'select', 'sha', '_sre', 'strop', 'struct', 'time', 'xreadlines', '_weakref') --- 137,141 ---- 'cmath', 'errno', 'imageop', 'marshal', 'math', 'md5', 'operator', ! 'parser', 'regex', 'rotor', 'select', 'sha', '_sre', 'strop', 'struct', 'time', 'xreadlines', '_weakref') From akuchling at users.sourceforge.net Wed Jun 2 13:42:58 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Jun 2 13:43:04 2004 Subject: [Python-checkins] python/dist/src setup.py,1.186,1.187 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9216 Modified Files: setup.py Log Message: Don't build the pcre module any more Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.186 retrieving revision 1.187 diff -C2 -d -r1.186 -r1.187 *** setup.py 19 Apr 2004 19:06:19 -0000 1.186 --- setup.py 2 Jun 2004 17:42:55 -0000 1.187 *************** *** 297,301 **** # Some modules that are normally always on: exts.append( Extension('regex', ['regexmodule.c', 'regexpr.c']) ) - exts.append( Extension('pcre', ['pcremodule.c', 'pypcre.c']) ) exts.append( Extension('_hotshot', ['_hotshot.c']) ) --- 297,300 ---- From akuchling at users.sourceforge.net Wed Jun 2 13:42:59 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Jun 2 13:43:06 2004 Subject: [Python-checkins] python/dist/src/Misc BeOS-setup.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9216/Misc Modified Files: BeOS-setup.py Log Message: Don't build the pcre module any more Index: BeOS-setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/BeOS-setup.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BeOS-setup.py 17 Jan 2004 14:19:43 -0000 1.4 --- BeOS-setup.py 2 Jun 2004 17:42:56 -0000 1.5 *************** *** 178,182 **** # Some modules that are normally always on: exts.append( Extension('regex', ['regexmodule.c', 'regexpr.c']) ) - exts.append( Extension('pcre', ['pcremodule.c', 'pypcre.c']) ) exts.append( Extension('_weakref', ['_weakref.c']) ) --- 178,181 ---- From akuchling at users.sourceforge.net Wed Jun 2 13:44:38 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Jun 2 13:47:08 2004 Subject: [Python-checkins] python/dist/src/Modules pcre-int.h, 2.5, NONE pcre.h, 2.8, NONE pcremodule.c, 2.33, NONE pypcre.c, 2.26, NONE Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9521 Removed Files: pcre-int.h pcre.h pcremodule.c pypcre.c Log Message: Remove pcre module --- pcre-int.h DELETED --- --- pcre.h DELETED --- --- pcremodule.c DELETED --- --- pypcre.c DELETED --- From akuchling at users.sourceforge.net Wed Jun 2 13:54:00 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed Jun 2 14:02:42 2004 Subject: [Python-checkins] python/dist/src/RISCOS Makefile,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11338 Modified Files: Makefile Log Message: Remove reference to pcre module Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile 10 May 2003 07:36:56 -0000 1.6 --- Makefile 2 Jun 2004 17:53:57 -0000 1.7 *************** *** 75,79 **** @.^.Lib.operator/pyd\ @.^.Lib.parser/pyd\ - @.^.Lib.pcre/pyd\ @.^.Lib.regex/pyd\ @.^.Lib.rgbimg/pyd\ --- 75,78 ---- *************** *** 288,295 **** $(MAKEDLK) -d @.^.Lib.parser/pyd -s s.linktab -o @.^.Modules.o.parsermodule -e initparser - @.^.Lib.pcre/pyd: @.^.Modules.o.pcremodule @.^.Modules.o.pypcre s.linktab - $(LINK) -aof -o @.^.Modules.o.pcrelink @.^.Modules.o.pcremodule @.^.Modules.o.pypcre - $(MAKEDLK) -d @.^.Lib.pcre/pyd -s s.linktab -o @.^.Modules.o.pcrelink -e initpcre - @.^.Lib.regex/pyd: @.^.Modules.o.regexmodule @.^.Modules.o.regexpr s.linktab $(LINK) -aof -o @.^.Modules.o.regexlink @.^.Modules.o.regexmodule @.^.Modules.o.regexpr --- 287,290 ---- From doerwalter at users.sourceforge.net Wed Jun 2 14:42:28 2004 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed Jun 2 14:42:34 2004 Subject: [Python-checkins] python/dist/src/Lib/test mapping_tests.py, 1.1, 1.2 test_os.py, 1.22, 1.23 test_shelve.py, 1.7, 1.8 test_userdict.py, 1.19, 1.20 test_weakref.py, 1.39, 1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22081/Lib/test Modified Files: mapping_tests.py test_os.py test_shelve.py test_userdict.py test_weakref.py Log Message: Rename class attribute containing the class to be tested, so the name is the same as for the string and sequence tests. Index: mapping_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/mapping_tests.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mapping_tests.py 31 May 2004 16:29:04 -0000 1.1 --- mapping_tests.py 2 Jun 2004 18:42:23 -0000 1.2 *************** *** 10,14 **** # Functions that can be useful to override to adapt to dictionary # semantics ! _tested_class = None # which class is being tested (overwrite in subclasses) def _reference(self): --- 10,14 ---- # Functions that can be useful to override to adapt to dictionary # semantics ! type2test = None # which class is being tested (overwrite in subclasses) def _reference(self): *************** *** 18,22 **** def _empty_mapping(self): """Return an empty mapping object""" ! return self._tested_class() def _full_mapping(self, data): """Return a mapping object with the value contained in data --- 18,22 ---- def _empty_mapping(self): """Return an empty mapping object""" ! return self.type2test() def _full_mapping(self, data): """Return a mapping object with the value contained in data *************** *** 304,308 **** BasicTestMappingProtocol.test_constructor(self) self.assert_(self._empty_mapping() is not self._empty_mapping()) ! self.assertEqual(self._tested_class(x=1, y=2), {"x": 1, "y": 2}) def test_bool(self): --- 304,308 ---- BasicTestMappingProtocol.test_constructor(self) self.assert_(self._empty_mapping() is not self._empty_mapping()) ! self.assertEqual(self.type2test(x=1, y=2), {"x": 1, "y": 2}) def test_bool(self): *************** *** 428,432 **** def test_fromkeys(self): ! self.assertEqual(self._tested_class.fromkeys('abc'), {'a':None, 'b':None, 'c':None}) d = self._empty_mapping() self.assert_(not(d.fromkeys('abc') is d)) --- 428,432 ---- def test_fromkeys(self): ! self.assertEqual(self.type2test.fromkeys('abc'), {'a':None, 'b':None, 'c':None}) d = self._empty_mapping() self.assert_(not(d.fromkeys('abc') is d)) *************** *** 438,442 **** self.assertEqual(d.fromkeys(g()), {1:None}) self.assertRaises(TypeError, {}.fromkeys, 3) ! class dictlike(self._tested_class): pass self.assertEqual(dictlike.fromkeys('a'), {'a':None}) self.assertEqual(dictlike().fromkeys('a'), {'a':None}) --- 438,442 ---- self.assertEqual(d.fromkeys(g()), {1:None}) self.assertRaises(TypeError, {}.fromkeys, 3) ! class dictlike(self.type2test): pass self.assertEqual(dictlike.fromkeys('a'), {'a':None}) self.assertEqual(dictlike().fromkeys('a'), {'a':None}) *************** *** 445,449 **** # FIXME: the following won't work with UserDict, because it's an old style class # self.assert_(type(dictlike.fromkeys('a')) is dictlike) ! class mydict(self._tested_class): def __new__(cls): return UserDict.UserDict() --- 445,449 ---- # FIXME: the following won't work with UserDict, because it's an old style class # self.assert_(type(dictlike.fromkeys('a')) is dictlike) ! class mydict(self.type2test): def __new__(cls): return UserDict.UserDict() *************** *** 456,460 **** class Exc(Exception): pass ! class baddict1(self._tested_class): def __init__(self): raise Exc() --- 456,460 ---- class Exc(Exception): pass ! class baddict1(self.type2test): def __init__(self): raise Exc() *************** *** 468,474 **** raise Exc() ! self.assertRaises(Exc, self._tested_class.fromkeys, BadSeq()) ! class baddict2(self._tested_class): def __setitem__(self, key, value): raise Exc() --- 468,474 ---- raise Exc() ! self.assertRaises(Exc, self.type2test.fromkeys, BadSeq()) ! class baddict2(self.type2test): def __setitem__(self, key, value): raise Exc() *************** *** 579,583 **** def test_fromkeys(self): TestMappingProtocol.test_fromkeys(self) ! class mydict(self._tested_class): def __new__(cls): return UserDict.UserDict() --- 579,583 ---- def test_fromkeys(self): TestMappingProtocol.test_fromkeys(self) ! class mydict(self.type2test): def __new__(cls): return UserDict.UserDict() Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test_os.py 31 May 2004 16:29:04 -0000 1.22 --- test_os.py 2 Jun 2004 18:42:25 -0000 1.23 *************** *** 210,214 **** class EnvironTests(mapping_tests.BasicTestMappingProtocol): """check that os.environ object conform to mapping protocol""" ! _tested_class = None def _reference(self): return {"KEY1":"VALUE1", "KEY2":"VALUE2", "KEY3":"VALUE3"} --- 210,214 ---- class EnvironTests(mapping_tests.BasicTestMappingProtocol): """check that os.environ object conform to mapping protocol""" ! type2test = None def _reference(self): return {"KEY1":"VALUE1", "KEY2":"VALUE2", "KEY3":"VALUE3"} Index: test_shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shelve.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_shelve.py 31 May 2004 16:29:04 -0000 1.7 --- test_shelve.py 2 Jun 2004 18:42:25 -0000 1.8 *************** *** 83,87 **** self._db = [] mapping_tests.BasicTestMappingProtocol.__init__(self, *args, **kw) ! _tested_class = shelve.Shelf def _reference(self): return {"key1":"value1", "key2":2, "key3":(1,2,3)} --- 83,87 ---- self._db = [] mapping_tests.BasicTestMappingProtocol.__init__(self, *args, **kw) ! type2test = shelve.Shelf def _reference(self): return {"key1":"value1", "key2":2, "key3":(1,2,3)} Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_userdict.py 31 May 2004 16:29:04 -0000 1.19 --- test_userdict.py 2 Jun 2004 18:42:25 -0000 1.20 *************** *** 13,17 **** class UserDictTest(mapping_tests.TestHashMappingProtocol): ! _tested_class = UserDict.IterableUserDict def test_all(self): --- 13,17 ---- class UserDictTest(mapping_tests.TestHashMappingProtocol): ! type2test = UserDict.IterableUserDict def test_all(self): *************** *** 200,204 **** class UserDictMixinTest(mapping_tests.TestMappingProtocol): ! _tested_class = SeqDict def test_all(self): --- 200,204 ---- class UserDictMixinTest(mapping_tests.TestMappingProtocol): ! type2test = SeqDict def test_all(self): Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** test_weakref.py 31 May 2004 16:29:04 -0000 1.39 --- test_weakref.py 2 Jun 2004 18:42:25 -0000 1.40 *************** *** 918,922 **** """Check that WeakValueDictionary conforms to the mapping protocol""" __ref = {"key1":Object(1), "key2":Object(2), "key3":Object(3)} ! _tested_class = weakref.WeakValueDictionary def _reference(self): return self.__ref.copy() --- 918,922 ---- """Check that WeakValueDictionary conforms to the mapping protocol""" __ref = {"key1":Object(1), "key2":Object(2), "key3":Object(3)} ! type2test = weakref.WeakValueDictionary def _reference(self): return self.__ref.copy() *************** *** 925,929 **** """Check that WeakKeyDictionary conforms to the mapping protocol""" __ref = {Object("key1"):1, Object("key2"):2, Object("key3"):3} ! _tested_class = weakref.WeakKeyDictionary def _reference(self): return self.__ref.copy() --- 925,929 ---- """Check that WeakKeyDictionary conforms to the mapping protocol""" __ref = {Object("key1"):1, Object("key2"):2, Object("key3"):3} ! type2test = weakref.WeakKeyDictionary def _reference(self): return self.__ref.copy() From theller at users.sourceforge.net Wed Jun 2 14:58:38 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed Jun 2 14:58:44 2004 Subject: [Python-checkins] python/dist/src/PC config.c,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26504 Modified Files: config.c Log Message: Remove the pcre module. Index: config.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/config.c,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** config.c 19 Apr 2004 19:06:20 -0000 1.45 --- config.c 2 Jun 2004 18:58:35 -0000 1.46 *************** *** 34,38 **** extern void initcStringIO(void); extern void initcPickle(void); - extern void initpcre(void); #ifdef WIN32 extern void initmsvcrt(void); --- 34,37 ---- *************** *** 124,128 **** {"cStringIO", initcStringIO}, {"cPickle", initcPickle}, - {"pcre", initpcre}, #ifdef WIN32 {"msvcrt", initmsvcrt}, --- 123,126 ---- From theller at users.sourceforge.net Wed Jun 2 14:58:46 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed Jun 2 14:58:51 2004 Subject: [Python-checkins] python/dist/src/PC/VC6 pythoncore.dsp,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/PC/VC6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26557 Modified Files: pythoncore.dsp Log Message: Remove the pcre module. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/VC6/pythoncore.dsp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pythoncore.dsp 1 Jun 2004 16:29:57 -0000 1.9 --- pythoncore.dsp 2 Jun 2004 18:58:44 -0000 1.10 *************** *** 556,563 **** # Begin Source File - SOURCE=..\..\Modules\pcremodule.c - # End Source File - # Begin Source File - SOURCE=..\..\Modules\posixmodule.c # End Source File --- 556,559 ---- *************** *** 568,575 **** # Begin Source File - SOURCE=..\..\Modules\pypcre.c - # End Source File - # Begin Source File - SOURCE=..\..\Python\pystate.c # End Source File --- 564,567 ---- From theller at users.sourceforge.net Wed Jun 2 14:58:57 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed Jun 2 14:59:02 2004 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.vcproj, 1.8, 1.9 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26600 Modified Files: pythoncore.vcproj Log Message: Remove the pcre module. Index: pythoncore.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.vcproj,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pythoncore.vcproj 1 Jun 2004 17:21:13 -0000 1.8 --- pythoncore.vcproj 2 Jun 2004 18:58:55 -0000 1.9 *************** *** 1778,1800 **** - - - - - - - - - - - - - - - - Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9519/Mac/OSX Modified Files: Makefile Log Message: Do an actual test for xcodebuild, in stead of relying on the user to uncomment the relevant section. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** Makefile 27 Nov 2003 22:54:28 -0000 1.53 --- Makefile 2 Jun 2004 20:06:38 -0000 1.54 *************** *** 10,17 **** BUILDPYTHON=$(builddir)/python.exe DESTDIR= ! # For 10.2: ! #PBXBUILD=pbxbuild ! # For 10.3: PBXBUILD=xcodebuild # These are normally glimpsed from the previous set --- 10,19 ---- BUILDPYTHON=$(builddir)/python.exe DESTDIR= ! # Test whether to use xcodebuild (preferred) or pbxbuild: ! ifeq ($(shell ls /usr/bin/xcodebuild),/usr/bin/xcodebuild) PBXBUILD=xcodebuild + else + PBXBUILD=pbxbuild + endif # These are normally glimpsed from the previous set From jackjansen at users.sourceforge.net Wed Jun 2 16:07:44 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Jun 2 16:07:47 2004 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile, 1.50.4.2, 1.50.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10060/Mac/OSX Modified Files: Tag: release23-maint Makefile Log Message: Backport of 1.54: Do an actual test for xcodebuild, in stead of relying on the user to uncomment the relevant section. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.50.4.2 retrieving revision 1.50.4.3 diff -C2 -d -r1.50.4.2 -r1.50.4.3 *** Makefile 4 Nov 2003 22:45:16 -0000 1.50.4.2 --- Makefile 2 Jun 2004 20:07:42 -0000 1.50.4.3 *************** *** 11,18 **** DESTDIR= ! # For 10.2: ! #PBXBUILD=pbxbuild ! # For 10.3: PBXBUILD=xcodebuild # These are normally glimpsed from the previous set --- 11,20 ---- DESTDIR= ! # Test whether to use xcodebuild (preferred) or pbxbuild: ! ifeq ($(shell ls /usr/bin/xcodebuild),/usr/bin/xcodebuild) PBXBUILD=xcodebuild + else + PBXBUILD=pbxbuild + endif # These are normally glimpsed from the previous set From gward at users.sourceforge.net Wed Jun 2 21:51:30 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Wed Jun 2 21:51:36 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py, 1.22.8.2, 1.22.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11981 Modified Files: Tag: release23-maint test_textwrap.py Log Message: SF #965425: add WrapTestCase.test_punct_hyphens() to ensure that hyphenated words wrapped in punctuation, like "foo-bar" or [ding-dong], are split correctly. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.22.8.2 retrieving revision 1.22.8.3 diff -C2 -d -r1.22.8.2 -r1.22.8.3 *** test_textwrap.py 13 May 2004 01:45:33 -0000 1.22.8.2 --- test_textwrap.py 3 Jun 2004 01:51:27 -0000 1.22.8.3 *************** *** 1,4 **** # ! # Test script for the textwrap module. # # Original tests written by Greg Ward . --- 1,4 ---- # ! # Test suite for the textwrap module. # # Original tests written by Greg Ward . *************** *** 272,275 **** --- 272,292 ---- ["foo", " ", "--option-", "opt", " ", "bar"]) + def test_punct_hyphens(self): + # Oh bother, SF #965425 found another problem with hyphens -- + # hyphenated words in single quotes weren't handled correctly. + # In fact, the bug is that *any* punctuation around a hyphenated + # word was handled incorrectly, except for a leading "--", which + # was special-cased for Optik and Docutils. So test a variety + # of styles of punctuation around a hyphenated word. + # (Actually this is based on an Optik bug report, #813077). + self.check_split("the 'wibble-wobble' widget", + ['the', ' ', "'wibble-", "wobble'", ' ', 'widget']) + self.check_split('the "wibble-wobble" widget', + ['the', ' ', '"wibble-', 'wobble"', ' ', 'widget']) + self.check_split("the (wibble-wobble) widget", + ['the', ' ', "(wibble-", "wobble)", ' ', 'widget']) + self.check_split("the ['wibble-wobble'] widget", + ['the', ' ', "['wibble-", "wobble']", ' ', 'widget']) + def test_funky_parens (self): # Second part of SF bug #596434: long option strings inside From gward at users.sourceforge.net Wed Jun 2 21:53:16 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Wed Jun 2 21:53:19 2004 Subject: [Python-checkins] python/dist/src/Lib textwrap.py, 1.32.8.2, 1.32.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12181 Modified Files: Tag: release23-maint textwrap.py Log Message: SF #965425: fix wordsep_re so hyphenated words are handled correctly when preceded by any punctuation, not just a sequence of more hyphens. (That was a special case so Optik and Docutils could wrap long options like --foo-bar correctly; this change generalizes the special-case.) Comment fix. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.32.8.2 retrieving revision 1.32.8.3 diff -C2 -d -r1.32.8.2 -r1.32.8.3 *** textwrap.py 13 May 2004 01:48:15 -0000 1.32.8.2 --- textwrap.py 3 Jun 2004 01:53:13 -0000 1.32.8.3 *************** *** 80,88 **** # (after stripping out empty strings). wordsep_re = re.compile(r'(\s+|' # any whitespace ! r'-*\w{2,}-(?=\w{2,})|' # hyphenated words r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash ! # XXX will there be a locale-or-charset-aware version of ! # string.lowercase in 2.3? sentence_end_re = re.compile(r'[%s]' # lowercase letter r'[\.\!\?]' # sentence-ending punct. --- 80,88 ---- # (after stripping out empty strings). wordsep_re = re.compile(r'(\s+|' # any whitespace ! r'[^\s\w]*\w{2,}-(?=\w{2,})|' # hyphenated words r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash ! # XXX this is not locale- or charset-aware -- string.lowercase ! # is US-ASCII only (and therefore English-only) sentence_end_re = re.compile(r'[%s]' # lowercase letter r'[\.\!\?]' # sentence-ending punct. From gward at users.sourceforge.net Wed Jun 2 21:59:43 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Wed Jun 2 21:59:47 2004 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12903/Lib Modified Files: textwrap.py Log Message: SF #965425: fix so hyphenated words surrounded by punctuation are wrapped correctly. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** textwrap.py 13 May 2004 01:53:10 -0000 1.34 --- textwrap.py 3 Jun 2004 01:59:40 -0000 1.35 *************** *** 80,88 **** # (after stripping out empty strings). wordsep_re = re.compile(r'(\s+|' # any whitespace ! r'-*\w{2,}-(?=\w{2,})|' # hyphenated words r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash ! # XXX will there be a locale-or-charset-aware version of ! # string.lowercase in 2.3? sentence_end_re = re.compile(r'[%s]' # lowercase letter r'[\.\!\?]' # sentence-ending punct. --- 80,88 ---- # (after stripping out empty strings). wordsep_re = re.compile(r'(\s+|' # any whitespace ! r'[^\s\w]*\w{2,}-(?=\w{2,})|' # hyphenated words r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash ! # XXX this is not locale- or charset-aware -- string.lowercase ! # is US-ASCII only (and therefore English-only) sentence_end_re = re.compile(r'[%s]' # lowercase letter r'[\.\!\?]' # sentence-ending punct. From gward at users.sourceforge.net Wed Jun 2 21:59:43 2004 From: gward at users.sourceforge.net (gward@users.sourceforge.net) Date: Wed Jun 2 21:59:49 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py, 1.25, 1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12903/Lib/test Modified Files: test_textwrap.py Log Message: SF #965425: fix so hyphenated words surrounded by punctuation are wrapped correctly. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_textwrap.py 13 May 2004 01:53:08 -0000 1.25 --- test_textwrap.py 3 Jun 2004 01:59:41 -0000 1.26 *************** *** 1,4 **** # ! # Test script for the textwrap module. # # Original tests written by Greg Ward . --- 1,4 ---- # ! # Test suite for the textwrap module. # # Original tests written by Greg Ward . *************** *** 272,275 **** --- 272,292 ---- ["foo", " ", "--option-", "opt", " ", "bar"]) + def test_punct_hyphens(self): + # Oh bother, SF #965425 found another problem with hyphens -- + # hyphenated words in single quotes weren't handled correctly. + # In fact, the bug is that *any* punctuation around a hyphenated + # word was handled incorrectly, except for a leading "--", which + # was special-cased for Optik and Docutils. So test a variety + # of styles of punctuation around a hyphenated word. + # (Actually this is based on an Optik bug report, #813077). + self.check_split("the 'wibble-wobble' widget", + ['the', ' ', "'wibble-", "wobble'", ' ', 'widget']) + self.check_split('the "wibble-wobble" widget', + ['the', ' ', '"wibble-', 'wobble"', ' ', 'widget']) + self.check_split("the (wibble-wobble) widget", + ['the', ' ', "(wibble-", "wobble)", ' ', 'widget']) + self.check_split("the ['wibble-wobble'] widget", + ['the', ' ', "['wibble-", "wobble']", ' ', 'widget']) + def test_funky_parens (self): # Second part of SF bug #596434: long option strings inside From loewis at users.sourceforge.net Thu Jun 3 00:03:42 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Jun 3 00:03:46 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.984,1.985 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31650 Modified Files: NEWS Log Message: One more attempt to fix the grammar. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.984 retrieving revision 1.985 diff -C2 -d -r1.984 -r1.985 *** NEWS 2 Jun 2004 16:52:49 -0000 1.984 --- NEWS 3 Jun 2004 04:03:30 -0000 1.985 *************** *** 13,18 **** ----------------- ! - Unicode type got two new methods now; iswide() and width(). They ! manipulate east asian width information from Unicode TR11. - Improved the tuple hashing algorithm to give fewer collisions in --- 13,18 ---- ----------------- ! - Unicode objects received two new methods now; iswide() and width(). They ! query east asian width information according to Unicode TR11. - Improved the tuple hashing algorithm to give fewer collisions in From t-meyer at ihug.co.nz Thu Jun 3 00:19:48 2004 From: t-meyer at ihug.co.nz (Tony Meyer) Date: Thu Jun 3 00:21:09 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.984,1.985 In-Reply-To: <1ED4ECF91CDED24C8D012BCF2B034F1306967443@its-xchg4.massey.ac.nz> Message-ID: <1ED4ECF91CDED24C8D012BCF2B034F13064C026C@its-xchg4.massey.ac.nz> > One more attempt to fix the grammar. > ! - Unicode objects received two new methods now; iswide() > and width(). They > ! query east asian width information according to Unicode TR11. One more attempt to fix the fix . 1. "east asian" should be "East Asian". 2. The semi-colon after "now" should be a colon. 3. The "now" after "methods" should be removed. Given the content changes, I'd now suggest: "Unicode objects received two new methods: iswide() and width(). These query East Asian width information, as specified in Unicode TR11." (To me (and this might be a NZ thing or something) "according to" doesn't convey the quite same meaning as "as specified in", or "as described by", or words to that effect; hence the other change. It's not as important). =Tony Meyer From wrupfcgv at hotbox.ru Thu Jun 3 04:30:11 2004 From: wrupfcgv at hotbox.ru (Multiple O'Gazm 4 men ) Date: Thu Jun 3 03:36:30 2004 Subject: [Python-checkins] Rock hard Ready to go -Python-announce mouse Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040603/39f9cb91/attachment-0001.html From loewis at users.sourceforge.net Thu Jun 3 05:18:37 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Jun 3 05:18:43 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libasyncore.tex, 1.14, 1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16680/Doc/lib Modified Files: libasyncore.tex Log Message: Patch #957240: Add count parameter to asyncore.loop. Index: libasyncore.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasyncore.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libasyncore.tex 17 Sep 2002 15:19:12 -0000 1.14 --- libasyncore.tex 3 Jun 2004 09:18:34 -0000 1.15 *************** *** 45,62 **** \begin{funcdesc}{loop}{\optional{timeout\optional{, use_poll\optional{, ! map}}}} ! Enter a polling loop that only terminates after all open channels ! have been closed. All arguments are optional. The \var{timeout} ! argument sets the timeout parameter for the appropriate ! \function{select()} or \function{poll()} call, measured in seconds; ! the default is 30 seconds. The \var{use_poll} parameter, if true, ! indicates that \function{poll()} should be used in preference to ! \function{select()} (the default is \code{False}). The \var{map} parameter ! is a dictionary whose items are the channels to watch. As channels ! are closed they are deleted from their map. If \var{map} is ! omitted, a global map is used (this map is updated by the default ! class \method{__init__()} ! -- make sure you extend, rather than override, \method{__init__()} ! if you want to retain this behavior). Channels (instances of \class{asyncore.dispatcher}, \class{asynchat.async_chat} --- 45,62 ---- \begin{funcdesc}{loop}{\optional{timeout\optional{, use_poll\optional{, ! map\optional{,count}}}}} ! Enter a polling loop that terminates after count passes or all open ! channels have been closed. All arguments are optional. The \var(count) ! parameter defaults to infinity, resulting in the loop terminating only ! when all channels have been closed. The \var{timeout} argument sets the ! timeout parameter for the appropriate \function{select()} or ! \function{poll()} call, measured in seconds; the default is 30 seconds. ! The \var{use_poll} parameter, if true, indicates that \function{poll()} ! should be used in preference to \function{select()} (the default is ! \code{False}). The \var{map} parameter is a dictionary whose items are ! the channels to watch. As channels are closed they are deleted from their ! map. If \var{map} is omitted, a global map is used (this map is updated ! by the default class \method{__init__()} -- make sure you extend, rather ! than override, \method{__init__()} if you want to retain this behavior). Channels (instances of \class{asyncore.dispatcher}, \class{asynchat.async_chat} From loewis at users.sourceforge.net Thu Jun 3 05:18:37 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Jun 3 05:18:48 2004 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16680/Lib Modified Files: asyncore.py Log Message: Patch #957240: Add count parameter to asyncore.loop. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** asyncore.py 21 Mar 2004 20:03:18 -0000 1.50 --- asyncore.py 3 Jun 2004 09:18:34 -0000 1.51 *************** *** 158,162 **** poll3 = poll2 # Alias for backward compatibility ! def loop(timeout=30.0, use_poll=False, map=None): if map is None: map = socket_map --- 158,162 ---- poll3 = poll2 # Alias for backward compatibility ! def loop(timeout=30.0, use_poll=False, map=None, count=1e309): if map is None: map = socket_map *************** *** 167,172 **** poll_fun = poll ! while map: poll_fun(timeout, map) class dispatcher: --- 167,173 ---- poll_fun = poll ! while map and count >= 0: poll_fun(timeout, map) + count = count - 1 class dispatcher: From loewis at users.sourceforge.net Thu Jun 3 05:18:39 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Jun 3 05:18:54 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.985,1.986 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16680/Misc Modified Files: NEWS Log Message: Patch #957240: Add count parameter to asyncore.loop. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.985 retrieving revision 1.986 diff -C2 -d -r1.985 -r1.986 *** NEWS 3 Jun 2004 04:03:30 -0000 1.985 --- NEWS 3 Jun 2004 09:18:35 -0000 1.986 *************** *** 320,323 **** --- 320,325 ---- ------- + - asyncore.loop now has repeat count parameter that defaults to infinity. + - The distutils sdist command now ignores all .svn directories, in addition to CVS and RCS directories. .svn directories hold From loewis at users.sourceforge.net Thu Jun 3 05:24:44 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Jun 3 05:24:50 2004 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c, 1.290, 1.291 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17722 Modified Files: socketmodule.c Log Message: Patch #929192: Improvements to bluetooth support. Added setbdaddr and makebdaddr. Extended makesockaddr to understand Bluetooth addresses. Changed getsockaddr to expect the Bluetooth addresses as a string, not a six element tuple. Reformatted some of the Bluetooth code to be more consistent with PEP 7. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.290 retrieving revision 1.291 diff -C2 -d -r1.290 -r1.291 *** socketmodule.c 2 Jun 2004 12:35:29 -0000 1.290 --- socketmodule.c 3 Jun 2004 09:24:42 -0000 1.291 *************** *** 859,862 **** --- 859,907 ---- + #ifdef USE_BLUETOOTH + /* Convert a string representation of a Bluetooth address into a numeric + address. Returns the length (6), or raises an exception and returns -1 if + an error occurred. */ + + static int + setbdaddr(char *name, bdaddr_t *bdaddr) + { + unsigned int b0, b1, b2, b3, b4, b5; + char ch; + int n; + + n = sscanf(name, "%X:%X:%X:%X:%X:%X%c", + &b5, &b4, &b3, &b2, &b1, &b0, &ch); + if (n == 6 && (b0 | b1 | b2 | b3 | b4 | b5) < 256) { + bdaddr->b[0] = b0; + bdaddr->b[1] = b1; + bdaddr->b[2] = b2; + bdaddr->b[3] = b3; + bdaddr->b[4] = b4; + bdaddr->b[5] = b5; + return 6; + } else { + PyErr_SetString(socket_error, "bad bluetooth address"); + return -1; + } + } + + /* Create a string representation of the Bluetooth address. This is always a + string of the form 'XX:XX:XX:XX:XX:XX' where XX is a two digit hexadecimal + value (zero padded if necessary). */ + + static PyObject * + makebdaddr(bdaddr_t *bdaddr) + { + char buf[(6 * 2) + 5 + 1]; + + sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", + bdaddr->b[5], bdaddr->b[4], bdaddr->b[3], + bdaddr->b[2], bdaddr->b[1], bdaddr->b[0]); + return PyString_FromString(buf); + } + #endif + + /* Create an object representing the given socket address, suitable for passing it back to bind(), connect() etc. *************** *** 866,870 **** /*ARGSUSED*/ static PyObject * ! makesockaddr(int sockfd, struct sockaddr *addr, int addrlen) { if (addrlen == 0) { --- 911,915 ---- /*ARGSUSED*/ static PyObject * ! makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto) { if (addrlen == 0) { *************** *** 921,924 **** --- 966,1012 ---- #endif + #ifdef USE_BLUETOOTH + case AF_BLUETOOTH: + switch (proto) { + + case BTPROTO_L2CAP: + { + struct sockaddr_l2 *a = (struct sockaddr_l2 *) addr; + PyObject *addrobj = makebdaddr(&_BT_L2_MEMB(a, bdaddr)); + PyObject *ret = NULL; + if (addrobj) { + ret = Py_BuildValue("Oi", + addrobj, + _BT_L2_MEMB(a, psm)); + Py_DECREF(addrobj); + } + return ret; + } + + case BTPROTO_RFCOMM: + { + struct sockaddr_rc *a = (struct sockaddr_rc *) addr; + PyObject *addrobj = makebdaddr(&_BT_RC_MEMB(a, bdaddr)); + PyObject *ret = NULL; + if (addrobj) { + ret = Py_BuildValue("Oi", + addrobj, + _BT_RC_MEMB(a, channel)); + Py_DECREF(addrobj); + } + return ret; + } + + #if !defined(__FreeBSD__) + case BTPROTO_SCO: + { + struct sockaddr_sco *a = (struct sockaddr_sco *) addr; + return makebdaddr(&_BT_SCO_MEMB(a, bdaddr)); + } + #endif + + } + #endif + #ifdef HAVE_NETPACKET_PACKET_H case AF_PACKET: *************** *** 1055,1115 **** case AF_BLUETOOTH: { ! switch( s->sock_proto ) { ! case BTPROTO_L2CAP: ! { ! struct sockaddr_l2* addr = (struct sockaddr_l2*)_BT_SOCKADDR_MEMB(s, l2); ! bdaddr_t* bdaddr = &_BT_L2_MEMB(addr, bdaddr); ! ! _BT_L2_MEMB(addr, family) = AF_BLUETOOTH; ! if( !PyArg_ParseTuple(args, "(iiiiii)i", &bdaddr->b[0], &bdaddr->b[1], &bdaddr->b[2], &bdaddr->b[3], &bdaddr->b[4], &bdaddr->b[5], &_BT_L2_MEMB(addr, psm)) ) ! { ! PyErr_SetString(socket_error, "getsockaddrarg: wrong format"); ! return 0; ! } ! *addr_ret = (struct sockaddr *) addr; ! *len_ret = sizeof *addr; ! return 1; } ! case BTPROTO_RFCOMM: ! { ! struct sockaddr_rc* addr = (struct sockaddr_rc*)_BT_SOCKADDR_MEMB(s, rc); ! bdaddr_t* bdaddr = &_BT_RC_MEMB(addr, bdaddr); ! _BT_RC_MEMB(addr, family) = AF_BLUETOOTH; ! if( !PyArg_ParseTuple(args, "(iiiiii)i", &bdaddr->b[0], &bdaddr->b[1], &bdaddr->b[2], &bdaddr->b[3], &bdaddr->b[4], &bdaddr->b[5], &_BT_RC_MEMB(addr, channel)) ) ! { ! PyErr_SetString(socket_error, "getsockaddrarg: wrong format"); ! return 0; ! } ! *addr_ret = (struct sockaddr *) addr; ! *len_ret = sizeof *addr; ! return 1; } ! #if !defined(__FreeBSD__) ! case BTPROTO_SCO: ! { ! struct sockaddr_sco* addr = (struct sockaddr_sco*)_BT_SOCKADDR_MEMB(s, sco); ! bdaddr_t* bdaddr = &_BT_SCO_MEMB(addr, bdaddr); ! _BT_SCO_MEMB(addr, family) = AF_BLUETOOTH; ! if( !PyArg_ParseTuple(args, "iiiiii", &bdaddr->b[0], &bdaddr->b[1], &bdaddr->b[2], &bdaddr->b[3], &bdaddr->b[4], &bdaddr->b[5]) ) ! { ! PyErr_SetString(socket_error, "getsockaddrarg: wrong format"); ! return 0; ! } ! *addr_ret = (struct sockaddr *) addr; ! *len_ret = sizeof *addr; ! return 1; ! } ! #endif ! default: ! { ! PyErr_SetString(socket_error, "getsockaddrarg: unknown Bluetooth protocol"); return 0; } } } --- 1143,1209 ---- case AF_BLUETOOTH: { ! switch (s->sock_proto) { ! case BTPROTO_L2CAP: { ! struct sockaddr_l2 *addr = (struct sockaddr_l2 *) _BT_SOCKADDR_MEMB(s, l2); ! char *straddr; ! _BT_L2_MEMB(addr, family) = AF_BLUETOOTH; ! if (!PyArg_ParseTuple(args, "si", &straddr, ! &_BT_L2_MEMB(addr, psm))) { ! PyErr_SetString(socket_error, "getsockaddrarg: " ! "wrong format"); ! return 0; } ! if (setbdaddr(straddr, &_BT_L2_MEMB(addr, bdaddr)) < 0) ! return 0; ! *addr_ret = (struct sockaddr *) addr; ! *len_ret = sizeof *addr; ! return 1; ! } ! case BTPROTO_RFCOMM: ! { ! struct sockaddr_rc *addr = (struct sockaddr_rc *) _BT_SOCKADDR_MEMB(s, rc); ! char *straddr; ! _BT_RC_MEMB(addr, family) = AF_BLUETOOTH; ! if (!PyArg_ParseTuple(args, "si", &straddr, ! &_BT_RC_MEMB(addr, channel))) { ! PyErr_SetString(socket_error, "getsockaddrarg: " ! "wrong format"); ! return 0; } ! if (setbdaddr(straddr, &_BT_RC_MEMB(addr, bdaddr)) < 0) ! return 0; ! *addr_ret = (struct sockaddr *) addr; ! *len_ret = sizeof *addr; ! return 1; ! } ! #if !defined(__FreeBSD__) ! case BTPROTO_SCO: ! { ! struct sockaddr_sco *addr = (struct sockaddr_sco *) _BT_SOCKADDR_MEMB(s, sco); ! char *straddr; ! _BT_SCO_MEMB(addr, family) = AF_BLUETOOTH; ! straddr = PyString_AsString(args); ! if (straddr == NULL) { ! PyErr_SetString(socket_error, "getsockaddrarg: " ! "wrong format"); return 0; } + if (setbdaddr(straddr, &_BT_SCO_MEMB(addr, bdaddr)) < 0) + return 0; + + *addr_ret = (struct sockaddr *) addr; + *len_ret = sizeof *addr; + return 1; + } + #endif + default: + PyErr_SetString(socket_error, "getsockaddrarg: unknown Bluetooth protocol"); + return 0; } } *************** *** 1194,1219 **** switch(s->sock_proto) { ! case BTPROTO_L2CAP: ! { ! *len_ret = sizeof (struct sockaddr_l2); ! return 1; ! } ! case BTPROTO_RFCOMM: ! { ! *len_ret = sizeof (struct sockaddr_rc); ! return 1; ! } #if !defined(__FreeBSD__) ! case BTPROTO_SCO: ! { ! *len_ret = sizeof (struct sockaddr_sco); ! return 1; ! } #endif ! default: ! { ! PyErr_SetString(socket_error, "getsockaddrlen: unknown BT protocol"); ! return 0; ! } } } --- 1288,1308 ---- switch(s->sock_proto) { ! ! case BTPROTO_L2CAP: ! *len_ret = sizeof (struct sockaddr_l2); ! return 1; ! case BTPROTO_RFCOMM: ! *len_ret = sizeof (struct sockaddr_rc); ! return 1; #if !defined(__FreeBSD__) ! case BTPROTO_SCO: ! *len_ret = sizeof (struct sockaddr_sco); ! return 1; #endif ! default: ! PyErr_SetString(socket_error, "getsockaddrlen: " ! "unknown BT protocol"); ! return 0; ! } } *************** *** 1292,1296 **** } addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, ! addrlen); if (addr == NULL) goto finally; --- 1381,1385 ---- } addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, ! addrlen, s->sock_proto); if (addr == NULL) goto finally; *************** *** 1755,1759 **** if (res < 0) return s->errorhandler(); ! return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen); } --- 1844,1849 ---- if (res < 0) return s->errorhandler(); ! return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen, ! s->sock_proto); } *************** *** 1783,1787 **** if (res < 0) return s->errorhandler(); ! return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen); } --- 1873,1878 ---- if (res < 0) return s->errorhandler(); ! return makesockaddr(s->sock_fd, (struct sockaddr *) addrbuf, addrlen, ! s->sock_proto); } *************** *** 2038,2042 **** if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, ! addrlen))) goto finally; --- 2129,2133 ---- if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, ! addrlen, s->sock_proto))) goto finally; *************** *** 3260,3264 **** for (res = res0; res; res = res->ai_next) { PyObject *addr = ! makesockaddr(-1, res->ai_addr, res->ai_addrlen); if (addr == NULL) goto err; --- 3351,3355 ---- for (res = res0; res; res = res->ai_next) { PyObject *addr = ! makesockaddr(-1, res->ai_addr, res->ai_addrlen, protocol); if (addr == NULL) goto err; *************** *** 3718,3723 **** #endif PyModule_AddIntConstant(m, "BTPROTO_RFCOMM", BTPROTO_RFCOMM); ! PyModule_AddObject(m, "BDADDR_ANY", Py_BuildValue( "iiiiii", 0,0,0,0,0,0 ) ); ! PyModule_AddObject(m, "BDADDR_LOCAL", Py_BuildValue( "iiiiii", 0,0,0,0xff,0xff,0xff ) ); #endif --- 3809,3814 ---- #endif PyModule_AddIntConstant(m, "BTPROTO_RFCOMM", BTPROTO_RFCOMM); ! PyModule_AddObject(m, "BDADDR_ANY", Py_BuildValue("s", "00:00:00:00:00:00")); ! PyModule_AddObject(m, "BDADDR_LOCAL", Py_BuildValue("s", "00:00:00:FF:FF:FF")); #endif From loewis at users.sourceforge.net Thu Jun 3 05:47:03 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Jun 3 05:47:14 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.154, 1.155 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21861 Modified Files: libstdtypes.tex Log Message: Document string methods that are locale-dependent. Fixes #935749. Will backport to 2.3. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.154 retrieving revision 1.155 diff -C2 -d -r1.154 -r1.155 *** libstdtypes.tex 2 Jun 2004 16:49:08 -0000 1.154 --- libstdtypes.tex 3 Jun 2004 09:47:01 -0000 1.155 *************** *** 547,550 **** --- 547,552 ---- \begin{methoddesc}[string]{capitalize}{} Return a copy of the string with only its first character capitalized. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 609,612 **** --- 611,616 ---- Return true if all characters in the string are alphanumeric and there is at least one character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 614,617 **** --- 618,623 ---- Return true if all characters in the string are alphabetic and there is at least one character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 619,622 **** --- 625,630 ---- Return true if all characters in the string are digits and there is at least one character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 624,627 **** --- 632,637 ---- Return true if all cased characters in the string are lowercase and there is at least one cased character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 629,632 **** --- 639,644 ---- Return true if there are only whitespace characters in the string and there is at least one character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 636,639 **** --- 648,653 ---- characters and lowercase characters only cased ones. Return false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 641,644 **** --- 655,660 ---- Return true if all cased characters in the string are uppercase and there is at least one cased character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 665,668 **** --- 681,686 ---- \begin{methoddesc}[string]{lower}{} Return a copy of the string converted to lowercase. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 753,756 **** --- 771,776 ---- Return a copy of the string with uppercase characters converted to lowercase and vice versa. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 758,761 **** --- 778,783 ---- Return a titlecased version of the string: words start with uppercase characters, all remaining cased characters are lowercase. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 779,782 **** --- 801,806 ---- \begin{methoddesc}[string]{upper}{} Return a copy of the string converted to uppercase. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} From loewis at users.sourceforge.net Thu Jun 3 05:48:27 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Jun 3 05:48:35 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.129.8.9, 1.129.8.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22047 Modified Files: Tag: release23-maint libstdtypes.tex Log Message: Document which string methods are locale-dependent. Fixes #935749. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.129.8.9 retrieving revision 1.129.8.10 diff -C2 -d -r1.129.8.9 -r1.129.8.10 *** libstdtypes.tex 12 May 2004 02:47:56 -0000 1.129.8.9 --- libstdtypes.tex 3 Jun 2004 09:48:25 -0000 1.129.8.10 *************** *** 545,548 **** --- 545,550 ---- \begin{methoddesc}[string]{capitalize}{} Return a copy of the string with only its first character capitalized. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 606,609 **** --- 608,613 ---- Return true if all characters in the string are alphanumeric and there is at least one character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 611,614 **** --- 615,620 ---- Return true if all characters in the string are alphabetic and there is at least one character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 616,619 **** --- 622,627 ---- Return true if all characters in the string are digits and there is at least one character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 621,624 **** --- 629,634 ---- Return true if all cased characters in the string are lowercase and there is at least one cased character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 626,629 **** --- 636,641 ---- Return true if there are only whitespace characters in the string and there is at least one character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 633,636 **** --- 645,650 ---- characters and lowercase characters only cased ones. Return false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 638,641 **** --- 652,657 ---- Return true if all cased characters in the string are uppercase and there is at least one cased character, false otherwise. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 654,657 **** --- 670,675 ---- \begin{methoddesc}[string]{lower}{} Return a copy of the string converted to lowercase. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 732,735 **** --- 750,755 ---- Return a copy of the string with uppercase characters converted to lowercase and vice versa. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 737,740 **** --- 757,762 ---- Return a titlecased version of the string: words start with uppercase characters, all remaining cased characters are lowercase. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} *************** *** 758,761 **** --- 780,785 ---- \begin{methoddesc}[string]{upper}{} Return a copy of the string converted to uppercase. + + For 8-bit strings, this method is locale-dependent. \end{methoddesc} From loewis at users.sourceforge.net Thu Jun 3 05:55:30 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Jun 3 05:55:38 2004 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex, 1.42, 1.43 utilities.tex, 1.12, 1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23372 Modified Files: concrete.tex utilities.tex Log Message: Drop claims that Unicode always means UCS-2. Fixes #881861. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** concrete.tex 2 Jun 2004 16:49:07 -0000 1.42 --- concrete.tex 3 Jun 2004 09:55:27 -0000 1.43 *************** *** 1110,1116 **** is prepended. ! Note that \ctype{Py_UNICODE} data is being interpreted as UTF-16 ! reduced to UCS-2. This trick makes it possible to add full UTF-16 ! capabilities at a later point without comprimising the APIs. Returns \NULL{} if an exception was raised by the codec. --- 1110,1117 ---- is prepended. ! If \var{Py_UNICODE_WIDE} is defined, a single \ctype{Py_UNICODE} ! value may get represented as a surrogate pair. If it is not ! defined, each \ctype{Py_UNICODE} values is interpreted as an ! UCS-2 character. Returns \NULL{} if an exception was raised by the codec. Index: utilities.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/utilities.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** utilities.tex 4 May 2004 19:25:56 -0000 1.12 --- utilities.tex 3 Jun 2004 09:55:28 -0000 1.13 *************** *** 781,792 **** \item[\samp{u} (Unicode string) {[Py_UNICODE *]}] ! Convert a null-terminated buffer of Unicode (UCS-2) data to a ! Python Unicode object. If the Unicode buffer pointer is \NULL, ! \code{None} is returned. \item[\samp{u\#} (Unicode string) {[Py_UNICODE *, int]}] ! Convert a Unicode (UCS-2) data buffer and its length to a Python ! Unicode object. If the Unicode buffer pointer is \NULL, the ! length is ignored and \code{None} is returned. \item[\samp{i} (integer) {[int]}] --- 781,792 ---- \item[\samp{u} (Unicode string) {[Py_UNICODE *]}] ! Convert a null-terminated buffer of Unicode (UCS-2 or UCS-4) ! data to a Python Unicode object. If the Unicode buffer pointer ! is \NULL, \code{None} is returned. \item[\samp{u\#} (Unicode string) {[Py_UNICODE *, int]}] ! Convert a Unicode (UCS-2 or UCS-4) data buffer and its length ! to a Python Unicode object. If the Unicode buffer pointer ! is \NULL, the length is ignored and \code{None} is returned. \item[\samp{i} (integer) {[int]}] From perky at users.sourceforge.net Thu Jun 3 07:11:01 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Thu Jun 3 07:11:09 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.986,1.987 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5116/Misc Modified Files: NEWS Log Message: Fix the grammar a bit more. (Adjusted by Tony Meyer) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.986 retrieving revision 1.987 diff -C2 -d -r1.986 -r1.987 *** NEWS 3 Jun 2004 09:18:35 -0000 1.986 --- NEWS 3 Jun 2004 11:10:58 -0000 1.987 *************** *** 13,18 **** ----------------- ! - Unicode objects received two new methods now; iswide() and width(). They ! query east asian width information according to Unicode TR11. - Improved the tuple hashing algorithm to give fewer collisions in --- 13,19 ---- ----------------- ! - Unicode objects received two new methods: iswide() and width(). ! These query East Asian width information, as specified in Unicode ! TR11. - Improved the tuple hashing algorithm to give fewer collisions in From bsyqaztv at pochta.ru Thu Jun 3 08:12:45 2004 From: bsyqaztv at pochta.ru (Multiple O'Gazm 4 men ) Date: Thu Jun 3 07:16:34 2004 Subject: [Python-checkins] Can you last for 4 hours and drive her crazy? -Pythonmac-sig-request corvus Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040603/01a6c60a/attachment.html From jackjansen at users.sourceforge.net Thu Jun 3 08:41:48 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 08:41:53 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils sysconfig.py, 1.58, 1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20139/Lib/distutils Modified Files: sysconfig.py Log Message: Partial fix for #887242 (link extensions with dynamic_lookup in stead of hard linking against the framework). If $MACOSX_DEPLOYMENT_TARGET is set, and >= 10.3, during configure we setup extensions to link with dynamic lookup. We also record the value in the Makefile. Distutils checks whether a value for MACOSX_DEPLOYMENT_TARGET was recorded in the Makefile, and if it was insists that the current value matches. This is only a partial fix because it only applies to 2.4, and the "two python problem" exists with Python 2.3 shipped with MacOSX 10.3, which we have no influence over. Index: sysconfig.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/sysconfig.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** sysconfig.py 24 Oct 2003 20:09:23 -0000 1.58 --- sysconfig.py 3 Jun 2004 12:41:45 -0000 1.59 *************** *** 356,360 **** raise DistutilsPlatformError(my_msg) ! # On AIX, there are wrong paths to the linker scripts in the Makefile # -- these paths are relative to the Python source, but when installed --- 356,372 ---- raise DistutilsPlatformError(my_msg) ! # On MacOSX we need to check the setting of the environment variable ! # MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so ! # it needs to be compatible. ! # An alternative would be to force MACOSX_DEPLOYMENT_TARGET to be ! # the same as during configure. ! if sys.platform == 'darwin' and g.has_key('CONFIGURE_MACOSX_DEPLOYMENT_TARGET'): ! cfg_target = g['CONFIGURE_MACOSX_DEPLOYMENT_TARGET'] ! cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '') ! if cfg_target != cur_target: ! my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure' ! % (cur_target, cfg_target)) ! raise DistutilsPlatformError(my_msg) ! # On AIX, there are wrong paths to the linker scripts in the Makefile # -- these paths are relative to the Python source, but when installed From jackjansen at users.sourceforge.net Thu Jun 3 08:41:48 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 08:41:55 2004 Subject: [Python-checkins] python/dist/src configure, 1.444, 1.445 configure.in, 1.455, 1.456 Makefile.pre.in, 1.143, 1.144 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20139 Modified Files: configure configure.in Makefile.pre.in Log Message: Partial fix for #887242 (link extensions with dynamic_lookup in stead of hard linking against the framework). If $MACOSX_DEPLOYMENT_TARGET is set, and >= 10.3, during configure we setup extensions to link with dynamic lookup. We also record the value in the Makefile. Distutils checks whether a value for MACOSX_DEPLOYMENT_TARGET was recorded in the Makefile, and if it was insists that the current value matches. This is only a partial fix because it only applies to 2.4, and the "two python problem" exists with Python 2.3 shipped with MacOSX 10.3, which we have no influence over. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.444 retrieving revision 1.445 diff -C2 -d -r1.444 -r1.445 *** configure 7 May 2004 19:14:14 -0000 1.444 --- configure 3 Jun 2004 12:41:38 -0000 1.445 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.454 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.4. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.455 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.4. *************** *** 310,314 **** #endif" ! ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CXX MAINOBJ EXEEXT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS' ac_subst_files='' --- 310,314 ---- #endif" ! ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CONFIGURE_MACOSX_DEPLOYMENT_TARGET CXX MAINOBJ EXEEXT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS' ac_subst_files='' *************** *** 1443,1446 **** --- 1443,1447 ---- # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. + # Reconfirmed for 7.1.4 by Martin v. Loewis. OpenUNIX/8.0.0| UnixWare/7.1.[0-4]) define_xopen_source=no;; *************** *** 1528,1531 **** --- 1529,1538 ---- echo "${ECHO_T}$EXTRAPLATDIR" >&6 + # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET, + # it may influence the way we can build extensions, so distutils + # needs to check it + + CONFIGURE_MACOSX_DEPLOYMENT_TARGET= + # checks for alternative programs *************** *** 9393,9397 **** LDSHARED="$LDSHARED -undefined suppress" fi ;; ! Darwin/*) LDSHARED='$(CC) $(LDFLAGS) -bundle' if test "$enable_framework" ; then --- 9400,9404 ---- LDSHARED="$LDSHARED -undefined suppress" fi ;; ! Darwin/1.4*|Darwin/5.*|Darwin/6.*) LDSHARED='$(CC) $(LDFLAGS) -bundle' if test "$enable_framework" ; then *************** *** 9404,9407 **** --- 9411,9435 ---- LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' fi ;; + Darwin/*) + # Use -undefined dynamic_lookup whenever possible (10.3 and later). + # This allows an extension to be used in any Python + if test ${MACOSX_DEPLOYMENT_TARGET-10.1} '>' 10.2 + then + LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' + BLDSHARED="$LDSHARED" + CONFIGURE_MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET + else + LDSHARED='$(CC) $(LDFLAGS) -bundle' + if test "$enable_framework" ; then + # Link against the framework. All externals should be defined. + BLDSHARED="$LDSHARED "'-Wl,-F. -framework $(PYTHONFRAMEWORK)' + LDSHARED="$LDSHARED "'-Wl,-F$(PYTHONFRAMEWORKPREFIX) -framework $(PYTHONFRAMEWORK)' + else + # No framework, use the Python app as bundle-loader + BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' + LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' + fi + fi + ;; Linux*|GNU*) LDSHARED='$(CC) -shared';; BSD/OS*/4*) LDSHARED="gcc -shared";; *************** *** 18663,18666 **** --- 18691,18695 ---- s,@EXTRAPLATDIR@,$EXTRAPLATDIR,;t t s,@EXTRAMACHDEPPATH@,$EXTRAMACHDEPPATH,;t t + s,@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@,$CONFIGURE_MACOSX_DEPLOYMENT_TARGET,;t t s,@CXX@,$CXX,;t t s,@MAINOBJ@,$MAINOBJ,;t t Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.455 retrieving revision 1.456 diff -C2 -d -r1.455 -r1.456 *** configure.in 7 May 2004 19:14:14 -0000 1.455 --- configure.in 3 Jun 2004 12:41:45 -0000 1.456 *************** *** 217,220 **** --- 217,226 ---- AC_MSG_RESULT($EXTRAPLATDIR) + # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET, + # it may influence the way we can build extensions, so distutils + # needs to check it + AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET) + CONFIGURE_MACOSX_DEPLOYMENT_TARGET= + # checks for alternative programs *************** *** 1258,1262 **** LDSHARED="$LDSHARED -undefined suppress" fi ;; ! Darwin/*) LDSHARED='$(CC) $(LDFLAGS) -bundle' if test "$enable_framework" ; then --- 1264,1268 ---- LDSHARED="$LDSHARED -undefined suppress" fi ;; ! Darwin/1.4*|Darwin/5.*|Darwin/6.*) LDSHARED='$(CC) $(LDFLAGS) -bundle' if test "$enable_framework" ; then *************** *** 1269,1272 **** --- 1275,1299 ---- LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' fi ;; + Darwin/*) + # Use -undefined dynamic_lookup whenever possible (10.3 and later). + # This allows an extension to be used in any Python + if test ${MACOSX_DEPLOYMENT_TARGET-10.1} '>' 10.2 + then + LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup' + BLDSHARED="$LDSHARED" + CONFIGURE_MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET + else + LDSHARED='$(CC) $(LDFLAGS) -bundle' + if test "$enable_framework" ; then + # Link against the framework. All externals should be defined. + BLDSHARED="$LDSHARED "'-Wl,-F. -framework $(PYTHONFRAMEWORK)' + LDSHARED="$LDSHARED "'-Wl,-F$(PYTHONFRAMEWORKPREFIX) -framework $(PYTHONFRAMEWORK)' + else + # No framework, use the Python app as bundle-loader + BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' + LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' + fi + fi + ;; Linux*|GNU*) LDSHARED='$(CC) -shared';; BSD/OS*/4*) LDSHARED="gcc -shared";; Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** Makefile.pre.in 1 Jun 2004 15:22:39 -0000 1.143 --- Makefile.pre.in 3 Jun 2004 12:41:45 -0000 1.144 *************** *** 108,111 **** --- 108,114 ---- PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@ PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@ + # Deployment target selected during configure, to be checked + # by distutils + CONFIGURE_MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@ # Options to enable prebinding (for fast startup) OTHER_LIBTOOL_OPT = -prebind -seg1addr 0x10000000 From loewis at users.sourceforge.net Thu Jun 3 08:47:44 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Jun 3 08:47:47 2004 Subject: [Python-checkins] python/dist/src/Modules fcntlmodule.c,2.41,2.42 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21243/Modules Modified Files: fcntlmodule.c Log Message: Warn abou missing mutate flag to ioctl. Fixes #696535. Index: fcntlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fcntlmodule.c,v retrieving revision 2.41 retrieving revision 2.42 diff -C2 -d -r2.41 -r2.42 *** fcntlmodule.c 30 Jun 2003 01:54:04 -0000 2.41 --- fcntlmodule.c 3 Jun 2004 12:47:26 -0000 2.42 *************** *** 109,113 **** if (PyTuple_Size(args) == 3) { ! /* warning goes here in 2.4 */ mutate_arg = 0; } --- 109,119 ---- if (PyTuple_Size(args) == 3) { ! #if (PY_MAJOR_VERSION>2) || (PY_MINOR_VERSION>=5) ! #error Remove the warning, change mutate_arg to 1 ! #endif ! if (PyErr_Warn(PyExc_FutureWarning, ! "ioctl with mutable buffer will mutate the buffer by default in 2.5" ! ) < 0) ! return NULL; mutate_arg = 0; } From loewis at users.sourceforge.net Thu Jun 3 08:47:58 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Jun 3 08:48:03 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.49, 1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21243/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: Warn abou missing mutate flag to ioctl. Fixes #696535. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** whatsnew24.tex 31 May 2004 18:22:40 -0000 1.49 --- whatsnew24.tex 3 Jun 2004 12:47:25 -0000 1.50 *************** *** 670,673 **** --- 670,675 ---- relying on the wrong order need to be fixed. + \item \function{fcntl.ioctl} now warns if the mutate arg is omitted. + \end{itemize} From loewis at users.sourceforge.net Thu Jun 3 08:47:58 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu Jun 3 08:48:05 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.987,1.988 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21243/Misc Modified Files: NEWS Log Message: Warn abou missing mutate flag to ioctl. Fixes #696535. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.987 retrieving revision 1.988 diff -C2 -d -r1.987 -r1.988 *** NEWS 3 Jun 2004 11:10:58 -0000 1.987 --- NEWS 3 Jun 2004 12:47:25 -0000 1.988 *************** *** 215,218 **** --- 215,220 ---- ----------------- + - fcntl.ioctl now warns if the mutate flag is not specified. + - nt now properly allows to refer to UNC roots, e.g. in nt.stat(). From jackjansen at users.sourceforge.net Thu Jun 3 09:07:42 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 09:07:46 2004 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py, 1.27.4.1, 1.27.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26052 Modified Files: Tag: release23-maint pimp.py Log Message: Backport of 1.31-1.34: - Added a downloader using urllib2 in stead of curl, based on code donated by Kevin Ollivier. This is now the default downloader. - Added a watcher mechanism, whereby downloaders and unpackers (and, later builders) can give status feedback to the user. When running pimp as a command line tool in verbose mode print this output. - Force option should be applied to a single package, not recursively to its dependencies. Fixes #733819. - Don't use "dict" as a variable, it shadows the builtin. Spotted by Bob Ippolito. Two issues spotted by Ronald OUssoren: - there were no accessor functions for the global per-database fields - packages and their dependencies were installed in order in stead of in reverse order. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.27.4.1 retrieving revision 1.27.4.2 diff -C2 -d -r1.27.4.1 -r1.27.4.2 *** pimp.py 28 Feb 2004 23:21:50 -0000 1.27.4.1 --- pimp.py 3 Jun 2004 13:07:39 -0000 1.27.4.2 *************** *** 26,29 **** --- 26,30 ---- import tempfile import shutil + import time __all__ = ["PimpPreferences", "PimpDatabase", "PimpPackage", "main", *************** *** 48,94 **** def getDefaultDatabase(experimental=False): ! if experimental: ! status = "exp" ! else: ! status = "prod" ! ! major, minor, micro, state, extra = sys.version_info ! pyvers = '%d.%d' % (major, minor) ! if state != 'final': ! pyvers = pyvers + '%s%d' % (state, extra) ! ! longplatform = distutils.util.get_platform() ! osname, release, machine = longplatform.split('-') ! # For some platforms we may want to differentiate between ! # installation types ! if osname == 'darwin': ! if sys.prefix.startswith('/System/Library/Frameworks/Python.framework'): ! osname = 'darwin_apple' ! elif sys.prefix.startswith('/Library/Frameworks/Python.framework'): ! osname = 'darwin_macpython' ! # Otherwise we don't know... ! # Now we try various URLs by playing with the release string. ! # We remove numbers off the end until we find a match. ! rel = release ! while True: ! url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, rel, machine) ! try: ! urllib2.urlopen(url) ! except urllib2.HTTPError, arg: ! pass ! else: ! break ! if not rel: ! # We're out of version numbers to try. Use the ! # full release number, this will give a reasonable ! # error message later ! url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, release, machine) ! break ! idx = rel.rfind('.') ! if idx < 0: ! rel = '' ! else: ! rel = rel[:idx] ! return url def _cmd(output, dir, *cmditems): --- 49,95 ---- def getDefaultDatabase(experimental=False): ! if experimental: ! status = "exp" ! else: ! status = "prod" ! ! major, minor, micro, state, extra = sys.version_info ! pyvers = '%d.%d' % (major, minor) ! if state != 'final': ! pyvers = pyvers + '%s%d' % (state, extra) ! ! longplatform = distutils.util.get_platform() ! osname, release, machine = longplatform.split('-') ! # For some platforms we may want to differentiate between ! # installation types ! if osname == 'darwin': ! if sys.prefix.startswith('/System/Library/Frameworks/Python.framework'): ! osname = 'darwin_apple' ! elif sys.prefix.startswith('/Library/Frameworks/Python.framework'): ! osname = 'darwin_macpython' ! # Otherwise we don't know... ! # Now we try various URLs by playing with the release string. ! # We remove numbers off the end until we find a match. ! rel = release ! while True: ! url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, rel, machine) ! try: ! urllib2.urlopen(url) ! except urllib2.HTTPError, arg: ! pass ! else: ! break ! if not rel: ! # We're out of version numbers to try. Use the ! # full release number, this will give a reasonable ! # error message later ! url = DEFAULT_PIMPDATABASE_FMT % (PIMP_VERSION, status, pyvers, osname, release, machine) ! break ! idx = rel.rfind('.') ! if idx < 0: ! rel = '' ! else: ! rel = rel[:idx] ! return url def _cmd(output, dir, *cmditems): *************** *** 110,113 **** --- 111,176 ---- return child.wait() + class PimpDownloader: + """Abstract base class - Downloader for archives""" + + def __init__(self, argument, + dir="", + watcher=None): + self.argument = argument + self._dir = dir + self._watcher = watcher + + def download(self, url, filename, output=None): + return None + + def update(self, str): + if self._watcher: + return self._watcher.update(str) + return True + + class PimpCurlDownloader(PimpDownloader): + + def download(self, url, filename, output=None): + self.update("Downloading %s..." % url) + exitstatus = _cmd(output, self._dir, + "curl", + "--output", filename, + url) + self.update("Downloading %s: finished" % url) + return (not exitstatus) + + class PimpUrllibDownloader(PimpDownloader): + + def download(self, url, filename, output=None): + output = open(filename, 'wb') + self.update("Downloading %s: opening connection" % url) + keepgoing = True + download = urllib2.urlopen(url) + if download.headers.has_key("content-length"): + length = long(download.headers['content-length']) + else: + length = -1 + + data = download.read(4096) #read 4K at a time + dlsize = 0 + lasttime = 0 + while keepgoing: + dlsize = dlsize + len(data) + if len(data) == 0: + #this is our exit condition + break + output.write(data) + if int(time.time()) != lasttime: + # Update at most once per second + lasttime = int(time.time()) + if length == -1: + keepgoing = self.update("Downloading %s: %d bytes..." % (url, dlsize)) + else: + keepgoing = self.update("Downloading %s: %d%% (%d bytes)..." % (url, int(100.0*dlsize/length), dlsize)) + data = download.read(4096) + if keepgoing: + self.update("Downloading %s: finished" % url) + return keepgoing + class PimpUnpacker: """Abstract base class - Unpacker for archives""" *************** *** 117,121 **** def __init__(self, argument, dir="", ! renames=[]): self.argument = argument if renames and not self._can_rename: --- 180,185 ---- def __init__(self, argument, dir="", ! renames=[], ! watcher=None): self.argument = argument if renames and not self._can_rename: *************** *** 123,130 **** --- 187,200 ---- self._dir = dir self._renames = renames + self._watcher = watcher def unpack(self, archive, output=None, package=None): return None + def update(self, str): + if self._watcher: + return self._watcher.update(str) + return True + class PimpCommandUnpacker(PimpUnpacker): """Unpack archives by calling a Unix utility""" *************** *** 174,178 **** --- 244,250 ---- for member in members: if member in skip: + self.update("Skipping %s" % member.name) continue + self.update("Extracting %s" % member.name) tf.extract(member, self._dir) if skip: *************** *** 215,218 **** --- 287,294 ---- self.buildDir = buildDir self.pimpDatabase = pimpDatabase + self.watcher = None + + def setWatcher(self, watcher): + self.watcher = watcher def setInstallDir(self, installDir=None): *************** *** 283,286 **** --- 359,363 ---- self._packages = [] self.preferences = prefs + self._url = "" self._urllist = [] self._version = "" *************** *** 288,291 **** --- 365,374 ---- self._description = "" + # Accessor functions + def url(self): return self._url + def version(self): return self._version + def maintainer(self): return self._maintainer + def description(self): return self._description + def close(self): """Clean up""" *************** *** 302,314 **** self._urllist.append(url) fp = urllib2.urlopen(url).fp ! dict = plistlib.Plist.fromFile(fp) # Test here for Pimp version, etc if included: ! version = dict.get('Version') if version and version > self._version: sys.stderr.write("Warning: included database %s is for pimp version %s\n" % (url, version)) else: ! self._version = dict.get('Version') if not self._version: sys.stderr.write("Warning: database has no Version information\n") --- 385,397 ---- self._urllist.append(url) fp = urllib2.urlopen(url).fp ! plistdata = plistlib.Plist.fromFile(fp) # Test here for Pimp version, etc if included: ! version = plistdata.get('Version') if version and version > self._version: sys.stderr.write("Warning: included database %s is for pimp version %s\n" % (url, version)) else: ! self._version = plistdata.get('Version') if not self._version: sys.stderr.write("Warning: database has no Version information\n") *************** *** 316,323 **** sys.stderr.write("Warning: database version %s newer than pimp version %s\n" % (self._version, PIMP_VERSION)) ! self._maintainer = dict.get('Maintainer', '') ! self._description = dict.get('Description', '').strip() ! self._appendPackages(dict['Packages']) ! others = dict.get('Include', []) for url in others: self.appendURL(url, included=1) --- 399,407 ---- sys.stderr.write("Warning: database version %s newer than pimp version %s\n" % (self._version, PIMP_VERSION)) ! self._maintainer = plistdata.get('Maintainer', '') ! self._description = plistdata.get('Description', '').strip() ! self._url = url ! self._appendPackages(plistdata['Packages']) ! others = plistdata.get('Include', []) for url in others: self.appendURL(url, included=1) *************** *** 362,366 **** for pkg in self._packages: packages.append(pkg.dump()) ! dict = { 'Version': self._version, 'Maintainer': self._maintainer, --- 446,450 ---- for pkg in self._packages: packages.append(pkg.dump()) ! plistdata = { 'Version': self._version, 'Maintainer': self._maintainer, *************** *** 368,372 **** 'Packages': packages } ! plist = plistlib.Plist(**dict) plist.write(pathOrFile) --- 452,456 ---- 'Packages': packages } ! plist = plistlib.Plist(**plistdata) plist.write(pathOrFile) *************** *** 429,439 **** """Class representing a single package.""" ! def __init__(self, db, dict): self._db = db ! name = dict["Name"] ! for k in dict.keys(): if not k in ALLOWED_KEYS: sys.stderr.write("Warning: %s: unknown key %s\n" % (name, k)) ! self._dict = dict def __getitem__(self, key): --- 513,523 ---- """Class representing a single package.""" ! def __init__(self, db, plistdata): self._db = db ! name = plistdata["Name"] ! for k in plistdata.keys(): if not k in ALLOWED_KEYS: sys.stderr.write("Warning: %s: unknown key %s\n" % (name, k)) ! self._dict = plistdata def __getitem__(self, key): *************** *** 583,590 **** if scheme == 'manual': return "Please download package manually and save as %s" % self.archiveFilename ! if _cmd(output, self._db.preferences.downloadDir, ! "curl", ! "--output", self.archiveFilename, ! self._dict['Download-URL']): return "download command failed" if not os.path.exists(self.archiveFilename) and not NO_EXECUTE: --- 667,674 ---- if scheme == 'manual': return "Please download package manually and save as %s" % self.archiveFilename ! downloader = PimpUrllibDownloader(None, self._db.preferences.downloadDir, ! watcher=self._db.preferences.watcher) ! if not downloader.download(self._dict['Download-URL'], ! self.archiveFilename, output): return "download command failed" if not os.path.exists(self.archiveFilename) and not NO_EXECUTE: *************** *** 615,619 **** return "unknown extension for archive file: %s" % filename self.basename = filename[:-len(ext)] ! unpacker = unpackerClass(arg, dir=self._db.preferences.buildDir) rv = unpacker.unpack(self.archiveFilename, output=output) if rv: --- 699,704 ---- return "unknown extension for archive file: %s" % filename self.basename = filename[:-len(ext)] ! unpacker = unpackerClass(arg, dir=self._db.preferences.buildDir, ! watcher=self._db.preferences.watcher) rv = unpacker.unpack(self.archiveFilename, output=output) if rv: *************** *** 824,828 **** for package in packages: if not package in self._todo: ! self._todo.insert(0, package) def _prepareInstall(self, package, force=0, recursive=1): --- 909,913 ---- for package in packages: if not package in self._todo: ! self._todo.append(package) def _prepareInstall(self, package, force=0, recursive=1): *************** *** 845,849 **** for pkg, descr in prereqs: if pkg: ! self._prepareInstall(pkg, force, recursive) else: self._curmessages.append("Problem with dependency: %s" % descr) --- 930,934 ---- for pkg, descr in prereqs: if pkg: ! self._prepareInstall(pkg, False, recursive) else: self._curmessages.append("Problem with dependency: %s" % descr) *************** *** 880,887 **** ! def _run(mode, verbose, force, args, prefargs): """Engine for the main program""" prefs = PimpPreferences(**prefargs) rv = prefs.check() if rv: --- 965,974 ---- ! def _run(mode, verbose, force, args, prefargs, watcher): """Engine for the main program""" prefs = PimpPreferences(**prefargs) + if watcher: + prefs.setWatcher(watcher) rv = prefs.check() if rv: *************** *** 980,983 **** --- 1067,1075 ---- sys.exit(1) + class _Watcher: + def update(self, msg): + sys.stderr.write(msg + '\r') + return 1 + try: opts, args = getopt.getopt(sys.argv[1:], "slifvdD:Vu:") *************** *** 990,993 **** --- 1082,1086 ---- verbose = 0 prefargs = {} + watcher = None for o, a in opts: if o == '-s': *************** *** 1013,1016 **** --- 1106,1110 ---- if o == '-v': verbose = 1 + watcher = _Watcher() if o == '-D': prefargs['installDir'] = a *************** *** 1022,1026 **** print 'Pimp version %s; module name is %s' % (PIMP_VERSION, __name__) else: ! _run(mode, verbose, force, args, prefargs) # Finally, try to update ourselves to a newer version. --- 1116,1120 ---- print 'Pimp version %s; module name is %s' % (PIMP_VERSION, __name__) else: ! _run(mode, verbose, force, args, prefargs, watcher) # Finally, try to update ourselves to a newer version. From fdrake at users.sourceforge.net Thu Jun 3 09:31:25 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Jun 3 09:31:31 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.50, 1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31710 Modified Files: whatsnew24.tex Log Message: - fix typo reported by John Belmonte - wrap a long line Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** whatsnew24.tex 3 Jun 2004 12:47:25 -0000 1.50 --- whatsnew24.tex 3 Jun 2004 13:31:22 -0000 1.51 *************** *** 370,374 **** \samp{map(mydict.__getitem__, keylist)}. ! \item Added an newcode opcode, \code{LIST_APPEND}, that simplifies the generated bytecode for list comprehensions and speeds them up by about a third. --- 370,374 ---- \samp{map(mydict.__getitem__, keylist)}. ! \item Added a new opcode, \code{LIST_APPEND}, that simplifies the generated bytecode for list comprehensions and speeds them up by about a third. *************** *** 394,400 **** \item The \module{curses} modules now supports the ncurses extension ! \function{use_default_colors()}. On platforms where the terminal ! supports transparency, this makes it possible to use a transparent background. ! (Contributed by J\"org Lehmann.) \item The \module{bisect} module now has an underlying C implementation --- 394,400 ---- \item The \module{curses} modules now supports the ncurses extension ! \function{use_default_colors()}. On platforms where the terminal ! supports transparency, this makes it possible to use a transparent ! background. (Contributed by J\"org Lehmann.) \item The \module{bisect} module now has an underlying C implementation From jackjansen at users.sourceforge.net Thu Jun 3 09:31:53 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 09:31:56 2004 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE Wapplication.py, 1.23, 1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31227 Modified Files: Wapplication.py Log Message: Very large scripts folders could crash the IDE, because it runs out of Menu IDs (of which there are only 255 in Carbon). Fixed by stopping examining the scripts folder when we allocate menu ID 200. Fixes #959291. Need to backport. Index: Wapplication.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wapplication.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Wapplication.py 12 Feb 2004 17:35:14 -0000 1.23 --- Wapplication.py 3 Jun 2004 13:31:51 -0000 1.24 *************** *** 276,283 **** def scriptswalk(self, top, menu, done=None): if done is None: done = {} if done.has_key(top): ! return done[top] = 1 import os, string --- 276,287 ---- def scriptswalk(self, top, menu, done=None): + if menu.id > 200: + import W + W.Message("Scripts folder not completely traversed: running out of menus") + return False if done is None: done = {} if done.has_key(top): ! return True done[top] = 1 import os, string *************** *** 286,290 **** except os.error: FrameWork.MenuItem(menu, '(Scripts Folder not found)', None, None) ! return savedir = os.getcwd() os.chdir(top) --- 290,294 ---- except os.error: FrameWork.MenuItem(menu, '(Scripts Folder not found)', None, None) ! return True savedir = os.getcwd() os.chdir(top) *************** *** 307,311 **** elif isdir: submenu = FrameWork.SubMenu(menu, name) ! self.scriptswalk(path, submenu, done) else: creator, type = MacOS.GetCreatorAndType(path) --- 311,316 ---- elif isdir: submenu = FrameWork.SubMenu(menu, name) ! if not self.scriptswalk(path, submenu, done): ! return False else: creator, type = MacOS.GetCreatorAndType(path) *************** *** 317,320 **** --- 322,326 ---- done[path] = 1 os.chdir(savedir) + return True def domenu_script(self, id, item, window, event): From jackjansen at users.sourceforge.net Thu Jun 3 09:34:44 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 09:34:47 2004 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE Wapplication.py, 1.22, 1.22.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32276 Modified Files: Tag: release23-maint Wapplication.py Log Message: Backport of 1.23 and 1.24: Very large scripts folders could crash the IDE, because it runs out of Menu IDs (of which there are only 255 in Carbon). Fixed by stopping examining the scripts folder when we allocate menu ID 200. Fixes #959291. Replace backticks with repr() or "%r" >From SF patch #852334. Index: Wapplication.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wapplication.py,v retrieving revision 1.22 retrieving revision 1.22.8.1 diff -C2 -d -r1.22 -r1.22.8.1 *** Wapplication.py 6 May 2003 14:28:31 -0000 1.22 --- Wapplication.py 3 Jun 2004 13:34:41 -0000 1.22.8.1 *************** *** 119,123 **** except: import sys ! sys.stderr.write("exception in idle function %s; killed:\n" % `func`) traceback.print_exc() self._idlefuncs.remove(func) --- 119,123 ---- except: import sys ! sys.stderr.write("exception in idle function %r; killed:\n" % (func,)) traceback.print_exc() self._idlefuncs.remove(func) *************** *** 176,180 **** return # here! we had a menukey! #else: ! # print "XXX Command-" +`ch` # See whether the front window wants it if wid and self._windows.has_key(wid): --- 176,180 ---- return # here! we had a menukey! #else: ! # print "XXX Command-%r" % ch # See whether the front window wants it if wid and self._windows.has_key(wid): *************** *** 276,283 **** def scriptswalk(self, top, menu, done=None): if done is None: done = {} if done.has_key(top): ! return done[top] = 1 import os, string --- 276,287 ---- def scriptswalk(self, top, menu, done=None): + if menu.id > 200: + import W + W.Message("Scripts folder not completely traversed: running out of menus") + return False if done is None: done = {} if done.has_key(top): ! return True done[top] = 1 import os, string *************** *** 286,290 **** except os.error: FrameWork.MenuItem(menu, '(Scripts Folder not found)', None, None) ! return savedir = os.getcwd() os.chdir(top) --- 290,294 ---- except os.error: FrameWork.MenuItem(menu, '(Scripts Folder not found)', None, None) ! return True savedir = os.getcwd() os.chdir(top) *************** *** 307,311 **** elif isdir: submenu = FrameWork.SubMenu(menu, name) ! self.scriptswalk(path, submenu, done) else: creator, type = MacOS.GetCreatorAndType(path) --- 311,316 ---- elif isdir: submenu = FrameWork.SubMenu(menu, name) ! if not self.scriptswalk(path, submenu, done): ! return False else: creator, type = MacOS.GetCreatorAndType(path) *************** *** 317,320 **** --- 322,326 ---- done[path] = 1 os.chdir(savedir) + return True def domenu_script(self, id, item, window, event): From mwh at users.sourceforge.net Thu Jun 3 09:36:44 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu Jun 3 09:36:47 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.51, 1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32724 Modified Files: whatsnew24.tex Log Message: Small clarification. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** whatsnew24.tex 3 Jun 2004 13:31:22 -0000 1.51 --- whatsnew24.tex 3 Jun 2004 13:36:42 -0000 1.52 *************** *** 670,674 **** relying on the wrong order need to be fixed. ! \item \function{fcntl.ioctl} now warns if the mutate arg is omitted. \end{itemize} --- 670,675 ---- relying on the wrong order need to be fixed. ! \item \function{fcntl.ioctl} now warns if the mutate arg is omitted ! and relavent. \end{itemize} From gvanrossum at users.sourceforge.net Thu Jun 3 09:56:07 2004 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu Jun 3 09:56:14 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.52, 1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5704 Modified Files: whatsnew24.tex Log Message: Fix typo. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** whatsnew24.tex 3 Jun 2004 13:36:42 -0000 1.52 --- whatsnew24.tex 3 Jun 2004 13:56:05 -0000 1.53 *************** *** 671,675 **** \item \function{fcntl.ioctl} now warns if the mutate arg is omitted ! and relavent. \end{itemize} --- 671,675 ---- \item \function{fcntl.ioctl} now warns if the mutate arg is omitted ! and relevant. \end{itemize} From rhettinger at users.sourceforge.net Thu Jun 3 10:13:18 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 3 10:13:22 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.232,1.233 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9046 Modified Files: tut.tex Log Message: Fix typo: the-->they Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.232 retrieving revision 1.233 diff -C2 -d -r1.232 -r1.233 *** tut.tex 31 May 2004 22:53:25 -0000 1.232 --- tut.tex 3 Jun 2004 14:13:04 -0000 1.233 *************** *** 4403,4410 **** Some simple generators can be coded succinctly as expressions using a syntax ! like list comprehensions but with parentheses instead of brackets. These expressions are designed for situations where the generator is used right away by an enclosing function. Generator expressions are more compact but ! less versatile than full generator definitions and the tend to be more memory friendly than equivalent list comprehensions. --- 4403,4410 ---- Some simple generators can be coded succinctly as expressions using a syntax ! similar to list comprehensions but with parentheses instead of brackets. These expressions are designed for situations where the generator is used right away by an enclosing function. Generator expressions are more compact but ! less versatile than full generator definitions and they tend to be more memory friendly than equivalent list comprehensions. From jackjansen at users.sourceforge.net Thu Jun 3 10:15:52 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 10:15:56 2004 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher main.m, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9517 Modified Files: main.m Log Message: On startup, attempt to set the working directory to $HOME. Fixes #913581. Index: main.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/main.m,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** main.m 29 Jul 2002 21:36:35 -0000 1.1 --- main.m 3 Jun 2004 14:15:50 -0000 1.2 *************** *** 8,14 **** --- 8,17 ---- #import + #include int main(int argc, const char *argv[]) { + char *home = getenv("HOME"); + if (home) chdir(home); return NSApplicationMain(argc, argv); } From jackjansen at users.sourceforge.net Thu Jun 3 10:16:56 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 10:17:00 2004 Subject: [Python-checkins] python/dist/src/Mac/OSX/PythonLauncher main.m, 1.1, 1.1.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9909 Modified Files: Tag: release23-maint main.m Log Message: Backport of 1.2: On startup, attempt to set the working directory to $HOME. Fixes #913581. Index: main.m =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/PythonLauncher/main.m,v retrieving revision 1.1 retrieving revision 1.1.14.1 diff -C2 -d -r1.1 -r1.1.14.1 *** main.m 29 Jul 2002 21:36:35 -0000 1.1 --- main.m 3 Jun 2004 14:16:53 -0000 1.1.14.1 *************** *** 8,14 **** --- 8,17 ---- #import + #include int main(int argc, const char *argv[]) { + char *home = getenv("HOME"); + if (home) chdir(home); return NSApplicationMain(argc, argv); } From jackjansen at users.sourceforge.net Thu Jun 3 10:33:06 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 10:33:09 2004 Subject: [Python-checkins] python/dist/src/Modules getpath.c,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14964 Modified Files: getpath.c Log Message: Fix for #932977: MacOSX does not pass the whole pathname in argv[0] for #!-scripts, only the filename part, and this can lead to incorrect initialization of sys.path and sys.executable if there is another python on $PATH before the one used in #!. The fix was picked up from the darwinports crowd, thanks! Index: getpath.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/getpath.c,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** getpath.c 31 Dec 2002 12:45:12 -0000 1.46 --- getpath.c 3 Jun 2004 14:33:03 -0000 1.47 *************** *** 375,378 **** --- 375,381 ---- NSModule pythonModule; #endif + #ifdef __APPLE__ + unsigned long nsexeclength = MAXPATHLEN; + #endif /* If there is no slash in the argv0 path, then we have to *************** *** 383,386 **** --- 386,403 ---- if (strchr(prog, SEP)) strncpy(progpath, prog, MAXPATHLEN); + #ifdef __APPLE__ + /* On Mac OS X, if a script uses an interpreter of the form + * "#!/opt/python2.3/bin/python", the kernel only passes "python" + * as argv[0], which falls through to the $PATH search below. + * If /opt/python2.3/bin isn't in your path, or is near the end, + * this algorithm may incorrectly find /usr/bin/python. To work + * around this, we can use _NSGetExecutablePath to get a better + * hint of what the intended interpreter was, although this + * will fail if a relative path was used. but in that case, + * absolutize() should help us out below + */ + else if(0 == _NSGetExecutablePath(progpath, &nsexeclength) && progpath[0] == SEP) + ; + #endif // __APPLE__ else if (path) { while (1) { From jackjansen at users.sourceforge.net Thu Jun 3 10:38:41 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 10:38:44 2004 Subject: [Python-checkins] python/dist/src/Modules getpath.c,1.46,1.46.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16081 Modified Files: Tag: release23-maint getpath.c Log Message: Backport of 1.47: Fix for #932977: MacOSX does not pass the whole pathname in argv[0] for #!-scripts, only the filename part, and this can lead to incorrect initialization of sys.path and sys.executable if there is another python on $PATH before the one used in #!. The fix was picked up from the darwinports crowd, thanks! Index: getpath.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/getpath.c,v retrieving revision 1.46 retrieving revision 1.46.14.1 diff -C2 -d -r1.46 -r1.46.14.1 *** getpath.c 31 Dec 2002 12:45:12 -0000 1.46 --- getpath.c 3 Jun 2004 14:38:38 -0000 1.46.14.1 *************** *** 375,378 **** --- 375,381 ---- NSModule pythonModule; #endif + #ifdef __APPLE__ + unsigned long nsexeclength = MAXPATHLEN; + #endif /* If there is no slash in the argv0 path, then we have to *************** *** 383,386 **** --- 386,403 ---- if (strchr(prog, SEP)) strncpy(progpath, prog, MAXPATHLEN); + #ifdef __APPLE__ + /* On Mac OS X, if a script uses an interpreter of the form + * "#!/opt/python2.3/bin/python", the kernel only passes "python" + * as argv[0], which falls through to the $PATH search below. + * If /opt/python2.3/bin isn't in your path, or is near the end, + * this algorithm may incorrectly find /usr/bin/python. To work + * around this, we can use _NSGetExecutablePath to get a better + * hint of what the intended interpreter was, although this + * will fail if a relative path was used. but in that case, + * absolutize() should help us out below + */ + else if(0 == _NSGetExecutablePath(progpath, &nsexeclength) && progpath[0] == SEP) + ; + #endif // __APPLE__ else if (path) { while (1) { From fdrake at users.sourceforge.net Thu Jun 3 12:23:26 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Jun 3 12:23:29 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsocket.tex,1.82,1.83 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7856 Modified Files: libsocket.tex Log Message: avoid backticks in examples; use repr() instead Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** libsocket.tex 5 May 2004 04:18:11 -0000 1.82 --- libsocket.tex 3 Jun 2004 16:23:23 -0000 1.83 *************** *** 715,719 **** data = s.recv(1024) s.close() ! print 'Received', `data` \end{verbatim} --- 715,719 ---- data = s.recv(1024) s.close() ! print 'Received', repr(data) \end{verbatim} *************** *** 791,794 **** data = s.recv(1024) s.close() ! print 'Received', `data` \end{verbatim} --- 791,794 ---- data = s.recv(1024) s.close() ! print 'Received', repr(data) \end{verbatim} From fdrake at users.sourceforge.net Thu Jun 3 13:19:28 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Jun 3 13:19:32 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.233,1.234 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20142 Modified Files: tut.tex Log Message: if we must argue over the/they, we can just remove the unecessary word Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.233 retrieving revision 1.234 diff -C2 -d -r1.233 -r1.234 *** tut.tex 3 Jun 2004 14:13:04 -0000 1.233 --- tut.tex 3 Jun 2004 17:19:25 -0000 1.234 *************** *** 4406,4410 **** expressions are designed for situations where the generator is used right away by an enclosing function. Generator expressions are more compact but ! less versatile than full generator definitions and they tend to be more memory friendly than equivalent list comprehensions. --- 4406,4410 ---- expressions are designed for situations where the generator is used right away by an enclosing function. Generator expressions are more compact but ! less versatile than full generator definitions and tend to be more memory friendly than equivalent list comprehensions. From jackjansen at users.sourceforge.net Thu Jun 3 17:27:18 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 17:27:21 2004 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyEdit.py, 1.45, 1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6614/Mac/Tools/IDE Modified Files: PyEdit.py Log Message: - Fix for #862941: "run with commandline python" crashed. Fixed. - Prefer to use pythonw (if it exists) for "run with commandline python". Index: PyEdit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyEdit.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** PyEdit.py 12 Feb 2004 17:35:13 -0000 1.45 --- PyEdit.py 3 Jun 2004 21:27:15 -0000 1.46 *************** *** 541,545 **** def _run_with_cl_interpreter(self): import Terminal ! interp_path = os.path.join(sys.exec_prefix, "bin", "python") file_path = self.path if not os.path.exists(interp_path): --- 541,548 ---- def _run_with_cl_interpreter(self): import Terminal ! interp_path = os.path.join(sys.exec_prefix, ! "Resources", "Python.app", "Contents", "MacOS", "Python") ! if not os.path.exists(interp_path): ! interp_path = os.path.join(sys.exec_prefix, "bin", "python") file_path = self.path if not os.path.exists(interp_path): *************** *** 548,552 **** cmd = '"%s" "%s" ; exit' % (interp_path, file_path) t = Terminal.Terminal() ! t.do_script(with_command=cmd) def runselection(self): --- 551,555 ---- cmd = '"%s" "%s" ; exit' % (interp_path, file_path) t = Terminal.Terminal() ! t.do_script(cmd) def runselection(self): From jackjansen at users.sourceforge.net Thu Jun 3 17:37:03 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 17:37:08 2004 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyEdit.py, 1.43.8.1, 1.43.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12463 Modified Files: Tag: release23-maint PyEdit.py Log Message: Backport of 1.45 and 1.46: - Replace backticks with repr() or "%r" - Fix for #862941: "run with commandline python" crashed. Fixed. - Prefer to use pythonw (if it exists) for "run with commandline python". Index: PyEdit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyEdit.py,v retrieving revision 1.43.8.1 retrieving revision 1.43.8.2 diff -C2 -d -r1.43.8.1 -r1.43.8.2 *** PyEdit.py 18 Nov 2003 22:46:08 -0000 1.43.8.1 --- PyEdit.py 3 Jun 2004 21:36:58 -0000 1.43.8.2 *************** *** 44,48 **** self.title = title else: ! self.title = "Untitled Script " + `_scriptuntitledcounter` _scriptuntitledcounter = _scriptuntitledcounter + 1 text = "" --- 44,48 ---- self.title = title else: ! self.title = "Untitled Script %r" % (_scriptuntitledcounter,) _scriptuntitledcounter = _scriptuntitledcounter + 1 text = "" *************** *** 445,449 **** code = compile(pytext, filename, "exec") except (SyntaxError, EOFError): ! raise buildtools.BuildError, "Syntax error in script %s" % `filename` import tempfile --- 445,449 ---- code = compile(pytext, filename, "exec") except (SyntaxError, EOFError): ! raise buildtools.BuildError, "Syntax error in script %r" % (filename,) import tempfile *************** *** 541,545 **** def _run_with_cl_interpreter(self): import Terminal ! interp_path = os.path.join(sys.exec_prefix, "bin", "python") file_path = self.path if not os.path.exists(interp_path): --- 541,548 ---- def _run_with_cl_interpreter(self): import Terminal ! interp_path = os.path.join(sys.exec_prefix, ! "Resources", "Python.app", "Contents", "MacOS", "Python") ! if not os.path.exists(interp_path): ! interp_path = os.path.join(sys.exec_prefix, "bin", "python") file_path = self.path if not os.path.exists(interp_path): *************** *** 548,552 **** cmd = '"%s" "%s" ; exit' % (interp_path, file_path) t = Terminal.Terminal() ! t.do_script(with_command=cmd) def runselection(self): --- 551,555 ---- cmd = '"%s" "%s" ; exit' % (interp_path, file_path) t = Terminal.Terminal() ! t.do_script(cmd) def runselection(self): *************** *** 1263,1268 **** self.w.xsizelabel = W.TextBox((98, 32, 40, 14), "Width:") self.w.ysizelabel = W.TextBox((148, 32, 40, 14), "Height:") ! self.w.xsize = W.EditText((98, 48, 40, 20), `self.windowsize[0]`) ! self.w.ysize = W.EditText((148, 48, 40, 20), `self.windowsize[1]`) self.w.cancelbutton = W.Button((-180, -26, 80, 16), "Cancel", self.cancel) --- 1266,1271 ---- self.w.xsizelabel = W.TextBox((98, 32, 40, 14), "Width:") self.w.ysizelabel = W.TextBox((148, 32, 40, 14), "Height:") ! self.w.xsize = W.EditText((98, 48, 40, 20), repr(self.windowsize[0])) ! self.w.ysize = W.EditText((148, 48, 40, 20), repr(self.windowsize[1])) self.w.cancelbutton = W.Button((-180, -26, 80, 16), "Cancel", self.cancel) *************** *** 1277,1282 **** if editor is not None: width, height = editor._parentwindow._bounds[2:] ! self.w.xsize.set(`width`) ! self.w.ysize.set(`height`) else: raise W.AlertError, "No edit window found" --- 1280,1285 ---- if editor is not None: width, height = editor._parentwindow._bounds[2:] ! self.w.xsize.set(repr(width)) ! self.w.ysize.set(repr(height)) else: raise W.AlertError, "No edit window found" From jackjansen at users.sourceforge.net Thu Jun 3 17:55:49 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 17:55:53 2004 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyEdit.py, 1.46, 1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22758 Modified Files: PyEdit.py Log Message: Fix for #860242: use correct names in the "save preferences" dialog. Index: PyEdit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyEdit.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** PyEdit.py 3 Jun 2004 21:27:15 -0000 1.46 --- PyEdit.py 3 Jun 2004 21:55:46 -0000 1.47 *************** *** 776,782 **** radiobuttons = [] w.label = W.TextBox((8, 8, 80, 18), "File creator:") ! w.ide_radio = W.RadioButton((8, 22, 160, 18), "This application", radiobuttons, self.ide_hit) ! w.interp_radio = W.RadioButton((8, 42, 160, 18), "MacPython Interpreter", radiobuttons, self.interp_hit) ! w.interpx_radio = W.RadioButton((8, 62, 160, 18), "OSX PythonW Interpreter", radiobuttons, self.interpx_hit) w.other_radio = W.RadioButton((8, 82, 50, 18), "Other:", radiobuttons) w.other_creator = W.EditText((62, 82, 40, 20), creator, self.otherselect) --- 776,782 ---- radiobuttons = [] w.label = W.TextBox((8, 8, 80, 18), "File creator:") ! w.ide_radio = W.RadioButton((8, 22, 160, 18), "PythonIDE", radiobuttons, self.ide_hit) ! w.interp_radio = W.RadioButton((8, 42, 160, 18), "MacPython-OS9 Interpreter", radiobuttons, self.interp_hit) ! w.interpx_radio = W.RadioButton((8, 62, 160, 18), "PythonLauncher", radiobuttons, self.interpx_hit) w.other_radio = W.RadioButton((8, 82, 50, 18), "Other:", radiobuttons) w.other_creator = W.EditText((62, 82, 40, 20), creator, self.otherselect) From jackjansen at users.sourceforge.net Thu Jun 3 17:57:51 2004 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu Jun 3 17:57:55 2004 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyEdit.py, 1.43.8.2, 1.43.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23588 Modified Files: Tag: release23-maint PyEdit.py Log Message: Backport of 1.47: Fix for #860242: use correct names in the "save preferences" dialog. Index: PyEdit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyEdit.py,v retrieving revision 1.43.8.2 retrieving revision 1.43.8.3 diff -C2 -d -r1.43.8.2 -r1.43.8.3 *** PyEdit.py 3 Jun 2004 21:36:58 -0000 1.43.8.2 --- PyEdit.py 3 Jun 2004 21:57:48 -0000 1.43.8.3 *************** *** 776,782 **** radiobuttons = [] w.label = W.TextBox((8, 8, 80, 18), "File creator:") ! w.ide_radio = W.RadioButton((8, 22, 160, 18), "This application", radiobuttons, self.ide_hit) ! w.interp_radio = W.RadioButton((8, 42, 160, 18), "MacPython Interpreter", radiobuttons, self.interp_hit) ! w.interpx_radio = W.RadioButton((8, 62, 160, 18), "OSX PythonW Interpreter", radiobuttons, self.interpx_hit) w.other_radio = W.RadioButton((8, 82, 50, 18), "Other:", radiobuttons) w.other_creator = W.EditText((62, 82, 40, 20), creator, self.otherselect) --- 776,782 ---- radiobuttons = [] w.label = W.TextBox((8, 8, 80, 18), "File creator:") ! w.ide_radio = W.RadioButton((8, 22, 160, 18), "PythonIDE", radiobuttons, self.ide_hit) ! w.interp_radio = W.RadioButton((8, 42, 160, 18), "MacPython-OS9 Interpreter", radiobuttons, self.interp_hit) ! w.interpx_radio = W.RadioButton((8, 62, 160, 18), "PythonLauncher", radiobuttons, self.interpx_hit) w.other_radio = W.RadioButton((8, 82, 50, 18), "Other:", radiobuttons) w.other_creator = W.EditText((62, 82, 40, 20), creator, self.otherselect) From perky at users.sourceforge.net Thu Jun 3 23:18:14 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Thu Jun 3 23:18:21 2004 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27384/Lib Modified Files: UserString.py Log Message: Add iswide() and width() method for UserString according as the addition to unicode objects. Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** UserString.py 15 Dec 2003 19:46:09 -0000 1.20 --- UserString.py 4 Jun 2004 03:18:11 -0000 1.21 *************** *** 127,130 **** --- 127,134 ---- def zfill(self, width): return self.__class__(self.data.zfill(width)) + # the following methods are defined for unicode objects only: + def iswide(self): return self.data.iswide() + def width(self): return self.data.width() + class MutableString(UserString): """mutable string objects From perky at users.sourceforge.net Thu Jun 3 23:18:14 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Thu Jun 3 23:18:23 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_userstring.py, 1.11, 1.12 string_tests.py, 1.37, 1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27384/Lib/test Modified Files: test_userstring.py string_tests.py Log Message: Add iswide() and width() method for UserString according as the addition to unicode objects. Index: test_userstring.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userstring.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_userstring.py 1 May 2003 17:45:55 -0000 1.11 --- test_userstring.py 4 Jun 2004 03:18:12 -0000 1.12 *************** *** 12,16 **** string_tests.MixinStrUnicodeUserStringTest, string_tests.MixinStrStringUserStringTest, ! string_tests.MixinStrUserStringTest ): --- 12,17 ---- string_tests.MixinStrUnicodeUserStringTest, string_tests.MixinStrStringUserStringTest, ! string_tests.MixinStrUserStringTest, ! string_tests.MixinUnicodeUserStringTest ): Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** string_tests.py 5 Jan 2004 00:29:51 -0000 1.37 --- string_tests.py 4 Jun 2004 03:18:12 -0000 1.38 *************** *** 696,697 **** --- 696,722 ---- self.checkraises(TypeError, 'xyz', 'decode', 42) self.checkraises(TypeError, 'xyz', 'encode', 42) + + + class MixinUnicodeUserStringTest: + # Additional tests that only work with + # unicode compatible object, i.e. unicode and UserString + + def test_iswide(self): + self.checkequal(False, u'', 'iswide') + self.checkequal(False, u'\x1f', 'iswide') # Neutral + self.checkequal(False, u'\x20', 'iswide') # Narrow + self.checkequal(True, u'\u2329', 'iswide') # Wide + self.checkequal(False, u'\uff64', 'iswide') # Half + self.checkequal(True, u'\u3000', 'iswide') # Full + self.checkequal(False, u'\u2460', 'iswide') # Ambiguous + self.checkequal(True, u'\ud55c\uae00', 'iswide') + self.checkequal(False, u'\ud55c\u2606\uae00', 'iswide') + + def test_width(self): + self.checkequal(0, u'', 'width') + self.checkequal(4, u'abcd', 'width') + self.checkequal(2, u'\u0187\u01c9', 'width') + self.checkequal(3, u'\u2460\u2329', 'width') + self.checkequal(3, u'\u2329\u2460', 'width') + self.checkequal(4, u'\ud55c\uae00', 'width') + self.checkequal(5, u'\ud55c\u2606\uae00', 'width') From perky at users.sourceforge.net Thu Jun 3 23:19:20 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Thu Jun 3 23:19:24 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py, 1.88, 1.89 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28106/Lib/test Modified Files: test_unicode.py Log Message: Fix typo. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** test_unicode.py 2 Jun 2004 16:49:09 -0000 1.88 --- test_unicode.py 4 Jun 2004 03:19:17 -0000 1.89 *************** *** 303,307 **** self.checkequalnofix(False, u'\ud55c\u2606\uae00', 'iswide') ! def test_wide(self): self.assertEqual(u''.width(), 0) self.assertEqual(u'abcd'.width(), 4) --- 303,307 ---- self.checkequalnofix(False, u'\ud55c\u2606\uae00', 'iswide') ! def test_width(self): self.assertEqual(u''.width(), 0) self.assertEqual(u'abcd'.width(), 4) From perky at users.sourceforge.net Fri Jun 4 00:23:32 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Fri Jun 4 00:23:37 2004 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4983/Lib Modified Files: UserString.py Log Message: Add comments for unicode-only methods to give hints on AttributeError tracebacks. (Suggested by Walter Dörwald) Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** UserString.py 4 Jun 2004 03:18:11 -0000 1.21 --- UserString.py 4 Jun 2004 04:23:29 -0000 1.22 *************** *** 128,133 **** # the following methods are defined for unicode objects only: ! def iswide(self): return self.data.iswide() ! def width(self): return self.data.width() class MutableString(UserString): --- 128,133 ---- # the following methods are defined for unicode objects only: ! def iswide(self): return self.data.iswide() # unicode only ! def width(self): return self.data.width() # unicode only class MutableString(UserString): From perky at users.sourceforge.net Fri Jun 4 00:24:56 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Fri Jun 4 00:25:01 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py, 1.89, 1.90 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5223/Lib/test Modified Files: test_unicode.py Log Message: Reuse width/iswide tests from strings_test. (Suggested by Walter Dörwald) Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.89 retrieving revision 1.90 diff -C2 -d -r1.89 -r1.90 *** test_unicode.py 4 Jun 2004 03:19:17 -0000 1.89 --- test_unicode.py 4 Jun 2004 04:24:54 -0000 1.90 *************** *** 12,16 **** class UnicodeTest( string_tests.CommonTest, ! string_tests.MixinStrUnicodeUserStringTest ): type2test = unicode --- 12,17 ---- class UnicodeTest( string_tests.CommonTest, ! string_tests.MixinStrUnicodeUserStringTest, ! string_tests.MixinUnicodeUserStringTest ): type2test = unicode *************** *** 292,315 **** self.assertRaises(TypeError, u"abc".isnumeric, 42) - def test_iswide(self): - self.checkequalnofix(False, u'', 'iswide') - self.checkequalnofix(False, u'\x1f', 'iswide') # Neutral - self.checkequalnofix(False, u'\x20', 'iswide') # Narrow - self.checkequalnofix(True, u'\u2329', 'iswide') # Wide - self.checkequalnofix(False, u'\uff64', 'iswide') # Half - self.checkequalnofix(True, u'\u3000', 'iswide') # Full - self.checkequalnofix(False, u'\u2460', 'iswide') # Ambiguous - self.checkequalnofix(True, u'\ud55c\uae00', 'iswide') - self.checkequalnofix(False, u'\ud55c\u2606\uae00', 'iswide') - - def test_width(self): - self.assertEqual(u''.width(), 0) - self.assertEqual(u'abcd'.width(), 4) - self.assertEqual(u'\u0187\u01c9'.width(), 2) - self.assertEqual(u'\u2460\u2329'.width(), 3) - self.assertEqual(u'\u2329\u2460'.width(), 3) - self.assertEqual(u'\ud55c\uae00'.width(), 4) - self.assertEqual(u'\ud55c\u2606\uae00'.width(), 5) - def test_contains(self): # Testing Unicode contains method --- 293,296 ---- From rhettinger at users.sourceforge.net Fri Jun 4 02:31:10 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Jun 4 02:31:15 2004 Subject: [Python-checkins] python/dist/src/Lib/idlelib FormatParagraph.py, 1.5, 1.6 config-main.def, 1.20, 1.21 configDialog.py, 1.58, 1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24185 Modified Files: FormatParagraph.py config-main.def configDialog.py Log Message: SF patch #961387: Make IDLE's paragraph reformatting width configurable Index: FormatParagraph.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/FormatParagraph.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FormatParagraph.py 16 Sep 2002 02:22:19 -0000 1.5 --- FormatParagraph.py 4 Jun 2004 06:31:08 -0000 1.6 *************** *** 16,19 **** --- 16,20 ---- import re + from configHandler import idleConf class FormatParagraph: *************** *** 32,35 **** --- 33,37 ---- def format_paragraph_event(self, event): + maxformatwidth = int(idleConf.GetOption('main','FormatParagraph','paragraph')) text = self.editwin.text first, last = self.editwin.get_selection_indices() *************** *** 45,50 **** lines = map(lambda st, l=len(comment_header): st[l:], lines) data = "\n".join(lines) ! # Reformat to 70 chars or a 20 char width, whichever is greater. ! format_width = max(70-len(comment_header), 20) newdata = reformat_paragraph(data, format_width) # re-split and re-insert the comment header. --- 47,52 ---- lines = map(lambda st, l=len(comment_header): st[l:], lines) data = "\n".join(lines) ! # Reformat to maxformatwidth chars or a 20 char width, whichever is greater. ! format_width = max(maxformatwidth, len(comment_header), 20) newdata = reformat_paragraph(data, format_width) # re-split and re-insert the comment header. *************** *** 63,67 **** else: # Just a normal text format ! newdata = reformat_paragraph(data) text.tag_remove("sel", "1.0", "end") if newdata != data: --- 65,69 ---- else: # Just a normal text format ! newdata = reformat_paragraph(data, maxformatwidth) text.tag_remove("sel", "1.0", "end") if newdata != data: *************** *** 100,104 **** return first, last, comment_header, text.get(first, last) ! def reformat_paragraph(data, limit=70): lines = data.split("\n") i = 0 --- 102,106 ---- return first, last, comment_header, text.get(first, last) ! def reformat_paragraph(data, limit): lines = data.split("\n") i = 0 Index: config-main.def =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/config-main.def,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** config-main.def 9 Aug 2003 01:51:28 -0000 1.20 --- config-main.def 4 Jun 2004 06:31:08 -0000 1.21 *************** *** 59,62 **** --- 59,65 ---- encoding= none + [FormatParagraph] + paragraph=70 + [Indent] use-spaces= 1 Index: configDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/configDialog.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** configDialog.py 11 Apr 2004 03:16:07 -0000 1.58 --- configDialog.py 4 Jun 2004 06:31:08 -0000 1.59 *************** *** 338,341 **** --- 338,342 ---- self.winWidth=StringVar(self) self.winHeight=StringVar(self) + self.paraWidth=StringVar(self) self.startupEdit=IntVar(self) self.autoSave=IntVar(self) *************** *** 350,353 **** --- 351,355 ---- frameSave=Frame(frame,borderwidth=2,relief=GROOVE) frameWinSize=Frame(frame,borderwidth=2,relief=GROOVE) + frameParaSize=Frame(frame,borderwidth=2,relief=GROOVE) frameEncoding=Frame(frame,borderwidth=2,relief=GROOVE) frameHelp=Frame(frame,borderwidth=2,relief=GROOVE) *************** *** 375,378 **** --- 377,385 ---- entryWinHeight=Entry(frameWinSize,textvariable=self.winHeight, width=3) + #paragraphFormatWidth + labelParaWidthTitle=Label(frameParaSize,text='Paragraph reformat'+ + ' width (in characters)') + entryParaWidth=Entry(frameParaSize,textvariable=self.paraWidth, + width=3) #frameEncoding labelEncodingTitle=Label(frameEncoding,text="Default Source Encoding") *************** *** 412,415 **** --- 419,423 ---- frameSave.pack(side=TOP,padx=5,pady=5,fill=X) frameWinSize.pack(side=TOP,padx=5,pady=5,fill=X) + frameParaSize.pack(side=TOP,padx=5,pady=5,fill=X) frameEncoding.pack(side=TOP,padx=5,pady=5,fill=X) frameHelp.pack(side=TOP,padx=5,pady=5,expand=TRUE,fill=BOTH) *************** *** 430,433 **** --- 438,444 ---- entryWinWidth.pack(side=RIGHT,anchor=E,padx=10,pady=5) labelWinWidthTitle.pack(side=RIGHT,anchor=E,pady=5) + #paragraphFormatWidth + labelParaWidthTitle.pack(side=LEFT,anchor=W,padx=5,pady=5) + entryParaWidth.pack(side=RIGHT,anchor=E,padx=10,pady=5) #frameEncoding labelEncodingTitle.pack(side=LEFT,anchor=W,padx=5,pady=5) *************** *** 467,470 **** --- 478,482 ---- self.winWidth.trace_variable('w',self.VarChanged_winWidth) self.winHeight.trace_variable('w',self.VarChanged_winHeight) + self.paraWidth.trace_variable('w',self.VarChanged_paraWidth) self.startupEdit.trace_variable('w',self.VarChanged_startupEdit) self.autoSave.trace_variable('w',self.VarChanged_autoSave) *************** *** 559,562 **** --- 571,578 ---- self.AddChangedItem('main','EditorWindow','height',value) + def VarChanged_paraWidth(self,*params): + value=self.paraWidth.get() + self.AddChangedItem('main','FormatParagraph','paragraph',value) + def VarChanged_startupEdit(self,*params): value=self.startupEdit.get() *************** *** 1071,1074 **** --- 1087,1092 ---- self.winWidth.set(idleConf.GetOption('main','EditorWindow','width')) self.winHeight.set(idleConf.GetOption('main','EditorWindow','height')) + #initial paragraph reformat size + self.paraWidth.set(idleConf.GetOption('main','FormatParagraph','paragraph')) # default source encoding self.encoding.set(idleConf.GetOption('main', 'EditorWindow', From rhettinger at users.sourceforge.net Fri Jun 4 02:35:35 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Jun 4 02:35:40 2004 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c,2.91,2.92 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24517 Modified Files: tupleobject.c Log Message: Replaced arbitrary addend in tuple_hash with one that is known to generate many more prime multipliers and that performs well on collision tests. Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.91 retrieving revision 2.92 diff -C2 -d -r2.91 -r2.92 *** tupleobject.c 1 Jun 2004 06:36:24 -0000 2.91 --- tupleobject.c 4 Jun 2004 06:35:20 -0000 2.92 *************** *** 257,260 **** --- 257,268 ---- } + /* The addend 82520, was selected from the range(0, 1000000) for + generating the greatest number of prime multipliers for tuples + upto length eight: + + 1082527, 1165049, 1082531, 1165057, 1247581, 1330103, 1082533, + 1330111, 1412633, 1165069, 1247599, 1495177, 1577699 + */ + static long tuplehash(PyTupleObject *v) *************** *** 271,275 **** return -1; x = (x ^ y) * mult; ! mult += 69068L + len + len; } if (x == -1) --- 279,283 ---- return -1; x = (x ^ y) * mult; ! mult += 82520L + len + len; } if (x == -1) From perky at users.sourceforge.net Fri Jun 4 05:33:20 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Fri Jun 4 05:33:27 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.53, 1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27531 Modified Files: whatsnew24.tex Log Message: SF #966375: Fix typo (Reported by Kristian Ovaska) Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** whatsnew24.tex 3 Jun 2004 13:56:05 -0000 1.53 --- whatsnew24.tex 4 Jun 2004 09:33:18 -0000 1.54 *************** *** 96,100 **** expressions are designed for situations where the generator is used right away by an enclosing function. Generator expressions are more compact but ! less versatile than full generator definitions and the tend to be more memory friendly than equivalent list comprehensions. --- 96,100 ---- expressions are designed for situations where the generator is used right away by an enclosing function. Generator expressions are more compact but ! less versatile than full generator definitions and they tend to be more memory friendly than equivalent list comprehensions. From loewis at users.sourceforge.net Fri Jun 4 09:55:15 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri Jun 4 09:55:19 2004 Subject: [Python-checkins] python/dist/src setup.py,1.187,1.188 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15999 Modified Files: setup.py Log Message: Patch #926209: Patch to setup.py to run on x86_64 Linux. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.187 retrieving revision 1.188 diff -C2 -d -r1.187 -r1.188 *** setup.py 2 Jun 2004 17:42:55 -0000 1.187 --- setup.py 4 Jun 2004 13:55:13 -0000 1.188 *************** *** 265,269 **** # if a file is found in one of those directories, it can # be assumed that no additional -I,-L directives are needed. ! lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib'] inc_dirs = self.compiler.include_dirs + ['/usr/include'] exts = [] --- 265,269 ---- # if a file is found in one of those directories, it can # be assumed that no additional -I,-L directives are needed. ! lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib', '/usr/lib/lib64'] inc_dirs = self.compiler.include_dirs + ['/usr/include'] exts = [] From loewis at users.sourceforge.net Fri Jun 4 09:55:16 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri Jun 4 09:55:22 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.988,1.989 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15999/Misc Modified Files: NEWS Log Message: Patch #926209: Patch to setup.py to run on x86_64 Linux. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.988 retrieving revision 1.989 diff -C2 -d -r1.988 -r1.989 *** NEWS 3 Jun 2004 12:47:25 -0000 1.988 --- NEWS 4 Jun 2004 13:55:13 -0000 1.989 *************** *** 486,489 **** --- 486,492 ---- ----- + - In order to find libraries, setup.py now also looks in /lib64, for use + on AMD64. + - Bug #934635: Fixed a bug where the configure script couldn't detect getaddrinfo() properly if the KAME stack had SCTP support. From theller at users.sourceforge.net Fri Jun 4 12:13:09 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Fri Jun 4 12:13:14 2004 Subject: [Python-checkins] python/dist/src/Lib dis.py,1.46,1.46.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17273 Modified Files: Tag: release23-maint dis.py Log Message: Partial backport (only the bugfix) of sf #811294: dis.disassemble_string() broken. Index: dis.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dis.py,v retrieving revision 1.46 retrieving revision 1.46.10.1 diff -C2 -d -r1.46 -r1.46.10.1 *** dis.py 7 Mar 2003 17:30:45 -0000 1.46 --- dis.py 4 Jun 2004 16:13:06 -0000 1.46.10.1 *************** *** 138,143 **** c = code[i] op = ord(c) - if op == opmap['SET_LINENO'] and i > 0: - print # Extra blank line if i == lasti: print '-->', else: print ' ', --- 138,141 ---- From zlnvingnwhkhii at citiz.net Fri Jun 4 18:14:30 2004 From: zlnvingnwhkhii at citiz.net (Low Interest) Date: Fri Jun 4 17:16:43 2004 Subject: [Python-checkins] Reduce monthly-payments Python-announce tape recorder 400 philosophersplanetesimal Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040605/4849d6d0/attachment.html From bcannon at users.sourceforge.net Fri Jun 4 21:12:53 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri Jun 4 21:12:59 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_site.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10131/Lib/test Added Files: test_site.py Log Message: Refactored site.py into functions. Also moved over to using sets. New regression test suite. --- NEW FILE: test_site.py --- """Tests for 'site'. Tests assume the initial paths in sys.path once the interpreter has begun executing have not been removed. """ import unittest from test.test_support import TestSkipped, run_unittest, TESTFN import __builtin__ import os import sys import encodings import tempfile # Need to make sure to not import 'site' if someone specified ``-S`` at the # command-line. Detect this by just making sure 'site' has not been imported # already. if "site" in sys.modules: import site else: raise TestSkipped("importation of site.py suppressed") class HelperFunctionsTests(unittest.TestCase): """Tests for helper functions. The setting of the encoding (set using sys.setdefaultencoding) used by the Unicode implementation is not tested. """ def setUp(self): """Save a copy of sys.path""" self.sys_path = sys.path[:] def tearDown(self): """Restore sys.path""" sys.path = self.sys_path def test_makepath(self): # Test makepath() have an absolute path for its first return value # and a case-normalized version of the absolute path for its # second value. path_parts = ("Beginning", "End") original_dir = os.path.join(*path_parts) abs_dir, norm_dir = site.makepath(*path_parts) self.failUnlessEqual(os.path.abspath(original_dir), abs_dir) if original_dir == os.path.normcase(original_dir): self.failUnlessEqual(abs_dir, norm_dir) else: self.failUnlessEqual(os.path.normcase(abs_dir), norm_dir) def test_init_pathinfo(self): dir_set = site._init_pathinfo() for entry in [site.makepath(path)[1] for path in sys.path if path and os.path.isdir(path)]: self.failUnless(entry in dir_set, "%s from sys.path not found in set returned " "by _init_pathinfo(): %s" % (entry, dir_set)) def test_addpackage(self): # Make sure addpackage() imports if the line starts with 'import', # otherwise add a directory combined from sitedir and 'name'. # Must also skip comment lines. dir_path, file_name, new_dir = createpth() try: site.addpackage(dir_path, file_name, set()) self.failUnless(site.makepath(os.path.join(dir_path, new_dir))[0] in sys.path) finally: cleanuppth(dir_path, file_name, new_dir) def test_addsitedir(self): dir_path, file_name, new_dir = createpth() try: site.addsitedir(dir_path, set()) self.failUnless(site.makepath(os.path.join(dir_path, new_dir))[0] in sys.path) finally: cleanuppth(dir_path, file_name, new_dir) def createpth(): """Create a temporary .pth file at the returned location and return the directory where it was created, the pth file name, and the directory specified in the pth file. Make sure to delete the file when finished. """ pth_dirname = "__testdir__" file_name = TESTFN + ".pth" full_dirname = os.path.dirname(os.path.abspath(file_name)) FILE = file(os.path.join(full_dirname, file_name), 'w') try: print>>FILE, "#import @bad module name" print>>FILE, '' print>>FILE, "import os" print>>FILE, pth_dirname finally: FILE.close() os.mkdir(os.path.join(full_dirname, pth_dirname)) return full_dirname, file_name, pth_dirname def cleanuppth(full_dirname, file_name, pth_dirname): """Clean up what createpth() made""" os.remove(os.path.join(full_dirname, file_name)) os.rmdir(os.path.join(full_dirname, pth_dirname)) class ImportSideEffectTests(unittest.TestCase): """Test side-effects from importing 'site'.""" def setUp(self): """Make a copy of sys.path""" self.sys_path = sys.path[:] def tearDown(self): """Restore sys.path""" sys.path = self.sys_path def test_abs__file__(self): # Make sure all imported modules have their __file__ attribute # as an absolute path. # Handled by abs__file__() site.abs__file__() for module in sys.modules.values(): try: self.failUnless(os.path.isabs(module.__file__)) except AttributeError: continue def test_no_duplicate_paths(self): # No duplicate paths should exist in sys.path # Handled by removeduppaths() site.removeduppaths() seen_paths = set() for path in sys.path: self.failUnless(path not in seen_paths) seen_paths.add(path) def test_add_build_dir(self): # Test that the build directory's Modules directory is used when it # should be. # XXX: implement pass def test_sitepackages(self): # There should be a path that ends in site-packages for path in sys.path: if path.endswith("site-packages"): break else: self.fail("'site-packages' directory missing'") def test_setting_quit(self): # 'quit' and 'exit' should be injected into __builtin__ self.failUnless(hasattr(__builtin__, "quit")) self.failUnless(hasattr(__builtin__, "exit")) def test_setting_copyright(self): # 'copyright' and 'credits' should be in __builtin__ self.failUnless(hasattr(__builtin__, "copyright")) self.failUnless(hasattr(__builtin__, "credits")) def test_setting_help(self): # 'help' should be set in __builtin__ self.failUnless(hasattr(__builtin__, "help")) def test_aliasing_mbcs(self): if sys.platform == "win32": import locale if locale.getdefaultlocale()[1].startswith('cp'): for value in encodings.aliases.aliases.itervalues(): if value == "mbcs": break else: self.fail("did not alias mbcs") def test_setdefaultencoding_removed(self): # Make sure sys.setdefaultencoding is gone self.failUnless(not hasattr(sys, "setdefaultencoding")) def test_sitecustomize_executed(self): # If sitecustomize is available, it should have been imported. if not sys.modules.has_key("sitecustomize"): try: import sitecustomize except ImportError: pass else: self.fail("sitecustomize not imported automatically") def test_main(): run_unittest(HelperFunctionsTests, ImportSideEffectTests) if __name__ == "__main__": test_main() From bcannon at users.sourceforge.net Fri Jun 4 21:12:53 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri Jun 4 21:13:02 2004 Subject: [Python-checkins] python/dist/src/Lib site.py,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10131/Lib Modified Files: site.py Log Message: Refactored site.py into functions. Also moved over to using sets. New regression test suite. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** site.py 21 Mar 2004 14:06:49 -0000 1.60 --- site.py 5 Jun 2004 01:12:51 -0000 1.61 *************** *** 58,62 **** """ ! import sys, os --- 58,64 ---- """ ! import sys ! import os ! import __builtin__ *************** *** 65,203 **** return dir, os.path.normcase(dir) ! for m in sys.modules.values(): ! if hasattr(m, "__file__") and m.__file__: ! m.__file__ = os.path.abspath(m.__file__) ! del m ! # This ensures that the initial path provided by the interpreter contains ! # only absolute pathnames, even if we're running from the build directory. ! L = [] ! _dirs_in_sys_path = {} ! dir = dircase = None # sys.path may be empty at this point ! for dir in sys.path: ! # Filter out duplicate paths (on case-insensitive file systems also ! # if they only differ in case); turn relative paths into absolute ! # paths. ! dir, dircase = makepath(dir) ! if not dircase in _dirs_in_sys_path: ! L.append(dir) ! _dirs_in_sys_path[dircase] = 1 ! sys.path[:] = L ! del dir, dircase, L - # Append ./build/lib. in case we're running in the build dir - # (especially for Guido :-) # XXX This should not be part of site.py, since it is needed even when # using the -S option for Python. See http://www.python.org/sf/586680 ! if (os.name == "posix" and sys.path and ! os.path.basename(sys.path[-1]) == "Modules"): from distutils.util import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version) s = os.path.join(os.path.dirname(sys.path[-1]), s) sys.path.append(s) - del get_platform, s def _init_pathinfo(): ! global _dirs_in_sys_path ! _dirs_in_sys_path = d = {} for dir in sys.path: ! if dir and not os.path.isdir(dir): continue ! dir, dircase = makepath(dir) ! d[dircase] = 1 ! def addsitedir(sitedir): ! global _dirs_in_sys_path ! if _dirs_in_sys_path is None: _init_pathinfo() reset = 1 else: reset = 0 ! sitedir, sitedircase = makepath(sitedir) ! if not sitedircase in _dirs_in_sys_path: ! sys.path.append(sitedir) # Add path component try: ! names = os.listdir(sitedir) ! except os.error: return ! names.sort() ! for name in names: ! if name[-4:] == os.extsep + "pth": ! addpackage(sitedir, name) if reset: ! _dirs_in_sys_path = None ! def addpackage(sitedir, name): ! global _dirs_in_sys_path ! if _dirs_in_sys_path is None: ! _init_pathinfo() reset = 1 else: reset = 0 ! fullname = os.path.join(sitedir, name) try: ! f = open(fullname) ! except IOError: return ! while 1: ! dir = f.readline() ! if not dir: ! break ! if dir[0] == '#': ! continue ! if dir.startswith("import"): ! exec dir ! continue ! dir = dir.rstrip() ! dir, dircase = makepath(sitedir, dir) ! if not dircase in _dirs_in_sys_path and os.path.exists(dir): ! sys.path.append(dir) ! _dirs_in_sys_path[dircase] = 1 if reset: ! _dirs_in_sys_path = None ! ! prefixes = [sys.prefix] ! sitedir = None # make sure sitedir is initialized because of later 'del' ! if sys.exec_prefix != sys.prefix: ! prefixes.append(sys.exec_prefix) ! for prefix in prefixes: ! if prefix: ! if sys.platform in ('os2emx', 'riscos'): ! sitedirs = [os.path.join(prefix, "Lib", "site-packages")] ! elif os.sep == '/': ! sitedirs = [os.path.join(prefix, ! "lib", ! "python" + sys.version[:3], ! "site-packages"), ! os.path.join(prefix, "lib", "site-python")] ! else: ! sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")] ! if sys.platform == 'darwin': ! # for framework builds *only* we add the standard Apple ! # locations. Currently only per-user, but /Library and ! # /Network/Library could be added too ! if 'Python.framework' in prefix: ! home = os.environ.get('HOME') ! if home: ! sitedirs.append( ! os.path.join(home, ! 'Library', ! 'Python', ! sys.version[:3], ! 'site-packages')) ! for sitedir in sitedirs: ! if os.path.isdir(sitedir): ! addsitedir(sitedir) ! del prefix, sitedir ! _dirs_in_sys_path = None ! # the OS/2 EMX port has optional extension modules that do double duty ! # as DLLs (and must use the .DLL file extension) for other extensions. ! # The library search path needs to be amended so these will be found ! # during module import. Use BEGINLIBPATH so that these are at the start ! # of the library search path. ! if sys.platform == 'os2emx': dllpath = os.path.join(sys.prefix, "Lib", "lib-dynload") libpath = os.environ['BEGINLIBPATH'].split(';') --- 67,216 ---- return dir, os.path.normcase(dir) ! def abs__file__(): ! """Set all module' __file__ attribute to an absolute path""" ! for m in sys.modules.values(): ! try: ! m.__file__ = os.path.abspath(m.__file__) ! except AttributeError: ! continue ! def removeduppaths(): ! """ Remove duplicate entries from sys.path along with making them ! absolute""" ! # This ensures that the initial path provided by the interpreter contains ! # only absolute pathnames, even if we're running from the build directory. ! L = [] ! known_paths = set() ! for dir in sys.path: ! # Filter out duplicate paths (on case-insensitive file systems also ! # if they only differ in case); turn relative paths into absolute ! # paths. ! dir, dircase = makepath(dir) ! if not dircase in known_paths: ! L.append(dir) ! known_paths.add(dircase) ! sys.path[:] = L ! return known_paths # XXX This should not be part of site.py, since it is needed even when # using the -S option for Python. See http://www.python.org/sf/586680 ! def addbuilddir(): ! """Append ./build/lib. in case we're running in the build dir ! (especially for Guido :-)""" from distutils.util import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version) s = os.path.join(os.path.dirname(sys.path[-1]), s) sys.path.append(s) def _init_pathinfo(): ! """Return a set containing all existing directory entries from sys.path""" ! d = set() for dir in sys.path: ! try: ! if os.path.isdir(dir): ! dir, dircase = makepath(dir) ! d.add(dircase) ! except TypeError: continue ! return d ! def addpackage(sitedir, name, known_paths): ! """Add a new path to known_paths by combining sitedir and 'name' or execute ! sitedir if it starts with 'import'""" ! if known_paths is None: _init_pathinfo() reset = 1 else: reset = 0 ! fullname = os.path.join(sitedir, name) try: ! f = file(fullname, "rU") ! except IOError: return ! try: ! for line in f: ! if line.startswith("#"): ! continue ! if line.startswith("import"): ! exec line ! continue ! line = line.rstrip() ! dir, dircase = makepath(sitedir, line) ! if not dircase in known_paths and os.path.exists(dir): ! sys.path.append(dir) ! known_paths.add(dircase) ! finally: ! f.close() if reset: ! known_paths = None ! return known_paths ! def addsitedir(sitedir, known_paths): ! """Add 'sitedir' argument to sys.path if missing and handle .pth files in ! 'sitedir'""" ! if known_paths is None: ! d = _init_pathinfo() reset = 1 else: reset = 0 ! sitedir, sitedircase = makepath(sitedir) ! if not sitedircase in known_paths: ! sys.path.append(sitedir) # Add path component try: ! names = os.listdir(sitedir) ! except os.error: return ! names.sort() ! for name in names: ! if name[-4:] == os.extsep + "pth": ! addpackage(sitedir, name, known_paths) if reset: ! known_paths = None ! return known_paths ! def addsitepackages(known_paths): ! """Add site-packages (and possibly site-python) to sys.path""" ! prefixes = [sys.prefix] ! if sys.exec_prefix != sys.prefix: ! prefixes.append(sys.exec_prefix) ! for prefix in prefixes: ! if prefix: ! if sys.platform in ('os2emx', 'riscos'): ! sitedirs = [os.path.join(prefix, "Lib", "site-packages")] ! elif os.sep == '/': ! sitedirs = [os.path.join(prefix, ! "lib", ! "python" + sys.version[:3], ! "site-packages"), ! os.path.join(prefix, "lib", "site-python")] ! else: ! sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")] ! if sys.platform == 'darwin': ! # for framework builds *only* we add the standard Apple ! # locations. Currently only per-user, but /Library and ! # /Network/Library could be added too ! if 'Python.framework' in prefix: ! home = os.environ.get('HOME') ! if home: ! sitedirs.append( ! os.path.join(home, ! 'Library', ! 'Python', ! sys.version[:3], ! 'site-packages')) ! for sitedir in sitedirs: ! if os.path.isdir(sitedir): ! addsitedir(sitedir, known_paths) ! return None ! def setBEGINLIBPATH(): ! """The OS/2 EMX port has optional extension modules that do double duty ! as DLLs (and must use the .DLL file extension) for other extensions. ! The library search path needs to be amended so these will be found ! during module import. Use BEGINLIBPATH so that these are at the start ! of the library search path. ! ! """ dllpath = os.path.join(sys.prefix, "Lib", "lib-dynload") libpath = os.environ['BEGINLIBPATH'].split(';') *************** *** 209,227 **** ! # Define new built-ins 'quit' and 'exit'. ! # These are simply strings that display a hint on how to exit. ! if os.sep == ':': ! exit = 'Use Cmd-Q to quit.' ! elif os.sep == '\\': ! exit = 'Use Ctrl-Z plus Return to exit.' ! else: ! exit = 'Use Ctrl-D (i.e. EOF) to exit.' ! import __builtin__ ! __builtin__.quit = __builtin__.exit = exit ! del exit - # interactive prompt objects for printing the license text, a list of - # contributors and the copyright notice. - class _Printer: MAXLINES = 23 --- 222,243 ---- ! def setquit(): ! """Define new built-ins 'quit' and 'exit'. ! These are simply strings that display a hint on how to exit. ! ! """ ! if os.sep == ':': ! exit = 'Use Cmd-Q to quit.' ! elif os.sep == '\\': ! exit = 'Use Ctrl-Z plus Return to exit.' ! else: ! exit = 'Use Ctrl-D (i.e. EOF) to exit.' ! __builtin__.quit = __builtin__.exit = exit ! ! ! class _Printer(object): ! """interactive prompt objects for printing the license text, a list of ! contributors and the copyright notice.""" MAXLINES = 23 *************** *** 238,245 **** data = None for dir in self.__dirs: ! for file in self.__files: ! file = os.path.join(dir, file) try: ! fp = open(file) data = fp.read() fp.close() --- 254,261 ---- data = None for dir in self.__dirs: ! for filename in self.__files: ! filename = os.path.join(dir, filename) try: ! fp = file(filename, "rU") data = fp.read() fp.close() *************** *** 281,304 **** break ! __builtin__.copyright = _Printer("copyright", sys.copyright) ! if sys.platform[:4] == 'java': ! __builtin__.credits = _Printer( ! "credits", ! "Jython is maintained by the Jython developers (www.jython.org).") ! else: ! __builtin__.credits = _Printer("credits", """\ ! Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands ! for supporting Python development. See www.python.org for more information.""") ! here = os.path.dirname(os.__file__) ! __builtin__.license = _Printer( ! "license", "See http://www.python.org/%.3s/license.html" % sys.version, ! ["LICENSE.txt", "LICENSE"], ! [os.path.join(here, os.pardir), here, os.curdir]) ! # Define new built-in 'help'. ! # This is a wrapper around pydoc.help (with a twist). - class _Helper: def __repr__(self): return "Type help() for interactive help, " \ --- 297,324 ---- break ! def setcopyright(): ! """Set 'copyright' and 'credits' in __builtin__""" ! __builtin__.copyright = _Printer("copyright", sys.copyright) ! if sys.platform[:4] == 'java': ! __builtin__.credits = _Printer( ! "credits", ! "Jython is maintained by the Jython developers (www.jython.org).") ! else: ! __builtin__.credits = _Printer("credits", """\ ! Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands ! for supporting Python development. See www.python.org for more information.""") ! here = os.path.dirname(os.__file__) ! __builtin__.license = _Printer( ! "license", "See http://www.python.org/%.3s/license.html" % sys.version, ! ["LICENSE.txt", "LICENSE"], ! [os.path.join(here, os.pardir), here, os.curdir]) ! class _Helper(object): ! """Define the built-in 'help'. ! This is a wrapper around pydoc.help (with a twist). ! ! """ def __repr__(self): return "Type help() for interactive help, " \ *************** *** 308,366 **** return pydoc.help(*args, **kwds) ! __builtin__.help = _Helper() ! ! ! # On Windows, some default encodings are not provided by Python, ! # while they are always available as "mbcs" in each locale. Make ! # them usable by aliasing to "mbcs" in such a case. ! ! if sys.platform == 'win32': ! import locale, codecs ! enc = locale.getdefaultlocale()[1] ! if enc.startswith('cp'): # "cp***" ? ! try: ! codecs.lookup(enc) ! except LookupError: ! import encodings ! encodings._cache[enc] = encodings._unknown ! encodings.aliases.aliases[enc] = 'mbcs' ! # Set the string encoding used by the Unicode implementation. The ! # default is 'ascii', but if you're willing to experiment, you can ! # change this. ! encoding = "ascii" # Default value set by _PyUnicode_Init() - if 0: - # Enable to support locale aware default string encodings. - import locale - loc = locale.getdefaultlocale() - if loc[1]: - encoding = loc[1] ! if 0: ! # Enable to switch off string to Unicode coercion and implicit ! # Unicode to string conversion. ! encoding = "undefined" - if encoding != "ascii": - # On Non-Unicode builds this will raise an AttributeError... - sys.setdefaultencoding(encoding) # Needs Python Unicode build ! ! # ! # Run custom site specific code, if available. ! # ! try: ! import sitecustomize ! except ImportError: ! pass ! # ! # Remove sys.setdefaultencoding() so that users cannot change the ! # encoding after initialization. The test for presence is needed when ! # this module is run as a script, because this code is executed twice. ! # ! if hasattr(sys, "setdefaultencoding"): ! del sys.setdefaultencoding def _test(): --- 328,399 ---- return pydoc.help(*args, **kwds) ! def sethelper(): ! __builtin__.help = _Helper() ! def aliasmbcs(): ! """On Windows, some default encodings are not provided by Python, ! while they are always available as "mbcs" in each locale. Make ! them usable by aliasing to "mbcs" in such a case.""" ! if sys.platform == 'win32': ! import locale, codecs ! enc = locale.getdefaultlocale()[1] ! if enc.startswith('cp'): # "cp***" ? ! try: ! codecs.lookup(enc) ! except LookupError: ! import encodings ! encodings._cache[enc] = encodings._unknown ! encodings.aliases.aliases[enc] = 'mbcs' ! def setencoding(): ! """Set the string encoding used by the Unicode implementation. The ! default is 'ascii', but if you're willing to experiment, you can ! change this.""" ! encoding = "ascii" # Default value set by _PyUnicode_Init() ! if 0: ! # Enable to support locale aware default string encodings. ! import locale ! loc = locale.getdefaultlocale() ! if loc[1]: ! encoding = loc[1] ! if 0: ! # Enable to switch off string to Unicode coercion and implicit ! # Unicode to string conversion. ! encoding = "undefined" ! if encoding != "ascii": ! # On Non-Unicode builds this will raise an AttributeError... ! sys.setdefaultencoding(encoding) # Needs Python Unicode build ! ! def execsitecustomize(): ! """Run custom site specific code, if available.""" ! try: ! import sitecustomize ! except ImportError: ! pass ! def main(): ! abs__file__() ! paths_in_sys = removeduppaths() ! if (os.name == "posix" and sys.path and ! os.path.basename(sys.path[-1]) == "Modules"): ! addbuilddir() ! paths_in_sys = addsitepackages(paths_in_sys) ! if sys.platform == 'os2emx': ! setBEGINLIBPATH() ! setquit() ! setcopyright() ! sethelper() ! aliasmbcs() ! setencoding() ! execsitecustomize() ! # Remove sys.setdefaultencoding() so that users cannot change the ! # encoding after initialization. The test for presence is needed when ! # this module is run as a script, because this code is executed twice. ! if hasattr(sys, "setdefaultencoding"): ! del sys.setdefaultencoding ! main() def _test(): From bcannon at users.sourceforge.net Fri Jun 4 21:12:54 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Fri Jun 4 21:13:04 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.989,1.990 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10131/Misc Modified Files: NEWS Log Message: Refactored site.py into functions. Also moved over to using sets. New regression test suite. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.989 retrieving revision 1.990 diff -C2 -d -r1.989 -r1.990 *** NEWS 4 Jun 2004 13:55:13 -0000 1.989 --- NEWS 5 Jun 2004 01:12:51 -0000 1.990 *************** *** 323,326 **** --- 323,329 ---- ------- + - refactored site.py into functions. Also wrote regression tests for the + module. + - asyncore.loop now has repeat count parameter that defaults to infinity. From rhettinger at users.sourceforge.net Sat Jun 5 02:16:25 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 5 02:16:30 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.397,2.398 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20107 Modified Files: ceval.c Log Message: SF bug #963956: Bad error mesage when subclassing a module Add a more informative message for the common user mistake of subclassing from a module name rather than another class (i.e. random instead of random.random). Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.397 retrieving revision 2.398 diff -C2 -d -r2.397 -r2.398 *** ceval.c 1 Jun 2004 15:22:42 -0000 2.397 --- ceval.c 5 Jun 2004 06:16:22 -0000 2.398 *************** *** 3923,3926 **** --- 3923,3935 ---- result = PyObject_CallFunction(metaclass, "OOO", name, bases, methods); Py_DECREF(metaclass); + if (result == NULL && PyErr_ExceptionMatches(PyExc_TypeError)) { + /* A type error here likely means that the user passed + in a base that was not a class (such the random module + instead of the random.random type). Help them out with + a more informative error message */ + PyErr_SetString(PyExc_TypeError, + "Error when calling the metaclass.\n" \ + "Make sure the base arguments are valid."); + } return result; } From akuchling at users.sourceforge.net Sat Jun 5 08:33:29 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 08:33:32 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_xmlrpc.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14986 Modified Files: test_xmlrpc.py Log Message: [Bug #841757] Exercise handling of Unicode strings Index: test_xmlrpc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmlrpc.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_xmlrpc.py 25 Apr 2003 00:27:24 -0000 1.4 --- test_xmlrpc.py 5 Jun 2004 12:33:27 -0000 1.5 *************** *** 11,14 **** --- 11,16 ---- 'abase64': xmlrpclib.Binary("my dog has fleas"), 'boolean': xmlrpclib.False, + 'unicode': u'\u4000\u6000\u8000', + u'ukey\u4000': 'regular value', }] From akuchling at users.sourceforge.net Sat Jun 5 08:36:01 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 08:36:04 2004 Subject: [Python-checkins] python/dist/src/Lib xmlrpclib.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15283 Modified Files: xmlrpclib.py Log Message: [Bug #841757] Patch from /F to allow Unicode strings as struct keys Index: xmlrpclib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xmlrpclib.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** xmlrpclib.py 2 Nov 2003 09:47:05 -0000 1.32 --- xmlrpclib.py 5 Jun 2004 12:35:58 -0000 1.33 *************** *** 689,698 **** dump = self.__dump write("\n") ! for k in value.keys(): write("\n") if type(k) is not StringType: ! raise TypeError, "dictionary key must be string" write("%s\n" % escape(k)) ! dump(value[k], write) write("\n") write("\n") --- 689,701 ---- dump = self.__dump write("\n") ! for k, v in value.items(): write("\n") if type(k) is not StringType: ! if unicode and type(k) is UnicodeType: ! k = k.encode(self.encoding) ! else: ! raise TypeError, "dictionary key must be string" write("%s\n" % escape(k)) ! dump(v, write) write("\n") write("\n") From akuchling at users.sourceforge.net Sat Jun 5 08:51:59 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 08:52:03 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.114, 1.831.4.115 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17981 Modified Files: Tag: release23-maint NEWS Log Message: Update version number Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.114 retrieving revision 1.831.4.115 diff -C2 -d -r1.831.4.114 -r1.831.4.115 *** NEWS 2 Jun 2004 12:36:48 -0000 1.831.4.114 --- NEWS 5 Jun 2004 12:51:51 -0000 1.831.4.115 *************** *** 5,10 **** (editors: check NEWS.help for information about editing NEWS using ReST.) ! What's New in Python 2.3.4 (final)? ! =================================== *Release date: xx-xxx-2004* --- 5,10 ---- (editors: check NEWS.help for information about editing NEWS using ReST.) ! What's New in Python 2.3.5? ! =========================== *Release date: xx-xxx-2004* From akuchling at users.sourceforge.net Sat Jun 5 08:55:35 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 08:55:45 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_xmlrpc.py, 1.4, 1.4.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18774/Lib/test Modified Files: Tag: release23-maint test_xmlrpc.py Log Message: [Bug #841757] Patch from /F to allow Unicode strings as struct keys (Also a 2.2 bugfix candidate.) Index: test_xmlrpc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xmlrpc.py,v retrieving revision 1.4 retrieving revision 1.4.10.1 diff -C2 -d -r1.4 -r1.4.10.1 *** test_xmlrpc.py 25 Apr 2003 00:27:24 -0000 1.4 --- test_xmlrpc.py 5 Jun 2004 12:55:33 -0000 1.4.10.1 *************** *** 11,14 **** --- 11,16 ---- 'abase64': xmlrpclib.Binary("my dog has fleas"), 'boolean': xmlrpclib.False, + 'unicode': u'\u4000\u6000\u8000', + u'ukey\u4000': 'regular value', }] From akuchling at users.sourceforge.net Sat Jun 5 08:55:35 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 08:55:47 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.115, 1.831.4.116 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18774/Misc Modified Files: Tag: release23-maint NEWS Log Message: [Bug #841757] Patch from /F to allow Unicode strings as struct keys (Also a 2.2 bugfix candidate.) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.115 retrieving revision 1.831.4.116 diff -C2 -d -r1.831.4.115 -r1.831.4.116 *** NEWS 5 Jun 2004 12:51:51 -0000 1.831.4.115 --- NEWS 5 Jun 2004 12:55:32 -0000 1.831.4.116 *************** *** 17,20 **** --- 17,23 ---- - Patch #954115: Properly handle UNC roots in nt.stat. + - Bug #841757: xmlrpclib failed on structs with Unicode keys. + + What's New in Python 2.3.4 (final)? =================================== From akuchling at users.sourceforge.net Sat Jun 5 08:55:35 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 08:55:50 2004 Subject: [Python-checkins] python/dist/src/Lib xmlrpclib.py, 1.29.6.1, 1.29.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18774/Lib Modified Files: Tag: release23-maint xmlrpclib.py Log Message: [Bug #841757] Patch from /F to allow Unicode strings as struct keys (Also a 2.2 bugfix candidate.) Index: xmlrpclib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xmlrpclib.py,v retrieving revision 1.29.6.1 retrieving revision 1.29.6.2 diff -C2 -d -r1.29.6.1 -r1.29.6.2 *** xmlrpclib.py 20 Oct 2003 14:34:46 -0000 1.29.6.1 --- xmlrpclib.py 5 Jun 2004 12:55:32 -0000 1.29.6.2 *************** *** 687,696 **** dump = self.__dump write("\n") ! for k in value.keys(): write("\n") if type(k) is not StringType: ! raise TypeError, "dictionary key must be string" write("%s\n" % escape(k)) ! dump(value[k], write) write("\n") write("\n") --- 687,699 ---- dump = self.__dump write("\n") ! for k, v in value.items(): write("\n") if type(k) is not StringType: ! if unicode and type(k) is UnicodeType: ! k = k.encode(self.encoding) ! else: ! raise TypeError, "dictionary key must be string" write("%s\n" % escape(k)) ! dump(v, write) write("\n") write("\n") From perky at users.sourceforge.net Sat Jun 5 09:30:58 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sat Jun 5 09:31:02 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_urllib.py, 1.14, 1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23584/Lib/test Modified Files: test_urllib.py Log Message: Fix a bug that robotparser starves memory when the server responses in HTTP/0.9 due to dissonance of httplib.LineAndFileWrapper and urllib.addbase. Index: test_urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_urllib.py 12 May 2003 20:19:37 -0000 1.14 --- test_urllib.py 5 Jun 2004 13:30:56 -0000 1.15 *************** *** 2,9 **** --- 2,11 ---- import urllib + import httplib import unittest from test import test_support import os import mimetools + import StringIO def hexescape(char): *************** *** 89,92 **** --- 91,125 ---- self.assertEqual(line, self.text) + class urlopen_HttpTests(unittest.TestCase): + """Test urlopen() opening a fake http connection.""" + + def fakehttp(self, fakedata): + class FakeSocket(StringIO.StringIO): + def sendall(self, str): pass + def makefile(self, mode, name): return self + def read(self, amt=None): + if self.closed: return '' + return StringIO.StringIO.read(self, amt) + def readline(self, length=None): + if self.closed: return '' + return StringIO.StringIO.readline(self, length) + class FakeHTTPConnection(httplib.HTTPConnection): + def connect(self): + self.sock = FakeSocket(fakedata) + assert httplib.HTTP._connection_class == httplib.HTTPConnection + httplib.HTTP._connection_class = FakeHTTPConnection + + def unfakehttp(self): + httplib.HTTP._connection_class = httplib.HTTPConnection + + def test_read(self): + self.fakehttp('Hello!') + try: + fp = urllib.urlopen("http://python.org/") + self.assertEqual(fp.readline(), 'Hello!') + self.assertEqual(fp.readline(), '') + finally: + self.unfakehttp() + class urlretrieve_FileTests(unittest.TestCase): """Test urllib.urlretrieve() on local files""" *************** *** 411,414 **** --- 444,448 ---- test_support.run_unittest( urlopen_FileTests, + urlopen_HttpTests, urlretrieve_FileTests, QuotingTests, From perky at users.sourceforge.net Sat Jun 5 09:30:58 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sat Jun 5 09:31:04 2004 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.84,1.85 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23584/Lib Modified Files: httplib.py Log Message: Fix a bug that robotparser starves memory when the server responses in HTTP/0.9 due to dissonance of httplib.LineAndFileWrapper and urllib.addbase. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** httplib.py 4 May 2004 09:21:43 -0000 1.84 --- httplib.py 5 Jun 2004 13:30:56 -0000 1.85 *************** *** 1182,1186 **** def read(self, amt=None): ! assert not self._line_consumed and self._line_left if amt is None or amt > self._line_left: s = self._line[self._line_offset:] --- 1182,1188 ---- def read(self, amt=None): ! if self._line_consumed: ! return self._file.read(amt) ! assert self._line_left if amt is None or amt > self._line_left: s = self._line[self._line_offset:] *************** *** 1202,1205 **** --- 1204,1210 ---- def readline(self): + if self._line_consumed: + return self._file.readline() + assert self._line_left s = self._line[self._line_offset:] self._done() *************** *** 1207,1210 **** --- 1212,1218 ---- def readlines(self, size=None): + if self._line_consumed: + return self._file.readlines(size) + assert self._line_left L = [self._line[self._line_offset:]] self._done() From perky at users.sourceforge.net Sat Jun 5 09:30:58 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sat Jun 5 09:31:07 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.990,1.991 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23584/Misc Modified Files: NEWS Log Message: Fix a bug that robotparser starves memory when the server responses in HTTP/0.9 due to dissonance of httplib.LineAndFileWrapper and urllib.addbase. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.990 retrieving revision 1.991 diff -C2 -d -r1.990 -r1.991 *** NEWS 5 Jun 2004 01:12:51 -0000 1.990 --- NEWS 5 Jun 2004 13:30:55 -0000 1.991 *************** *** 323,326 **** --- 323,328 ---- ------- + - urllib.urlopen().readline() now handles HTTP/0.9 correctly. + - refactored site.py into functions. Also wrote regression tests for the module. From akuchling at users.sourceforge.net Sat Jun 5 10:12:01 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 10:12:06 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_inspect.py, 1.13, 1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32149/test Modified Files: test_inspect.py Log Message: [Bug #954364] inspect.getframeinfo() sometimes produces incorrect traceback line #s; fix is to look at tb.tb_lineno, not tb.frame.f_lineno. Patch from Robin Becker and me. Index: test_inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_inspect.py 31 Oct 2003 15:35:53 -0000 1.13 --- test_inspect.py 5 Jun 2004 14:11:59 -0000 1.14 *************** *** 159,164 **** test(len(git.tr) == 3, 'trace() length') ! test(git.tr[0][1:] == (TESTFN, 46, 'argue', ! [' self.tr = inspect.trace()\n'], 0), 'trace() row 2') test(git.tr[1][1:] == (TESTFN, 9, 'spam', [' eggs(b + d, c + f)\n'], 0), --- 159,164 ---- test(len(git.tr) == 3, 'trace() length') ! test(git.tr[0][1:] == (TESTFN, 43, 'argue', ! [' spam(a, b, c)\n'], 0), 'trace() row 2') test(git.tr[1][1:] == (TESTFN, 9, 'spam', [' eggs(b + d, c + f)\n'], 0), From akuchling at users.sourceforge.net Sat Jun 5 10:12:01 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 10:12:09 2004 Subject: [Python-checkins] python/dist/src/Lib inspect.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32149 Modified Files: inspect.py Log Message: [Bug #954364] inspect.getframeinfo() sometimes produces incorrect traceback line #s; fix is to look at tb.tb_lineno, not tb.frame.f_lineno. Patch from Robin Becker and me. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** inspect.py 1 Dec 2003 20:12:15 -0000 1.49 --- inspect.py 5 Jun 2004 14:11:59 -0000 1.50 *************** *** 741,750 **** to return, which are centered around the current line.""" if istraceback(frame): frame = frame.tb_frame if not isframe(frame): raise TypeError('arg is not a frame or traceback object') filename = getsourcefile(frame) or getfile(frame) - lineno = frame.f_lineno if context > 0: start = lineno - 1 - context//2 --- 741,752 ---- to return, which are centered around the current line.""" if istraceback(frame): + lineno = frame.tb_lineno frame = frame.tb_frame + else: + lineno = frame.f_lineno if not isframe(frame): raise TypeError('arg is not a frame or traceback object') filename = getsourcefile(frame) or getfile(frame) if context > 0: start = lineno - 1 - context//2 From akuchling at users.sourceforge.net Sat Jun 5 10:14:51 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 10:14:54 2004 Subject: [Python-checkins] python/dist/src/Lib inspect.py,1.47,1.47.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32563/Lib Modified Files: Tag: release23-maint inspect.py Log Message: [Bug #954364] inspect.getframeinfo() sometimes produces incorrect traceback line #s; fix is to look at tb.tb_lineno, not tb.frame.f_lineno. Patch from Robin Becker and me. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.47 retrieving revision 1.47.8.1 diff -C2 -d -r1.47 -r1.47.8.1 *** inspect.py 29 Jun 2003 05:46:53 -0000 1.47 --- inspect.py 5 Jun 2004 14:14:48 -0000 1.47.8.1 *************** *** 740,749 **** to return, which are centered around the current line.""" if istraceback(frame): frame = frame.tb_frame if not isframe(frame): raise TypeError('arg is not a frame or traceback object') filename = getsourcefile(frame) or getfile(frame) - lineno = frame.f_lineno if context > 0: start = lineno - 1 - context//2 --- 740,751 ---- to return, which are centered around the current line.""" if istraceback(frame): + lineno = frame.tb_lineno frame = frame.tb_frame + else: + lineno = frame.f_lineno if not isframe(frame): raise TypeError('arg is not a frame or traceback object') filename = getsourcefile(frame) or getfile(frame) if context > 0: start = lineno - 1 - context//2 From akuchling at users.sourceforge.net Sat Jun 5 10:14:51 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 10:14:57 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_inspect.py, 1.12.8.1, 1.12.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32563/Lib/test Modified Files: Tag: release23-maint test_inspect.py Log Message: [Bug #954364] inspect.getframeinfo() sometimes produces incorrect traceback line #s; fix is to look at tb.tb_lineno, not tb.frame.f_lineno. Patch from Robin Becker and me. Index: test_inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v retrieving revision 1.12.8.1 retrieving revision 1.12.8.2 diff -C2 -d -r1.12.8.1 -r1.12.8.2 *** test_inspect.py 31 Oct 2003 15:34:16 -0000 1.12.8.1 --- test_inspect.py 5 Jun 2004 14:14:48 -0000 1.12.8.2 *************** *** 159,164 **** test(len(git.tr) == 3, 'trace() length') ! test(git.tr[0][1:] == (TESTFN, 46, 'argue', ! [' self.tr = inspect.trace()\n'], 0), 'trace() row 2') test(git.tr[1][1:] == (TESTFN, 9, 'spam', [' eggs(b + d, c + f)\n'], 0), --- 159,164 ---- test(len(git.tr) == 3, 'trace() length') ! test(git.tr[0][1:] == (TESTFN, 43, 'argue', ! [' spam(a, b, c)\n'], 0), 'trace() row 2') test(git.tr[1][1:] == (TESTFN, 9, 'spam', [' eggs(b + d, c + f)\n'], 0), From akuchling at users.sourceforge.net Sat Jun 5 10:14:51 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 10:15:00 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.116, 1.831.4.117 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32563/Misc Modified Files: Tag: release23-maint NEWS Log Message: [Bug #954364] inspect.getframeinfo() sometimes produces incorrect traceback line #s; fix is to look at tb.tb_lineno, not tb.frame.f_lineno. Patch from Robin Becker and me. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.116 retrieving revision 1.831.4.117 diff -C2 -d -r1.831.4.116 -r1.831.4.117 *** NEWS 5 Jun 2004 12:55:32 -0000 1.831.4.116 --- NEWS 5 Jun 2004 14:14:49 -0000 1.831.4.117 *************** *** 19,22 **** --- 19,24 ---- - Bug #841757: xmlrpclib failed on structs with Unicode keys. + - Bug #954364: inspect.getframeinfo() sometimes produces incorrect traceback + line numbers What's New in Python 2.3.4 (final)? From rhettinger at users.sourceforge.net Sat Jun 5 10:53:24 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 5 10:53:28 2004 Subject: [Python-checkins] python/dist/src/Lib random.py,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6123 Modified Files: random.py Log Message: SF bug #964230: random.choice([]) should return more intelligible exception Add a comment to make the traceback less mysterious. Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** random.py 23 Feb 2004 17:27:57 -0000 1.60 --- random.py 5 Jun 2004 14:53:22 -0000 1.61 *************** *** 238,242 **** def choice(self, seq): """Choose a random element from a non-empty sequence.""" ! return seq[int(self.random() * len(seq))] def shuffle(self, x, random=None, int=int): --- 238,242 ---- def choice(self, seq): """Choose a random element from a non-empty sequence.""" ! return seq[int(self.random() * len(seq))] # raises IndexError in seq is empty def shuffle(self, x, random=None, int=int): From akuchling at users.sourceforge.net Sat Jun 5 11:31:48 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 11:36:55 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_htmlparser.py, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13120/Lib/test Modified Files: test_htmlparser.py Log Message: [Bug #921657] Allow '@' in unquoted HTML attributes. Not strictly legal according to the HTML REC, but HTMLParser is already a pretty loose parser. Reported by Bernd Zimmermann. Index: test_htmlparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_htmlparser.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_htmlparser.py 17 Apr 2003 22:19:26 -0000 1.11 --- test_htmlparser.py 5 Jun 2004 15:31:45 -0000 1.12 *************** *** 205,208 **** --- 205,212 ---- ("starttag", "e", [("a", "rgb(1,2,3)")]), ]) + # Regression test for SF bug #921657. + self._run_check("", [ + ("starttag", "a", [("href", "mailto:xyz@example.com")]), + ]) def test_attr_entity_replacement(self): From akuchling at users.sourceforge.net Sat Jun 5 11:31:48 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 11:36:57 2004 Subject: [Python-checkins] python/dist/src/Lib HTMLParser.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13120/Lib Modified Files: HTMLParser.py Log Message: [Bug #921657] Allow '@' in unquoted HTML attributes. Not strictly legal according to the HTML REC, but HTMLParser is already a pretty loose parser. Reported by Bernd Zimmermann. Index: HTMLParser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/HTMLParser.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** HTMLParser.py 12 Feb 2004 17:35:05 -0000 1.13 --- HTMLParser.py 5 Jun 2004 15:31:45 -0000 1.14 *************** *** 27,31 **** attrfind = re.compile( r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*' ! r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~]*))?') locatestarttagend = re.compile(r""" --- 27,31 ---- attrfind = re.compile( r'\s*([a-zA-Z_][-.:a-zA-Z_0-9]*)(\s*=\s*' ! r'(\'[^\']*\'|"[^"]*"|[-a-zA-Z0-9./,:;+*%?!&$\(\)_#=~@]*))?') locatestarttagend = re.compile(r""" From akuchling at users.sourceforge.net Sat Jun 5 12:27:18 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 12:27:22 2004 Subject: [Python-checkins] python/dist/src/Lib pty.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24391 Modified Files: pty.py Log Message: [Bug #897935] Fix fd leak in pty.spawn(). Reported by James Henstridge; 2.3 bugfix candidate. Index: pty.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pty.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** pty.py 27 Feb 2003 20:14:38 -0000 1.15 --- pty.py 5 Jun 2004 16:27:16 -0000 1.16 *************** *** 176,177 **** --- 176,179 ---- if restore: tty.tcsetattr(STDIN_FILENO, tty.TCSAFLUSH, mode) + + os.close(master_fd) From montanaro at users.sourceforge.net Sat Jun 5 13:03:22 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat Jun 5 13:03:28 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_csv.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31297 Modified Files: test_csv.py Log Message: Rewrote to use temporary files instead of StringIO objects in most places. Goal is to work in the direction of universal newline support. Index: test_csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_csv.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_csv.py 3 Oct 2003 14:03:01 -0000 1.11 --- test_csv.py 5 Jun 2004 17:03:20 -0000 1.12 *************** *** 4,9 **** --- 4,11 ---- import sys + import os import unittest from StringIO import StringIO + import tempfile import csv import gc *************** *** 56,64 **** def _write_test(self, fields, expect, **kwargs): ! fileobj = StringIO() ! writer = csv.writer(fileobj, **kwargs) ! writer.writerow(fields) ! self.assertEqual(fileobj.getvalue(), ! expect + writer.dialect.lineterminator) def test_write_arg_valid(self): --- 58,72 ---- def _write_test(self, fields, expect, **kwargs): ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj, **kwargs) ! writer.writerow(fields) ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), ! expect + writer.dialect.lineterminator) ! finally: ! fileobj.close() ! os.unlink(name) def test_write_arg_valid(self): *************** *** 115,124 **** writer = csv.writer(BrokenFile()) self.assertRaises(IOError, writer.writerows, [['a']]) ! fileobj = StringIO() ! writer = csv.writer(fileobj) ! self.assertRaises(TypeError, writer.writerows, None) ! writer.writerows([['a','b'],['c','d']]) ! self.assertEqual(fileobj.getvalue(), "a,b\r\nc,d\r\n") ! def _read_test(self, input, expect, **kwargs): reader = csv.reader(input, **kwargs) --- 123,138 ---- writer = csv.writer(BrokenFile()) self.assertRaises(IOError, writer.writerows, [['a']]) ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj) ! self.assertRaises(TypeError, writer.writerows, None) ! writer.writerows([['a','b'],['c','d']]) ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), "a,b\r\nc,d\r\n") ! finally: ! fileobj.close() ! os.unlink(name) ! def _read_test(self, input, expect, **kwargs): reader = csv.reader(input, **kwargs) *************** *** 202,210 **** escapechar = "\\" ! s = StringIO("abc def\nc1ccccc1 benzene\n") ! rdr = csv.reader(s, dialect=space()) ! self.assertEqual(rdr.next(), ["abc", "def"]) ! self.assertEqual(rdr.next(), ["c1ccccc1", "benzene"]) ! def test_dialect_apply(self): class testA(csv.excel): --- 216,231 ---- escapechar = "\\" ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! fileobj.write("abc def\nc1ccccc1 benzene\n") ! fileobj.seek(0) ! rdr = csv.reader(fileobj, dialect=space()) ! self.assertEqual(rdr.next(), ["abc", "def"]) ! self.assertEqual(rdr.next(), ["c1ccccc1", "benzene"]) ! finally: ! fileobj.close() ! os.unlink(name) ! def test_dialect_apply(self): class testA(csv.excel): *************** *** 217,244 **** csv.register_dialect('testC', testC) try: ! fileobj = StringIO() ! writer = csv.writer(fileobj) ! writer.writerow([1,2,3]) ! self.assertEqual(fileobj.getvalue(), "1,2,3\r\n") ! fileobj = StringIO() ! writer = csv.writer(fileobj, testA) ! writer.writerow([1,2,3]) ! self.assertEqual(fileobj.getvalue(), "1\t2\t3\r\n") ! fileobj = StringIO() ! writer = csv.writer(fileobj, dialect=testB()) ! writer.writerow([1,2,3]) ! self.assertEqual(fileobj.getvalue(), "1:2:3\r\n") ! fileobj = StringIO() ! writer = csv.writer(fileobj, dialect='testC') ! writer.writerow([1,2,3]) ! self.assertEqual(fileobj.getvalue(), "1|2|3\r\n") - fileobj = StringIO() - writer = csv.writer(fileobj, dialect=testA, delimiter=';') - writer.writerow([1,2,3]) - self.assertEqual(fileobj.getvalue(), "1;2;3\r\n") finally: csv.unregister_dialect('testC') --- 238,296 ---- csv.register_dialect('testC', testC) try: ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj) ! writer.writerow([1,2,3]) ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), "1,2,3\r\n") ! finally: ! fileobj.close() ! os.unlink(name) ! ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj, testA) ! writer.writerow([1,2,3]) ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), "1\t2\t3\r\n") ! finally: ! fileobj.close() ! os.unlink(name) ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj, dialect=testB()) ! writer.writerow([1,2,3]) ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), "1:2:3\r\n") ! finally: ! fileobj.close() ! os.unlink(name) ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj, dialect='testC') ! writer.writerow([1,2,3]) ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), "1|2|3\r\n") ! finally: ! fileobj.close() ! os.unlink(name) ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj, dialect=testA, delimiter=';') ! writer.writerow([1,2,3]) ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), "1;2;3\r\n") ! finally: ! fileobj.close() ! os.unlink(name) finally: csv.unregister_dialect('testC') *************** *** 254,266 **** class TestCsvBase(unittest.TestCase): def readerAssertEqual(self, input, expected_result): ! reader = csv.reader(StringIO(input), dialect = self.dialect) ! fields = list(reader) ! self.assertEqual(fields, expected_result) def writerAssertEqual(self, input, expected_result): ! fileobj = StringIO() ! writer = csv.writer(fileobj, dialect = self.dialect) ! writer.writerows(input) ! self.assertEqual(fileobj.getvalue(), expected_result) class TestDialectExcel(TestCsvBase): --- 306,332 ---- class TestCsvBase(unittest.TestCase): def readerAssertEqual(self, input, expected_result): ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! fileobj.write(input) ! fileobj.seek(0) ! reader = csv.reader(fileobj, dialect = self.dialect) ! fields = list(reader) ! self.assertEqual(fields, expected_result) ! finally: ! fileobj.close() ! os.unlink(name) def writerAssertEqual(self, input, expected_result): ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj, dialect = self.dialect) ! writer.writerows(input) ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), expected_result) ! finally: ! fileobj.close() ! os.unlink(name) class TestDialectExcel(TestCsvBase): *************** *** 387,394 **** ### "short" means there are fewer elements in the row than fieldnames def test_write_simple_dict(self): ! fileobj = StringIO() ! writer = csv.DictWriter(fileobj, fieldnames = ["f1", "f2", "f3"]) ! writer.writerow({"f1": 10, "f3": "abc"}) ! self.assertEqual(fileobj.getvalue(), "10,,abc\r\n") def test_write_no_fields(self): --- 453,466 ---- ### "short" means there are fewer elements in the row than fieldnames def test_write_simple_dict(self): ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.DictWriter(fileobj, fieldnames = ["f1", "f2", "f3"]) ! writer.writerow({"f1": 10, "f3": "abc"}) ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), "10,,abc\r\n") ! finally: ! fileobj.close() ! os.unlink(name) def test_write_no_fields(self): *************** *** 397,435 **** def test_read_dict_fields(self): ! reader = csv.DictReader(StringIO("1,2,abc\r\n"), ! fieldnames=["f1", "f2", "f3"]) ! self.assertEqual(reader.next(), {"f1": '1', "f2": '2', "f3": 'abc'}) def test_read_dict_no_fieldnames(self): ! reader = csv.DictReader(StringIO("f1,f2,f3\r\n1,2,abc\r\n")) ! self.assertEqual(reader.next(), {"f1": '1', "f2": '2', "f3": 'abc'}) def test_read_long(self): ! reader = csv.DictReader(StringIO("1,2,abc,4,5,6\r\n"), ! fieldnames=["f1", "f2"]) ! self.assertEqual(reader.next(), {"f1": '1', "f2": '2', ! None: ["abc", "4", "5", "6"]}) def test_read_long_with_rest(self): ! reader = csv.DictReader(StringIO("1,2,abc,4,5,6\r\n"), ! fieldnames=["f1", "f2"], restkey="_rest") ! self.assertEqual(reader.next(), {"f1": '1', "f2": '2', ! "_rest": ["abc", "4", "5", "6"]}) def test_read_long_with_rest_no_fieldnames(self): ! reader = csv.DictReader(StringIO("f1,f2\r\n1,2,abc,4,5,6\r\n"), ! restkey="_rest") ! self.assertEqual(reader.next(), {"f1": '1', "f2": '2', ! "_rest": ["abc", "4", "5", "6"]}) def test_read_short(self): ! reader = csv.DictReader(["1,2,abc,4,5,6\r\n","1,2,abc\r\n"], ! fieldnames="1 2 3 4 5 6".split(), ! restval="DEFAULT") ! self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', ! "4": '4', "5": '5', "6": '6'}) ! self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', ! "4": 'DEFAULT', "5": 'DEFAULT', ! "6": 'DEFAULT'}) def test_read_multi(self): --- 469,554 ---- def test_read_dict_fields(self): ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! fileobj.write("1,2,abc\r\n") ! fileobj.seek(0) ! reader = csv.DictReader(fileobj, ! fieldnames=["f1", "f2", "f3"]) ! self.assertEqual(reader.next(), {"f1": '1', "f2": '2', "f3": 'abc'}) ! finally: ! fileobj.close() ! os.unlink(name) def test_read_dict_no_fieldnames(self): ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! fileobj.write("f1,f2,f3\r\n1,2,abc\r\n") ! fileobj.seek(0) ! reader = csv.DictReader(fileobj) ! self.assertEqual(reader.next(), {"f1": '1', "f2": '2', "f3": 'abc'}) ! finally: ! fileobj.close() ! os.unlink(name) def test_read_long(self): ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! fileobj.write("1,2,abc,4,5,6\r\n") ! fileobj.seek(0) ! reader = csv.DictReader(fileobj, ! fieldnames=["f1", "f2"]) ! self.assertEqual(reader.next(), {"f1": '1', "f2": '2', ! None: ["abc", "4", "5", "6"]}) ! finally: ! fileobj.close() ! os.unlink(name) def test_read_long_with_rest(self): ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! fileobj.write("1,2,abc,4,5,6\r\n") ! fileobj.seek(0) ! reader = csv.DictReader(fileobj, ! fieldnames=["f1", "f2"], restkey="_rest") ! self.assertEqual(reader.next(), {"f1": '1', "f2": '2', ! "_rest": ["abc", "4", "5", "6"]}) ! finally: ! fileobj.close() ! os.unlink(name) def test_read_long_with_rest_no_fieldnames(self): ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! fileobj.write("f1,f2\r\n1,2,abc,4,5,6\r\n") ! fileobj.seek(0) ! reader = csv.DictReader(fileobj, restkey="_rest") ! self.assertEqual(reader.next(), {"f1": '1', "f2": '2', ! "_rest": ["abc", "4", "5", "6"]}) ! finally: ! fileobj.close() ! os.unlink(name) def test_read_short(self): ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! fileobj.write("1,2,abc,4,5,6\r\n1,2,abc\r\n") ! fileobj.seek(0) ! reader = csv.DictReader(fileobj, ! fieldnames="1 2 3 4 5 6".split(), ! restval="DEFAULT") ! self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', ! "4": '4', "5": '5', "6": '6'}) ! self.assertEqual(reader.next(), {"1": '1', "2": '2', "3": 'abc', ! "4": 'DEFAULT', "5": 'DEFAULT', ! "6": 'DEFAULT'}) ! finally: ! fileobj.close() ! os.unlink(name) def test_read_multi(self): *************** *** 469,477 **** contents = [(20-i) for i in range(20)] a = array.array('i', contents) ! fileobj = StringIO() ! writer = csv.writer(fileobj, dialect="excel") ! writer.writerow(a) ! expected = ",".join([str(i) for i in a])+"\r\n" ! self.assertEqual(fileobj.getvalue(), expected) def test_double_write(self): --- 588,603 ---- contents = [(20-i) for i in range(20)] a = array.array('i', contents) ! ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj, dialect="excel") ! writer.writerow(a) ! expected = ",".join([str(i) for i in a])+"\r\n" ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), expected) ! finally: ! fileobj.close() ! os.unlink(name) def test_double_write(self): *************** *** 479,487 **** contents = [(20-i)*0.1 for i in range(20)] a = array.array('d', contents) ! fileobj = StringIO() ! writer = csv.writer(fileobj, dialect="excel") ! writer.writerow(a) ! expected = ",".join([str(i) for i in a])+"\r\n" ! self.assertEqual(fileobj.getvalue(), expected) def test_float_write(self): --- 605,619 ---- contents = [(20-i)*0.1 for i in range(20)] a = array.array('d', contents) ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj, dialect="excel") ! writer.writerow(a) ! expected = ",".join([str(i) for i in a])+"\r\n" ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), expected) ! finally: ! fileobj.close() ! os.unlink(name) def test_float_write(self): *************** *** 489,506 **** contents = [(20-i)*0.1 for i in range(20)] a = array.array('f', contents) ! fileobj = StringIO() ! writer = csv.writer(fileobj, dialect="excel") ! writer.writerow(a) ! expected = ",".join([str(i) for i in a])+"\r\n" ! self.assertEqual(fileobj.getvalue(), expected) def test_char_write(self): import array, string a = array.array('c', string.letters) ! fileobj = StringIO() ! writer = csv.writer(fileobj, dialect="excel") ! writer.writerow(a) ! expected = ",".join(a)+"\r\n" ! self.assertEqual(fileobj.getvalue(), expected) class TestDialectValidity(unittest.TestCase): --- 621,650 ---- contents = [(20-i)*0.1 for i in range(20)] a = array.array('f', contents) ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj, dialect="excel") ! writer.writerow(a) ! expected = ",".join([str(i) for i in a])+"\r\n" ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), expected) ! finally: ! fileobj.close() ! os.unlink(name) def test_char_write(self): import array, string a = array.array('c', string.letters) ! fd, name = tempfile.mkstemp() ! fileobj = os.fdopen(fd, "w+b") ! try: ! writer = csv.writer(fileobj, dialect="excel") ! writer.writerow(a) ! expected = ",".join(a)+"\r\n" ! fileobj.seek(0) ! self.assertEqual(fileobj.read(), expected) ! finally: ! fileobj.close() ! os.unlink(name) class TestDialectValidity(unittest.TestCase): *************** *** 697,717 **** # commented out for now - csv module doesn't yet support Unicode ! if 0: ! from StringIO import StringIO ! import csv ! ! class TestUnicode(unittest.TestCase): ! def test_unicode_read(self): ! import codecs ! f = codecs.EncodedFile(StringIO("Martin von Löwis," ! "Marc André Lemburg," ! "Guido van Rossum," ! "François Pinard\r\n"), ! data_encoding='iso-8859-1') ! reader = csv.reader(f) ! self.assertEqual(list(reader), [[u"Martin von Löwis", ! u"Marc André Lemburg", ! u"Guido van Rossum", ! u"François Pinardn"]]) def test_main(): --- 841,857 ---- # commented out for now - csv module doesn't yet support Unicode ! ## class TestUnicode(unittest.TestCase): ! ## def test_unicode_read(self): ! ## import codecs ! ## f = codecs.EncodedFile(StringIO("Martin von Löwis," ! ## "Marc André Lemburg," ! ## "Guido van Rossum," ! ## "François Pinard\r\n"), ! ## data_encoding='iso-8859-1') ! ## reader = csv.reader(f) ! ## self.assertEqual(list(reader), [[u"Martin von Löwis", ! ## u"Marc André Lemburg", ! ## u"Guido van Rossum", ! ## u"François Pinardn"]]) def test_main(): From perky at users.sourceforge.net Sat Jun 5 14:37:55 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sat Jun 5 14:38:04 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils cygwinccompiler.py, 1.24, 1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16521/Lib/distutils Modified Files: cygwinccompiler.py Log Message: SF #877165: Give an info about what C++ compiler command should be used in cygwin and mingw32. (Reported by Michael Droettboom) Index: cygwinccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cygwinccompiler.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** cygwinccompiler.py 14 Apr 2003 12:51:26 -0000 1.24 --- cygwinccompiler.py 5 Jun 2004 18:37:53 -0000 1.25 *************** *** 109,112 **** --- 109,113 ---- self.set_executables(compiler='gcc -mcygwin -O -Wall', compiler_so='gcc -mcygwin -mdll -O -Wall', + compiler_cxx='g++ -mcygwin -O -Wall', linker_exe='gcc -mcygwin', linker_so=('%s -mcygwin %s' % *************** *** 296,299 **** --- 297,301 ---- self.set_executables(compiler='gcc -mno-cygwin -O -Wall', compiler_so='gcc -mno-cygwin -mdll -O -Wall', + compiler_cxx='g++ -mno-cygwin -O -Wall', linker_exe='gcc -mno-cygwin', linker_so='%s -mno-cygwin %s %s' From perky at users.sourceforge.net Sat Jun 5 14:37:55 2004 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sat Jun 5 14:38:08 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.991,1.992 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16521/Misc Modified Files: NEWS Log Message: SF #877165: Give an info about what C++ compiler command should be used in cygwin and mingw32. (Reported by Michael Droettboom) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.991 retrieving revision 1.992 diff -C2 -d -r1.991 -r1.992 *** NEWS 5 Jun 2004 13:30:55 -0000 1.991 --- NEWS 5 Jun 2004 18:37:52 -0000 1.992 *************** *** 323,326 **** --- 323,329 ---- ------- + - Fixed #877165: distutils now picks the right C++ compiler command + on cygwin and mingw32. + - urllib.urlopen().readline() now handles HTTP/0.9 correctly. From akuchling at users.sourceforge.net Sat Jun 5 15:00:59 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 15:01:03 2004 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21823 Modified Files: abstract.tex Log Message: [Bug #936837] Add missing word Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** abstract.tex 17 Apr 2004 11:57:40 -0000 1.32 --- abstract.tex 5 Jun 2004 19:00:55 -0000 1.33 *************** *** 574,578 **** \begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceFloorDivide}{PyObject *o1, PyObject *o2} ! Returns the mathematical of dividing \var{o1} by \var{o2}, or \NULL{} on failure. The operation is done \emph{in-place} when \var{o1} supports it. This is the equivalent of the Python --- 574,578 ---- \begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceFloorDivide}{PyObject *o1, PyObject *o2} ! Returns the mathematical floor of dividing \var{o1} by \var{o2}, or \NULL{} on failure. The operation is done \emph{in-place} when \var{o1} supports it. This is the equivalent of the Python From akuchling at users.sourceforge.net Sat Jun 5 15:01:50 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 15:01:52 2004 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex, 1.26.12.5, 1.26.12.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22035 Modified Files: Tag: release23-maint abstract.tex Log Message: [Bug #936837] Add missing word Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.26.12.5 retrieving revision 1.26.12.6 diff -C2 -d -r1.26.12.5 -r1.26.12.6 *** abstract.tex 17 Apr 2004 11:59:55 -0000 1.26.12.5 --- abstract.tex 5 Jun 2004 19:01:47 -0000 1.26.12.6 *************** *** 574,578 **** \begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceFloorDivide}{PyObject *o1, PyObject *o2} ! Returns the mathematical of dividing \var{o1} by \var{o2}, or \NULL{} on failure. The operation is done \emph{in-place} when \var{o1} supports it. This is the equivalent of the Python --- 574,578 ---- \begin{cfuncdesc}{PyObject*}{PyNumber_InPlaceFloorDivide}{PyObject *o1, PyObject *o2} ! Returns the mathematical floor of dividing \var{o1} by \var{o2}, or \NULL{} on failure. The operation is done \emph{in-place} when \var{o1} supports it. This is the equivalent of the Python From nascheme at users.sourceforge.net Sat Jun 5 15:02:54 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sat Jun 5 15:02:57 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_zlib.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22205/Lib/test Modified Files: test_zlib.py Log Message: Remove lots of magic constants. Index: test_zlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zlib.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** test_zlib.py 31 Aug 2003 04:35:24 -0000 1.24 --- test_zlib.py 5 Jun 2004 19:02:52 -0000 1.25 *************** *** 64,68 **** def test_badcompressobj(self): # verify failure on building compress object with bad params ! self.assertRaises(ValueError, zlib.compressobj, 1, 8, 0) def test_baddecompressobj(self): --- 64,68 ---- def test_badcompressobj(self): # verify failure on building compress object with bad params ! self.assertRaises(ValueError, zlib.compressobj, 1, zlib.DEFLATED, 0) def test_baddecompressobj(self): *************** *** 105,113 **** # use compress object in straightforward manner, decompress w/ object data = hamlet_scene ! co = zlib.compressobj(8, 8, -15) x1 = co.compress(data) x2 = co.flush() self.assertRaises(zlib.error, co.flush) # second flush should not work ! dco = zlib.decompressobj(-15) y1 = dco.decompress(x1 + x2) y2 = dco.flush() --- 105,113 ---- # use compress object in straightforward manner, decompress w/ object data = hamlet_scene ! co = zlib.compressobj() x1 = co.compress(data) x2 = co.flush() self.assertRaises(zlib.error, co.flush) # second flush should not work ! dco = zlib.decompressobj() y1 = dco.decompress(x1 + x2) y2 = dco.flush() *************** *** 117,133 **** # straightforward compress/decompress objects, more compression data = hamlet_scene * 8 * 16 ! co = zlib.compressobj(8, 8, -15) x1 = co.compress(data) x2 = co.flush() self.assertRaises(zlib.error, co.flush) # second flush should not work ! dco = zlib.decompressobj(-15) y1 = dco.decompress(x1 + x2) y2 = dco.flush() self.assertEqual(data, y1 + y2) def test_compressincremental(self): # compress object in steps, decompress object as one-shot data = hamlet_scene * 8 * 16 ! co = zlib.compressobj(2, 8, -12, 9, 1) bufs = [] for i in range(0, len(data), 256): --- 117,148 ---- # straightforward compress/decompress objects, more compression data = hamlet_scene * 8 * 16 ! co = zlib.compressobj(zlib.Z_BEST_COMPRESSION, zlib.DEFLATED) x1 = co.compress(data) x2 = co.flush() self.assertRaises(zlib.error, co.flush) # second flush should not work ! dco = zlib.decompressobj() y1 = dco.decompress(x1 + x2) y2 = dco.flush() self.assertEqual(data, y1 + y2) + def test_compressoptions(self): + # specify lots of options to compressobj() + level = 2 + method = zlib.DEFLATED + wbits = -12 + memlevel = 9 + strategy = zlib.Z_FILTERED + co = zlib.compressobj(level, method, wbits, memlevel, strategy) + x1 = co.compress(hamlet_scene) + x2 = co.flush() + dco = zlib.decompressobj(wbits) + y1 = dco.decompress(x1 + x2) + y2 = dco.flush() + self.assertEqual(hamlet_scene, y1 + y2) + def test_compressincremental(self): # compress object in steps, decompress object as one-shot data = hamlet_scene * 8 * 16 ! co = zlib.compressobj() bufs = [] for i in range(0, len(data), 256): *************** *** 136,140 **** combuf = ''.join(bufs) ! dco = zlib.decompressobj(-15) y1 = dco.decompress(''.join(bufs)) y2 = dco.flush() --- 151,155 ---- combuf = ''.join(bufs) ! dco = zlib.decompressobj() y1 = dco.decompress(''.join(bufs)) y2 = dco.flush() *************** *** 144,148 **** # compress object in steps, decompress object in steps data = hamlet_scene * 8 * 16 ! co = zlib.compressobj(2, 8, -12, 9, 1) bufs = [] for i in range(0, len(data), 256): --- 159,163 ---- # compress object in steps, decompress object in steps data = hamlet_scene * 8 * 16 ! co = zlib.compressobj() bufs = [] for i in range(0, len(data), 256): *************** *** 151,157 **** combuf = ''.join(bufs) ! self.assertEqual(data, zlib.decompress(combuf, -12, -5)) ! dco = zlib.decompressobj(-12) bufs = [] for i in range(0, len(combuf), 128): --- 166,172 ---- combuf = ''.join(bufs) ! self.assertEqual(data, zlib.decompress(combuf)) ! dco = zlib.decompressobj() bufs = [] for i in range(0, len(combuf), 128): *************** *** 172,176 **** for reps in sizes: data = source * reps ! co = zlib.compressobj(2, 8, -12, 9, 1) bufs = [] for i in range(0, len(data), cx): --- 187,191 ---- for reps in sizes: data = source * reps ! co = zlib.compressobj() bufs = [] for i in range(0, len(data), cx): *************** *** 179,185 **** combuf = ''.join(bufs) ! self.assertEqual(data, zlib.decompress(combuf, -12, -5)) ! dco = zlib.decompressobj(-12) bufs = [] for i in range(0, len(combuf), dcx): --- 194,200 ---- combuf = ''.join(bufs) ! self.assertEqual(data, zlib.decompress(combuf)) ! dco = zlib.decompressobj() bufs = [] for i in range(0, len(combuf), dcx): *************** *** 209,213 **** # Check a decompression object with max_length specified data = source * reps ! co = zlib.compressobj(2, 8, -12, 9, 1) bufs = [] for i in range(0, len(data), cx): --- 224,228 ---- # Check a decompression object with max_length specified data = source * reps ! co = zlib.compressobj() bufs = [] for i in range(0, len(data), cx): *************** *** 215,222 **** bufs.append(co.flush()) combuf = ''.join(bufs) ! self.assertEqual(data, zlib.decompress(combuf, -12, -5), 'compressed data failure') ! dco = zlib.decompressobj(-12) bufs = [] cb = combuf --- 230,237 ---- bufs.append(co.flush()) combuf = ''.join(bufs) ! self.assertEqual(data, zlib.decompress(combuf), 'compressed data failure') ! dco = zlib.decompressobj() bufs = [] cb = combuf *************** *** 245,249 **** # Check a decompression object with max_length specified data = hamlet_scene * 8 * 16 ! co = zlib.compressobj(2, 8, -12, 9, 1) bufs = [] for i in range(0, len(data), 256): --- 260,264 ---- # Check a decompression object with max_length specified data = hamlet_scene * 8 * 16 ! co = zlib.compressobj() bufs = [] for i in range(0, len(data), 256): *************** *** 251,258 **** bufs.append(co.flush()) combuf = ''.join(bufs) ! self.assertEqual(data, zlib.decompress(combuf, -12, -5), 'compressed data failure') ! dco = zlib.decompressobj(-12) bufs = [] cb = combuf --- 266,273 ---- bufs.append(co.flush()) combuf = ''.join(bufs) ! self.assertEqual(data, zlib.decompress(combuf), 'compressed data failure') ! dco = zlib.decompressobj() bufs = [] cb = combuf *************** *** 272,276 **** # with an equivalent. This works and other fails on (eg) 2.2.2 data = hamlet_scene * 8 * 16 ! co = zlib.compressobj(2, 8, -12, 9, 1) bufs = [] for i in range(0, len(data), 256): --- 287,291 ---- # with an equivalent. This works and other fails on (eg) 2.2.2 data = hamlet_scene * 8 * 16 ! co = zlib.compressobj() bufs = [] for i in range(0, len(data), 256): *************** *** 278,285 **** bufs.append(co.flush()) combuf = ''.join(bufs) ! self.assertEqual(data, zlib.decompress(combuf, -12, -5), 'compressed data mismatch') ! dco = zlib.decompressobj(-12) bufs = [] cb = combuf --- 293,300 ---- bufs.append(co.flush()) combuf = ''.join(bufs) ! self.assertEqual(data, zlib.decompress(combuf), 'compressed data mismatch') ! dco = zlib.decompressobj() bufs = [] cb = combuf *************** *** 303,307 **** def test_maxlenmisc(self): # Misc tests of max_length ! dco = zlib.decompressobj(-12) self.assertRaises(ValueError, dco.decompress, "", -1) self.assertEqual('', dco.unconsumed_tail) --- 318,322 ---- def test_maxlenmisc(self): # Misc tests of max_length ! dco = zlib.decompressobj() self.assertRaises(ValueError, dco.decompress, "", -1) self.assertEqual('', dco.unconsumed_tail) From akuchling at users.sourceforge.net Sat Jun 5 15:15:37 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 15:15:39 2004 Subject: [Python-checkins] python/dist/src/Lib cgitb.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24920 Modified Files: cgitb.py Log Message: [Bug #758665] cgitb.scanvars() fails because of an unititialized value variable. Patch from Robin Becker. Index: cgitb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgitb.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** cgitb.py 6 May 2004 13:13:44 -0000 1.11 --- cgitb.py 5 Jun 2004 19:15:34 -0000 1.12 *************** *** 61,65 **** """Scan one logical line of Python and look up values of variables used.""" import tokenize, keyword ! vars, lasttoken, parent, prefix = [], None, None, '' for ttype, token, start, end, line in tokenize.generate_tokens(reader): if ttype == tokenize.NEWLINE: break --- 61,65 ---- """Scan one logical line of Python and look up values of variables used.""" import tokenize, keyword ! vars, lasttoken, parent, prefix, value = [], None, None, '', __UNDEF__ for ttype, token, start, end, line in tokenize.generate_tokens(reader): if ttype == tokenize.NEWLINE: break From akuchling at users.sourceforge.net Sat Jun 5 15:17:53 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 15:17:56 2004 Subject: [Python-checkins] python/dist/src/Lib cgitb.py,1.9.8.1,1.9.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25361 Modified Files: Tag: release23-maint cgitb.py Log Message: [Bug #758665] cgitb.scanvars() fails because of an unititialized value variable. Patch from Robin Becker. Index: cgitb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgitb.py,v retrieving revision 1.9.8.1 retrieving revision 1.9.8.2 diff -C2 -d -r1.9.8.1 -r1.9.8.2 *** cgitb.py 6 May 2004 13:18:26 -0000 1.9.8.1 --- cgitb.py 5 Jun 2004 19:17:51 -0000 1.9.8.2 *************** *** 61,65 **** """Scan one logical line of Python and look up values of variables used.""" import tokenize, keyword ! vars, lasttoken, parent, prefix = [], None, None, '' for ttype, token, start, end, line in tokenize.generate_tokens(reader): if ttype == tokenize.NEWLINE: break --- 61,65 ---- """Scan one logical line of Python and look up values of variables used.""" import tokenize, keyword ! vars, lasttoken, parent, prefix, value = [], None, None, '', __UNDEF__ for ttype, token, start, end, line in tokenize.generate_tokens(reader): if ttype == tokenize.NEWLINE: break From akuchling at users.sourceforge.net Sat Jun 5 15:25:33 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 15:25:36 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.135,1.136 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26707 Modified Files: libos.tex Log Message: [Bug #918710] Add paragraph to clarify docs Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** libos.tex 12 May 2004 03:51:40 -0000 1.135 --- libos.tex 5 Jun 2004 19:25:30 -0000 1.136 *************** *** 381,384 **** --- 381,389 ---- Executes \var{cmd} as a sub-process. Returns the file objects \code{(\var{child_stdin}, \var{child_stdout_and_stderr})}. + + (Note that \code{\var{child_stdin}, \var{child_stdout}, and + \var{child_stderr}} are named from the point of view of the child + process, i.e. \var{child_stdin} is the child's standard input.) + Availability: \UNIX, Windows. \versionadded{2.0} From akuchling at users.sourceforge.net Sat Jun 5 15:29:43 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 15:29:46 2004 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.108,2.109 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27330 Modified Files: intobject.c Log Message: Fix exception wording Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.108 retrieving revision 2.109 diff -C2 -d -r2.108 -r2.109 *** intobject.c 8 Feb 2004 18:54:37 -0000 2.108 --- intobject.c 5 Jun 2004 19:29:41 -0000 2.109 *************** *** 929,933 **** if (!PyLong_Check(tmp)) { PyErr_SetString(PyExc_ValueError, ! "value must convertable to an int"); Py_DECREF(tmp); return NULL; --- 929,933 ---- if (!PyLong_Check(tmp)) { PyErr_SetString(PyExc_ValueError, ! "value must be convertable to an int"); Py_DECREF(tmp); return NULL; From akuchling at users.sourceforge.net Sat Jun 5 15:30:32 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 15:30:36 2004 Subject: [Python-checkins] python/dist/src/Objects intobject.c, 2.105.8.1, 2.105.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27563 Modified Files: Tag: release23-maint intobject.c Log Message: Fix exception wording Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.105.8.1 retrieving revision 2.105.8.2 diff -C2 -d -r2.105.8.1 -r2.105.8.2 *** intobject.c 8 Feb 2004 18:56:07 -0000 2.105.8.1 --- intobject.c 5 Jun 2004 19:30:29 -0000 2.105.8.2 *************** *** 947,951 **** if (!PyLong_Check(tmp)) { PyErr_SetString(PyExc_ValueError, ! "value must convertable to an int"); return NULL; } --- 947,951 ---- if (!PyLong_Check(tmp)) { PyErr_SetString(PyExc_ValueError, ! "value must be convertable to an int"); return NULL; } From nascheme at users.sourceforge.net Sat Jun 5 15:34:30 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Sat Jun 5 15:34:34 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_zlib.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28247/Lib/test Modified Files: test_zlib.py Log Message: Remove a number of tests that differ only in input data size. It seems no bug motivated their inclusion and the chance of them triggering a problem seems unlikely. Refactor to reduce code duplication. Rename 'hamlet_scene' to 'HAMLET_SCENE'. Test is much faster now. Closes #960995. Index: test_zlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zlib.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_zlib.py 5 Jun 2004 19:02:52 -0000 1.25 --- test_zlib.py 5 Jun 2004 19:34:28 -0000 1.26 *************** *** 75,97 **** # Test compression in one go (whole message compression) def test_speech(self): ! # decompress(compress(data)) better be data ! x = zlib.compress(hamlet_scene) ! self.assertEqual(zlib.decompress(x), hamlet_scene) ! ! def test_speech8(self): ! # decompress(compress(data)) better be data -- more compression chances ! data = hamlet_scene * 8 ! x = zlib.compress(data) ! self.assertEqual(zlib.decompress(x), data) ! ! def test_speech16(self): ! # decompress(compress(data)) better be data -- more compression chances ! data = hamlet_scene * 16 ! x = zlib.compress(data) ! self.assertEqual(zlib.decompress(x), data) def test_speech128(self): ! # decompress(compress(data)) better be data -- more compression chances ! data = hamlet_scene * 8 * 16 x = zlib.compress(data) self.assertEqual(zlib.decompress(x), data) --- 75,84 ---- # Test compression in one go (whole message compression) def test_speech(self): ! x = zlib.compress(HAMLET_SCENE) ! self.assertEqual(zlib.decompress(x), HAMLET_SCENE) def test_speech128(self): ! # compress more data ! data = HAMLET_SCENE * 128 x = zlib.compress(data) self.assertEqual(zlib.decompress(x), data) *************** *** 102,121 **** class CompressObjectTestCase(unittest.TestCase): # Test compression object - def test_pairsmall(self): - # use compress object in straightforward manner, decompress w/ object - data = hamlet_scene - co = zlib.compressobj() - x1 = co.compress(data) - x2 = co.flush() - self.assertRaises(zlib.error, co.flush) # second flush should not work - dco = zlib.decompressobj() - y1 = dco.decompress(x1 + x2) - y2 = dco.flush() - self.assertEqual(data, y1 + y2) - def test_pair(self): ! # straightforward compress/decompress objects, more compression ! data = hamlet_scene * 8 * 16 ! co = zlib.compressobj(zlib.Z_BEST_COMPRESSION, zlib.DEFLATED) x1 = co.compress(data) x2 = co.flush() --- 89,96 ---- class CompressObjectTestCase(unittest.TestCase): # Test compression object def test_pair(self): ! # straightforward compress/decompress objects ! data = HAMLET_SCENE * 128 ! co = zlib.compressobj() x1 = co.compress(data) x2 = co.flush() *************** *** 134,147 **** strategy = zlib.Z_FILTERED co = zlib.compressobj(level, method, wbits, memlevel, strategy) ! x1 = co.compress(hamlet_scene) x2 = co.flush() dco = zlib.decompressobj(wbits) y1 = dco.decompress(x1 + x2) y2 = dco.flush() ! self.assertEqual(hamlet_scene, y1 + y2) def test_compressincremental(self): # compress object in steps, decompress object as one-shot ! data = hamlet_scene * 8 * 16 co = zlib.compressobj() bufs = [] --- 109,122 ---- strategy = zlib.Z_FILTERED co = zlib.compressobj(level, method, wbits, memlevel, strategy) ! x1 = co.compress(HAMLET_SCENE) x2 = co.flush() dco = zlib.decompressobj(wbits) y1 = dco.decompress(x1 + x2) y2 = dco.flush() ! self.assertEqual(HAMLET_SCENE, y1 + y2) def test_compressincremental(self): # compress object in steps, decompress object as one-shot ! data = HAMLET_SCENE * 128 co = zlib.compressobj() bufs = [] *************** *** 156,166 **** self.assertEqual(data, y1 + y2) ! def test_decompressincremental(self): # compress object in steps, decompress object in steps ! data = hamlet_scene * 8 * 16 co = zlib.compressobj() bufs = [] ! for i in range(0, len(data), 256): ! bufs.append(co.compress(data[i:i+256])) bufs.append(co.flush()) combuf = ''.join(bufs) --- 131,142 ---- self.assertEqual(data, y1 + y2) ! def test_decompinc(self, flush=False, source=None, cx=256, dcx=64): # compress object in steps, decompress object in steps ! source = source or HAMLET_SCENE ! data = source * 128 co = zlib.compressobj() bufs = [] ! for i in range(0, len(data), cx): ! bufs.append(co.compress(data[i:i+cx])) bufs.append(co.flush()) combuf = ''.join(bufs) *************** *** 170,267 **** dco = zlib.decompressobj() bufs = [] ! for i in range(0, len(combuf), 128): ! bufs.append(dco.decompress(combuf[i:i+128])) self.assertEqual('', dco.unconsumed_tail, ######## "(A) uct should be '': not %d long" % ! len(dco.unconsumed_tail)) ! bufs.append(dco.flush()) self.assertEqual('', dco.unconsumed_tail, ######## ! "(B) uct should be '': not %d long" % ! len(dco.unconsumed_tail)) self.assertEqual(data, ''.join(bufs)) # Failure means: "decompressobj with init options failed" ! def test_decompinc(self,sizes=[128],flush=True,source=None,cx=256,dcx=64): ! # compress object in steps, decompress object in steps, loop sizes ! source = source or hamlet_scene ! for reps in sizes: ! data = source * reps ! co = zlib.compressobj() ! bufs = [] ! for i in range(0, len(data), cx): ! bufs.append(co.compress(data[i:i+cx])) ! bufs.append(co.flush()) ! combuf = ''.join(bufs) ! ! self.assertEqual(data, zlib.decompress(combuf)) ! ! dco = zlib.decompressobj() ! bufs = [] ! for i in range(0, len(combuf), dcx): ! bufs.append(dco.decompress(combuf[i:i+dcx])) ! self.assertEqual('', dco.unconsumed_tail, ######## ! "(A) uct should be '': not %d long" % ! len(dco.unconsumed_tail)) ! if flush: ! bufs.append(dco.flush()) ! else: ! while True: ! chunk = dco.decompress('') ! if chunk: ! bufs.append(chunk) ! else: ! break ! self.assertEqual('', dco.unconsumed_tail, ######## ! "(B) uct should be '': not %d long" % ! len(dco.unconsumed_tail)) ! self.assertEqual(data, ''.join(bufs)) ! # Failure means: "decompressobj with init options failed" ! ! def test_decompimax(self,sizes=[128],flush=True,source=None,cx=256,dcx=64): ! # compress in steps, decompress in length-restricted steps, loop sizes ! source = source or hamlet_scene ! for reps in sizes: ! # Check a decompression object with max_length specified ! data = source * reps ! co = zlib.compressobj() ! bufs = [] ! for i in range(0, len(data), cx): ! bufs.append(co.compress(data[i:i+cx])) ! bufs.append(co.flush()) ! combuf = ''.join(bufs) ! self.assertEqual(data, zlib.decompress(combuf), ! 'compressed data failure') ! ! dco = zlib.decompressobj() ! bufs = [] ! cb = combuf ! while cb: ! #max_length = 1 + len(cb)//10 ! chunk = dco.decompress(cb, dcx) ! self.failIf(len(chunk) > dcx, ! 'chunk too big (%d>%d)' % (len(chunk), dcx)) ! bufs.append(chunk) ! cb = dco.unconsumed_tail ! if flush: ! bufs.append(dco.flush()) ! else: ! while True: ! chunk = dco.decompress('', dcx) ! self.failIf(len(chunk) > dcx, ! 'chunk too big in tail (%d>%d)' % (len(chunk), dcx)) ! if chunk: ! bufs.append(chunk) ! else: ! break ! self.assertEqual(len(data), len(''.join(bufs))) ! self.assertEqual(data, ''.join(bufs), 'Wrong data retrieved') ! def test_decompressmaxlen(self): # Check a decompression object with max_length specified ! data = hamlet_scene * 8 * 16 co = zlib.compressobj() bufs = [] ! for i in range(0, len(data), 256): ! bufs.append(co.compress(data[i:i+256])) bufs.append(co.flush()) combuf = ''.join(bufs) --- 146,181 ---- dco = zlib.decompressobj() bufs = [] ! for i in range(0, len(combuf), dcx): ! bufs.append(dco.decompress(combuf[i:i+dcx])) self.assertEqual('', dco.unconsumed_tail, ######## "(A) uct should be '': not %d long" % ! len(dco.unconsumed_tail)) ! if flush: ! bufs.append(dco.flush()) ! else: ! while True: ! chunk = dco.decompress('') ! if chunk: ! bufs.append(chunk) ! else: ! break self.assertEqual('', dco.unconsumed_tail, ######## ! "(B) uct should be '': not %d long" % ! len(dco.unconsumed_tail)) self.assertEqual(data, ''.join(bufs)) # Failure means: "decompressobj with init options failed" ! def test_decompincflush(self): ! self.test_decompinc(flush=True) ! def test_decompimax(self, source=None, cx=256, dcx=64): ! # compress in steps, decompress in length-restricted steps ! source = source or HAMLET_SCENE # Check a decompression object with max_length specified ! data = source * 128 co = zlib.compressobj() bufs = [] ! for i in range(0, len(data), cx): ! bufs.append(co.compress(data[i:i+cx])) bufs.append(co.flush()) combuf = ''.join(bufs) *************** *** 273,290 **** cb = combuf while cb: ! max_length = 1 + len(cb)//10 ! chunk = dco.decompress(cb, max_length) ! self.failIf(len(chunk) > max_length, ! 'chunk too big (%d>%d)' % (len(chunk),max_length)) bufs.append(chunk) cb = dco.unconsumed_tail bufs.append(dco.flush()) - self.assertEqual(len(data), len(''.join(bufs))) self.assertEqual(data, ''.join(bufs), 'Wrong data retrieved') ! def test_decompressmaxlenflushless(self): ! # identical to test_decompressmaxlen except flush is replaced ! # with an equivalent. This works and other fails on (eg) 2.2.2 ! data = hamlet_scene * 8 * 16 co = zlib.compressobj() bufs = [] --- 187,202 ---- cb = combuf while cb: ! #max_length = 1 + len(cb)//10 ! chunk = dco.decompress(cb, dcx) ! self.failIf(len(chunk) > dcx, ! 'chunk too big (%d>%d)' % (len(chunk), dcx)) bufs.append(chunk) cb = dco.unconsumed_tail bufs.append(dco.flush()) self.assertEqual(data, ''.join(bufs), 'Wrong data retrieved') ! def test_decompressmaxlen(self, flush=False): ! # Check a decompression object with max_length specified ! data = HAMLET_SCENE * 128 co = zlib.compressobj() bufs = [] *************** *** 294,298 **** combuf = ''.join(bufs) self.assertEqual(data, zlib.decompress(combuf), ! 'compressed data mismatch') dco = zlib.decompressobj() --- 206,210 ---- combuf = ''.join(bufs) self.assertEqual(data, zlib.decompress(combuf), ! 'compressed data failure') dco = zlib.decompressobj() *************** *** 306,319 **** bufs.append(chunk) cb = dco.unconsumed_tail ! ! #bufs.append(dco.flush()) ! while len(chunk): ! chunk = dco.decompress('', max_length) ! self.failIf(len(chunk) > max_length, ! 'chunk too big (%d>%d)' % (len(chunk),max_length)) ! bufs.append(chunk) ! self.assertEqual(data, ''.join(bufs), 'Wrong data retrieved') def test_maxlenmisc(self): # Misc tests of max_length --- 218,234 ---- bufs.append(chunk) cb = dco.unconsumed_tail ! if flush: ! bufs.append(dco.flush()) ! else: ! while chunk: ! chunk = dco.decompress('', max_length) ! self.failIf(len(chunk) > max_length, ! 'chunk too big (%d>%d)' % (len(chunk),max_length)) ! bufs.append(chunk) self.assertEqual(data, ''.join(bufs), 'Wrong data retrieved') + def test_decompressmaxlenflush(self): + self.test_decompressmaxlen(flush=True) + def test_maxlenmisc(self): # Misc tests of max_length *************** *** 328,332 **** sync_opt = [getattr(zlib, opt) for opt in sync_opt if hasattr(zlib, opt)] ! data = hamlet_scene * 8 for sync in sync_opt: --- 243,247 ---- sync_opt = [getattr(zlib, opt) for opt in sync_opt if hasattr(zlib, opt)] ! data = HAMLET_SCENE * 8 for sync in sync_opt: *************** *** 350,354 **** # Create compressor and decompressor objects ! co = zlib.compressobj(9) dco = zlib.decompressobj() --- 265,269 ---- # Create compressor and decompressor objects ! co = zlib.compressobj(zlib.Z_BEST_COMPRESSION) dco = zlib.decompressobj() *************** *** 376,396 **** self.assertEqual(expanded, data, "17K random source doesn't match") - def test_manydecompinc(self): - # Run incremental decompress test for a large range of sizes - self.test_decompinc(sizes=[1< Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30784 Modified Files: intobject.c Log Message: Reword message Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.109 retrieving revision 2.110 diff -C2 -d -r2.109 -r2.110 *** intobject.c 5 Jun 2004 19:29:41 -0000 2.109 --- intobject.c 5 Jun 2004 19:49:12 -0000 2.110 *************** *** 929,933 **** if (!PyLong_Check(tmp)) { PyErr_SetString(PyExc_ValueError, ! "value must be convertable to an int"); Py_DECREF(tmp); return NULL; --- 929,933 ---- if (!PyLong_Check(tmp)) { PyErr_SetString(PyExc_ValueError, ! "value can't be converted to int"); Py_DECREF(tmp); return NULL; From akuchling at users.sourceforge.net Sat Jun 5 15:49:54 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 15:49:57 2004 Subject: [Python-checkins] python/dist/src/Objects intobject.c, 2.105.8.2, 2.105.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30872 Modified Files: Tag: release23-maint intobject.c Log Message: Reword message Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.105.8.2 retrieving revision 2.105.8.3 diff -C2 -d -r2.105.8.2 -r2.105.8.3 *** intobject.c 5 Jun 2004 19:30:29 -0000 2.105.8.2 --- intobject.c 5 Jun 2004 19:49:52 -0000 2.105.8.3 *************** *** 947,951 **** if (!PyLong_Check(tmp)) { PyErr_SetString(PyExc_ValueError, ! "value must be convertable to an int"); return NULL; } --- 947,951 ---- if (!PyLong_Check(tmp)) { PyErr_SetString(PyExc_ValueError, ! "value can't be converted to int"); return NULL; } From akuchling at users.sourceforge.net Sat Jun 5 15:58:47 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Jun 5 15:58:50 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libposixpath.tex, 1.38, 1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32286 Modified Files: libposixpath.tex Log Message: [Bug #966256] Clarify description of realpath() Index: libposixpath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libposixpath.tex,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** libposixpath.tex 29 Oct 2003 00:46:19 -0000 1.38 --- libposixpath.tex 5 Jun 2004 19:58:45 -0000 1.39 *************** *** 159,165 **** \begin{funcdesc}{realpath}{path} ! Return the canonical path of the specified filename, eliminating any symbolic links encountered in the path. - Availability: \UNIX. \versionadded{2.2} \end{funcdesc} --- 159,164 ---- \begin{funcdesc}{realpath}{path} ! Return the absolute canonical path of the specified filename, eliminating any symbolic links encountered in the path. \versionadded{2.2} \end{funcdesc} From mondragon at users.sourceforge.net Sat Jun 5 21:17:55 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Sat Jun 5 21:17:59 2004 Subject: [Python-checkins] python/dist/src/Doc/mac libmacfs.tex, 1.30, 1.31 libmacostools.tex, 1.16, 1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14579 Modified Files: libmacfs.tex libmacostools.tex Log Message: Doc fix for SF #962633. Index: libmacfs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacfs.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** libmacfs.tex 5 Sep 2003 14:01:15 -0000 1.30 --- libmacfs.tex 6 Jun 2004 01:17:52 -0000 1.31 *************** *** 10,14 **** \class{FSSpec}, \class{FSRef} and \class{Alias} handling use the \module{Carbon.File} or \refmodule{Carbon.Folder} module. For file ! dialogs use the \refmodule{EasyDialogs} module.} This module provides access to Macintosh \class{FSSpec} handling, the --- 10,15 ---- \class{FSSpec}, \class{FSRef} and \class{Alias} handling use the \module{Carbon.File} or \refmodule{Carbon.Folder} module. For file ! dialogs use the \refmodule{EasyDialogs} module. Also, this module is ! known to not work correctly with UFS partitions.} This module provides access to Macintosh \class{FSSpec} handling, the Index: libmacostools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacostools.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** libmacostools.tex 12 Feb 2003 09:58:33 -0000 1.16 --- libmacostools.tex 6 Jun 2004 01:17:52 -0000 1.17 *************** *** 9,13 **** This module contains some convenience routines for file-manipulation on the Macintosh. All file parameters can be specified as ! pathnames, \class{FSRef} or \class{FSSpec} objects. The \module{macostools} module defines the following functions: --- 9,15 ---- This module contains some convenience routines for file-manipulation on the Macintosh. All file parameters can be specified as ! pathnames, \class{FSRef} or \class{FSSpec} objects. This module ! expects a filesystem which supports forked files, so it should not ! be used on UFS partitions. The \module{macostools} module defines the following functions: From kbk at users.sourceforge.net Sat Jun 5 21:29:24 2004 From: kbk at users.sourceforge.net (kbk@users.sourceforge.net) Date: Sat Jun 5 21:29:29 2004 Subject: [Python-checkins] python/dist/src/Lib/idlelib CodeContext.py, 1.3, 1.4 EditorWindow.py, 1.58, 1.59 NEWS.txt, 1.34, 1.35 PyShell.py, 1.87, 1.88 config-extensions.def, 1.14, 1.15 configHandler.py, 1.34, 1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16454 Modified Files: CodeContext.py EditorWindow.py NEWS.txt PyShell.py config-extensions.def configHandler.py Log Message: Noam Raphel: Further developemt of CodeContext feature. The visibility state of the code context pane is now persistent between sessions and the pane does not appear in the shell window. M CodeContext.py M EditorWindow.py M NEWS.txt M PyShell.py M config-extensions.def M configHandler.py Index: CodeContext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/CodeContext.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CodeContext.py 26 Apr 2004 22:26:04 -0000 1.3 --- CodeContext.py 6 Jun 2004 01:29:21 -0000 1.4 *************** *** 1,5 **** """CodeContext - Display the block context of code at top of edit window ! Once code has scolled off the top of the screen, it can be difficult to determine which block you are in. This extension implements a pane at the top of each IDLE edit window which provides block structure --- 1,5 ---- """CodeContext - Display the block context of code at top of edit window ! Once code has scrolled off the top of the screen, it can be difficult to determine which block you are in. This extension implements a pane at the top of each IDLE edit window which provides block structure *************** *** 13,22 **** import Tkinter from configHandler import idleConf ! from PyShell import PyShell import re ! BLOCKOPENERS = dict([(x, None) for x in ("class", "def", "elif", "else", ! "except", "finally", "for", "if", ! "try", "while")]) INFINITY = 1 << 30 UPDATEINTERVAL = 100 # millisec --- 13,21 ---- import Tkinter from configHandler import idleConf ! from sets import Set import re ! BLOCKOPENERS = Set(["class", "def", "elif", "else", "except", "finally", "for", ! "if", "try", "while"]) INFINITY = 1 << 30 UPDATEINTERVAL = 100 # millisec *************** *** 34,42 **** fgcolor = idleConf.GetOption("extensions", "CodeContext", "fgcolor", type="str", default="Black") - default_on = idleConf.GetOption("extensions", "CodeContext", - "default_on", type="int", default=0) def __init__(self, editwin): - if isinstance(editwin, PyShell): - return self.editwin = editwin self.text = editwin.text --- 33,37 ---- *************** *** 46,50 **** self.info = list(self.interesting_lines(1)) self.lastfirstline = 1 ! if self.default_on: self.toggle_code_context_event() self.editwin.setvar('<>', True) --- 41,47 ---- self.info = list(self.interesting_lines(1)) self.lastfirstline = 1 ! visible = idleConf.GetOption("extensions", "CodeContext", ! "visible", type="bool", default=False) ! if visible: self.toggle_code_context_event() self.editwin.setvar('<>', True) *************** *** 68,71 **** --- 65,71 ---- self.label.destroy() self.label = None + idleConf.SetOption("extensions", "CodeContext", "visible", + str(self.label is not None)) + idleConf.SaveUserCfgFiles() def get_line_info(self, linenum): Index: EditorWindow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/EditorWindow.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** EditorWindow.py 24 Apr 2004 03:01:48 -0000 1.58 --- EditorWindow.py 6 Jun 2004 01:29:21 -0000 1.59 *************** *** 752,763 **** def get_standard_extension_names(self): ! return idleConf.GetExtensions() def load_extension(self, name): mod = __import__(name, globals(), locals(), []) cls = getattr(mod, name) ins = cls(self) self.extensions[name] = ins - keydefs=idleConf.GetExtensionBindings(name) if keydefs: self.apply_bindings(keydefs) --- 752,765 ---- def get_standard_extension_names(self): ! return idleConf.GetExtensions(editor_only=True) def load_extension(self, name): mod = __import__(name, globals(), locals(), []) cls = getattr(mod, name) + keydefs = idleConf.GetExtensionBindings(name) + if hasattr(cls, "menudefs"): + self.fill_menus(cls.menudefs, keydefs) ins = cls(self) self.extensions[name] = ins if keydefs: self.apply_bindings(keydefs) *************** *** 771,776 **** if hasattr(ins, methodname): self.text.bind(vevent, getattr(ins, methodname)) - if hasattr(ins, "menudefs"): - self.fill_menus(ins.menudefs, keydefs) return ins --- 773,776 ---- Index: NEWS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** NEWS.txt 21 Apr 2004 20:06:22 -0000 1.34 --- NEWS.txt 6 Jun 2004 01:29:21 -0000 1.35 *************** *** 1,7 **** What's New in IDLE 1.1a0? ! =================================== *Release date: XX-XXX-2004* - New Extension: CodeContext. Provides block structuring hints for code which has scrolled above an edit window. Patch 936169 Noam Raphael. --- 1,15 ---- What's New in IDLE 1.1a0? ! ========================= *Release date: XX-XXX-2004* + - CodeContext hint pane visibility state is now persistent across sessions. + The pane no longer appears in the shell window. Added capability to limit + extensions to shell window or editor windows. Noam Raphael addition + to Patch 936169. + + - Paragraph reformat width is now a configurable parameter in the + Options GUI. + - New Extension: CodeContext. Provides block structuring hints for code which has scrolled above an edit window. Patch 936169 Noam Raphael. *************** *** 53,57 **** What's New in IDLE 1.0? ! =================================== *Release date: 29-Jul-2003* --- 61,65 ---- What's New in IDLE 1.0? ! ======================= *Release date: 29-Jul-2003* *************** *** 62,66 **** What's New in IDLE 1.0 release candidate 2? ! =================================== *Release date: 24-Jul-2003* --- 70,74 ---- What's New in IDLE 1.0 release candidate 2? ! =========================================== *Release date: 24-Jul-2003* *************** *** 70,74 **** What's New in IDLE 1.0 release candidate 1? ! =================================== *Release date: 18-Jul-2003* --- 78,82 ---- What's New in IDLE 1.0 release candidate 1? ! =========================================== *Release date: 18-Jul-2003* *************** *** 91,95 **** What's New in IDLE 1.0b2? ! =================================== *Release date: 29-Jun-2003* --- 99,103 ---- What's New in IDLE 1.0b2? ! ========================= *Release date: 29-Jun-2003* *************** *** 132,136 **** What's New in IDLEfork 0.9b1? ! =================================== *Release date: 02-Jun-2003* --- 140,144 ---- What's New in IDLEfork 0.9b1? ! ============================= *Release date: 02-Jun-2003* Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** PyShell.py 8 Mar 2004 18:15:31 -0000 1.87 --- PyShell.py 6 Jun 2004 01:29:21 -0000 1.88 *************** *** 807,810 **** --- 807,813 ---- self.pollinterval = 50 # millisec + def get_standard_extension_names(self): + return idleConf.GetExtensions(shell_only=True) + reading = False executing = False Index: config-extensions.def =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/config-extensions.def,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** config-extensions.def 24 Apr 2004 03:08:13 -0000 1.14 --- config-extensions.def 6 Jun 2004 01:29:22 -0000 1.15 *************** *** 1,2 **** --- 1,4 ---- + # config-extensions.def + # # IDLE reads several config files to determine user preferences. This # file is the default configuration file for IDLE extensions settings. *************** *** 4,24 **** # Each extension must have at least one section, named after the extension # module. This section must contain an 'enable' item (=1 to enable the ! # extension, =0 to disable it) and also contain any other general configuration ! # items for the extension. Each extension must define at least one section ! # named ExtensionName_bindings or ExtensionName_cfgBindings. If present, ! # ExtensionName_bindings defines virtual event bindings for the extension that ! # are not user re-configurable. If present, ExtensionName_cfgBindings ! # defines virtual event bindings for the extension that may be sensibly ! # re-configured. If there are no keybindings for a menus' virtual events, ! # include lines like <>= (See [CodeContext], below.) ! # Currently it is necessary to manually modify this file to change extension # key bindings and default values. To customize, create # ~/.idlerc/config-extensions.cfg and append the appropriate customized # section(s). Those sections will override the defaults in this file. ! # Note: If a keybinding is already in use when the extension is # loaded, the extension's virtual event's keybinding will be set to ''. ! # See config-keys.def for notes on specifying keys and extend.txt for # information on creating IDLE extensions. --- 6,30 ---- # Each extension must have at least one section, named after the extension # module. This section must contain an 'enable' item (=1 to enable the ! # extension, =0 to disable it), it may contain 'enable_editor' or 'enable_shell' ! # items, to apply it only to editor/shell windows, and may also contain any ! # other general configuration items for the extension. ! # ! # Each extension must define at least one section named ExtensionName_bindings ! # or ExtensionName_cfgBindings. If present, ExtensionName_bindings defines ! # virtual event bindings for the extension that are not user re-configurable. ! # If present, ExtensionName_cfgBindings defines virtual event bindings for the ! # extension that may be sensibly re-configured. ! # ! # If there are no keybindings for a menus' virtual events, include lines like ! # <>= (See [CodeContext], below.) ! # # Currently it is necessary to manually modify this file to change extension # key bindings and default values. To customize, create # ~/.idlerc/config-extensions.cfg and append the appropriate customized # section(s). Those sections will override the defaults in this file. ! # # Note: If a keybinding is already in use when the extension is # loaded, the extension's virtual event's keybinding will be set to ''. ! # # See config-keys.def for notes on specifying keys and extend.txt for # information on creating IDLE extensions. *************** *** 66,71 **** [CodeContext] enable=1 numlines=3 ! default_on=0 bgcolor=LightGray fgcolor=Black --- 72,78 ---- [CodeContext] enable=1 + enable_shell=0 numlines=3 ! visible=0 bgcolor=LightGray fgcolor=Black Index: configHandler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/configHandler.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** configHandler.py 8 Mar 2004 18:15:31 -0000 1.34 --- configHandler.py 6 Jun 2004 01:29:22 -0000 1.35 *************** *** 216,220 **** return userDir ! def GetOption(self, configType, section, option, default=None, type=None): """ Get an option value for given config type and given general --- 216,221 ---- return userDir ! def GetOption(self, configType, section, option, default=None, type=None, ! warn_on_default=True): """ Get an option value for given config type and given general *************** *** 225,229 **** either the user or the default configuration. configType must be one of ('main','extensions','highlight','keys') ! If a default is returned a warning is printed to stderr. """ if self.userCfg[configType].has_option(section,option): --- 226,232 ---- either the user or the default configuration. configType must be one of ('main','extensions','highlight','keys') ! If a default is returned, and warn_on_default is True, a warning is ! printed to stderr. ! """ if self.userCfg[configType].has_option(section,option): *************** *** 232,243 **** return self.defaultCfg[configType].Get(section, option, type=type) else: #returning default, print warning ! warning=('\n Warning: configHandler.py - IdleConf.GetOption -\n' ! ' problem retrieving configration option %r\n' ! ' from section %r.\n' ! ' returning default value: %r\n' % ! (option, section, default)) ! sys.stderr.write(warning) return default def GetSectionList(self, configSet, configType): """ --- 235,253 ---- return self.defaultCfg[configType].Get(section, option, type=type) else: #returning default, print warning ! if warn_on_default: ! warning = ('\n Warning: configHandler.py - IdleConf.GetOption -\n' ! ' problem retrieving configration option %r\n' ! ' from section %r.\n' ! ' returning default value: %r\n' % ! (option, section, default)) ! sys.stderr.write(warning) return default + def SetOption(self, configType, section, option, value): + """In user's config file, set section's option to value. + + """ + self.userCfg[configType].SetOption(section, option, value) + def GetSectionList(self, configSet, configType): """ *************** *** 357,364 **** return self.GetOption('main','Keys','name',default='') ! def GetExtensions(self, activeOnly=1): """ Gets a list of all idle extensions declared in the config files. ! activeOnly - boolean, if true only return active (enabled) extensions """ extns=self.RemoveKeyBindNames( --- 367,374 ---- return self.GetOption('main','Keys','name',default='') ! def GetExtensions(self, active_only=True, editor_only=False, shell_only=False): """ Gets a list of all idle extensions declared in the config files. ! active_only - boolean, if true only return active (enabled) extensions """ extns=self.RemoveKeyBindNames( *************** *** 369,379 **** if extn not in extns: #user has added own extension extns.append(extn) ! if activeOnly: activeExtns=[] for extn in extns: ! if self.GetOption('extensions',extn,'enable',default=1, ! type='bool'): #the extension is enabled ! activeExtns.append(extn) return activeExtns else: --- 379,399 ---- if extn not in extns: #user has added own extension extns.append(extn) ! if active_only: activeExtns=[] for extn in extns: ! if self.GetOption('extensions', extn, 'enable', default=True, ! type='bool'): #the extension is enabled ! if editor_only or shell_only: ! if editor_only: ! option = "enable_editor" ! else: ! option = "enable_shell" ! if self.GetOption('extensions', extn,option, ! default=True, type='bool', ! warn_on_default=False): ! activeExtns.append(extn) ! else: ! activeExtns.append(extn) return activeExtns else: *************** *** 402,406 **** extName=None vEvent='<<'+virtualEvent+'>>' ! for extn in self.GetExtensions(activeOnly=0): for event in self.GetExtensionKeys(extn).keys(): if event == vEvent: --- 422,426 ---- extName=None vEvent='<<'+virtualEvent+'>>' ! for extn in self.GetExtensions(active_only=0): for event in self.GetExtensionKeys(extn).keys(): if event == vEvent: *************** *** 483,487 **** """ keySet=self.GetCoreKeys(keySetName) ! activeExtns=self.GetExtensions(activeOnly=1) for extn in activeExtns: extKeys=self.__GetRawExtensionKeys(extn) --- 503,507 ---- """ keySet=self.GetCoreKeys(keySetName) ! activeExtns=self.GetExtensions(active_only=1) for extn in activeExtns: extKeys=self.__GetRawExtensionKeys(extn) From montanaro at users.sourceforge.net Sun Jun 6 11:53:21 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sun Jun 6 11:53:25 2004 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.152,1.153 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26973 Modified Files: regrtest.py Log Message: add -L flag to cause leaks(1) command to run just before exit Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.152 retrieving revision 1.153 diff -C2 -d -r1.152 -r1.153 *** regrtest.py 7 Feb 2004 22:43:03 -0000 1.152 --- regrtest.py 6 Jun 2004 15:53:18 -0000 1.153 *************** *** 21,24 **** --- 21,25 ---- -t: threshold -- call gc.set_threshold(N) -T: coverage -- turn on code coverage using the trace module + -L: runleaks -- run the leaks(1) command just before exit If non-option arguments are present, they are names for tests to run, *************** *** 43,46 **** --- 44,51 ---- whittling down failures involving interactions among tests. + -L causes the leaks(1) command to be run just before exit if it exists. + leaks(1) is available on Mac OS X and presumably on some other + FreeBSD-derived systems. + -u is used to specify which special resource intensive tests to run, such as those requiring large file support or network connectivity. *************** *** 119,123 **** def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, exclude=False, single=False, randomize=False, fromfile=None, ! findleaks=False, use_resources=None, trace=False): """Execute a test suite. --- 124,128 ---- def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, exclude=False, single=False, randomize=False, fromfile=None, ! findleaks=False, use_resources=None, trace=False, runleaks=False): """Execute a test suite. *************** *** 144,151 **** test_support.record_original_stdout(sys.stdout) try: ! opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:T', ['help', 'verbose', 'quiet', 'generate', 'exclude', 'single', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', ]) except getopt.error, msg: --- 149,157 ---- test_support.record_original_stdout(sys.stdout) try: ! opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TL', ['help', 'verbose', 'quiet', 'generate', 'exclude', 'single', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', + 'runleaks' ]) except getopt.error, msg: *************** *** 175,178 **** --- 181,186 ---- elif o in ('-l', '--findleaks'): findleaks = True + elif o in ('-L', '--runleaks'): + runleaks = True elif o in ('-t', '--threshold'): import gc *************** *** 351,354 **** --- 359,365 ---- r.write_results(show_missing=True, summary=True, coverdir=coverdir) + if runleaks: + os.system("leaks %d" % os.getpid()) + sys.exit(len(bad) > 0) From pje at users.sourceforge.net Sun Jun 6 11:59:21 2004 From: pje at users.sourceforge.net (pje@users.sourceforge.net) Date: Sun Jun 6 11:59:24 2004 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27746 Modified Files: newtypes.tex Log Message: Added documentation to address SF bug #963246: limitations on multiple inheritance in Python when a C type is one of the bases. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** newtypes.tex 7 Dec 2003 11:40:17 -0000 1.35 --- newtypes.tex 6 Jun 2004 15:59:18 -0000 1.36 *************** *** 161,164 **** --- 161,176 ---- \cfunction{PyObject_New()}. + \note{If you want your type to be subclassable from Python, and your + type has the same \member{tp_basicsize} as its base type, you may + have problems with multiple inheritance. A Python subclass of your + type will have to list your type first in its \member{__bases__}, or + else it will not be able to call your type's \method{__new__} method + without getting an error. You can avoid this problem by ensuring + that your type has a larger value for \member{tp_basicsize} than + its base type does. Most of the time, this will be true anyway, + because either your base type will be \class{object}, or else you will + be adding data members to your base type, and therefore increasing its + size.} + \begin{verbatim} 0, /* tp_itemsize */ *************** *** 385,388 **** --- 397,412 ---- default allocation. + \note{If you are creating a co-operative \member{tp_new} (one that + calls a base type's \member{tp_new} or \method{__new__}), you + must \emph{not} try to determine what method to call using + method resolution order at runtime. Always statically determine + what type you are going to call, and call its \member{tp_new} + directly, or via \code{type->tp_base->tp_new}. If you do + not do this, Python subclasses of your type that also inherit + from other Python-defined classes may not work correctly. + (Specifically, you may not be able to create instances of + such subclasses without getting a \exception{TypeError}.)} + + We provide an initialization function: From tim_one at users.sourceforge.net Sun Jun 6 12:51:49 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun Jun 6 12:51:52 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libmmap.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3978/Doc/lib Modified Files: libmmap.tex Log Message: SF 964876 mapping a 0 length file Document that it can't be done on Windows. Index: libmmap.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmmap.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libmmap.tex 3 Dec 2001 18:27:22 -0000 1.8 --- libmmap.tex 6 Jun 2004 16:51:46 -0000 1.9 *************** *** 43,50 **** \strong{(Windows version)} Maps \var{length} bytes from the file specified by the file handle \var{fileno}, and returns a mmap ! object. If \var{length} is \code{0}, the maximum length of the map ! will be the current size of the file when \function{mmap()} is ! called. ! \var{tagname}, if specified and not \code{None}, is a string giving a tag name for the mapping. Windows allows you to have many --- 43,52 ---- \strong{(Windows version)} Maps \var{length} bytes from the file specified by the file handle \var{fileno}, and returns a mmap ! object. If \var{length} is larger than the current size of the file, ! the file is extended to contain \var{length} bytes. If \var{length} ! is \code{0}, the maximum length of the map is the current size ! of the file, except that if the file is empty Windows raises an ! exception (you cannot create an empty mapping on Windows). ! \var{tagname}, if specified and not \code{None}, is a string giving a tag name for the mapping. Windows allows you to have many *************** *** 62,66 **** specified by the file descriptor \var{fileno}, and returns a mmap object. ! \var{flags} specifies the nature of the mapping. \constant{MAP_PRIVATE} creates a private copy-on-write mapping, so --- 64,68 ---- specified by the file descriptor \var{fileno}, and returns a mmap object. ! \var{flags} specifies the nature of the mapping. \constant{MAP_PRIVATE} creates a private copy-on-write mapping, so *************** *** 69,78 **** with all other processes mapping the same areas of the file. The default value is \constant{MAP_SHARED}. ! \var{prot}, if specified, gives the desired memory protection; the two most useful values are \constant{PROT_READ} and \constant{PROT_WRITE}, to specify that the pages may be read or written. \var{prot} defaults to \constant{PROT_READ | PROT_WRITE}. ! \var{access} may be specified in lieu of \var{flags} and \var{prot} as an optional keyword parameter. It is an error to specify both --- 71,80 ---- with all other processes mapping the same areas of the file. The default value is \constant{MAP_SHARED}. ! \var{prot}, if specified, gives the desired memory protection; the two most useful values are \constant{PROT_READ} and \constant{PROT_WRITE}, to specify that the pages may be read or written. \var{prot} defaults to \constant{PROT_READ | PROT_WRITE}. ! \var{access} may be specified in lieu of \var{flags} and \var{prot} as an optional keyword parameter. It is an error to specify both *************** *** 124,128 **** \begin{methoddesc}{readline}{} ! Returns a single line, starting at the current file position and up to the next newline. \end{methoddesc} --- 126,130 ---- \begin{methoddesc}{readline}{} ! Returns a single line, starting at the current file position and up to the next newline. \end{methoddesc} From tim_one at users.sourceforge.net Sun Jun 6 12:54:17 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun Jun 6 12:54:20 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libmmap.tex,1.8,1.8.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4418 Modified Files: Tag: release23-maint libmmap.tex Log Message: SF 964876 mapping a 0 length file Document that it can't be done on Windows. Backported from HEAD. Index: libmmap.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmmap.tex,v retrieving revision 1.8 retrieving revision 1.8.24.1 diff -C2 -d -r1.8 -r1.8.24.1 *** libmmap.tex 3 Dec 2001 18:27:22 -0000 1.8 --- libmmap.tex 6 Jun 2004 16:54:15 -0000 1.8.24.1 *************** *** 43,50 **** \strong{(Windows version)} Maps \var{length} bytes from the file specified by the file handle \var{fileno}, and returns a mmap ! object. If \var{length} is \code{0}, the maximum length of the map ! will be the current size of the file when \function{mmap()} is ! called. ! \var{tagname}, if specified and not \code{None}, is a string giving a tag name for the mapping. Windows allows you to have many --- 43,52 ---- \strong{(Windows version)} Maps \var{length} bytes from the file specified by the file handle \var{fileno}, and returns a mmap ! object. If \var{length} is larger than the current size of the file, ! the file is extended to contain \var{length} bytes. If \var{length} ! is \code{0}, the maximum length of the map is the current size ! of the file, except that if the file is empty Windows raises an ! exception (you cannot create an empty mapping on Windows). ! \var{tagname}, if specified and not \code{None}, is a string giving a tag name for the mapping. Windows allows you to have many *************** *** 62,66 **** specified by the file descriptor \var{fileno}, and returns a mmap object. ! \var{flags} specifies the nature of the mapping. \constant{MAP_PRIVATE} creates a private copy-on-write mapping, so --- 64,68 ---- specified by the file descriptor \var{fileno}, and returns a mmap object. ! \var{flags} specifies the nature of the mapping. \constant{MAP_PRIVATE} creates a private copy-on-write mapping, so *************** *** 69,78 **** with all other processes mapping the same areas of the file. The default value is \constant{MAP_SHARED}. ! \var{prot}, if specified, gives the desired memory protection; the two most useful values are \constant{PROT_READ} and \constant{PROT_WRITE}, to specify that the pages may be read or written. \var{prot} defaults to \constant{PROT_READ | PROT_WRITE}. ! \var{access} may be specified in lieu of \var{flags} and \var{prot} as an optional keyword parameter. It is an error to specify both --- 71,80 ---- with all other processes mapping the same areas of the file. The default value is \constant{MAP_SHARED}. ! \var{prot}, if specified, gives the desired memory protection; the two most useful values are \constant{PROT_READ} and \constant{PROT_WRITE}, to specify that the pages may be read or written. \var{prot} defaults to \constant{PROT_READ | PROT_WRITE}. ! \var{access} may be specified in lieu of \var{flags} and \var{prot} as an optional keyword parameter. It is an error to specify both *************** *** 124,128 **** \begin{methoddesc}{readline}{} ! Returns a single line, starting at the current file position and up to the next newline. \end{methoddesc} --- 126,130 ---- \begin{methoddesc}{readline}{} ! Returns a single line, starting at the current file position and up to the next newline. \end{methoddesc} From kbk at users.sourceforge.net Sun Jun 6 13:41:44 2004 From: kbk at users.sourceforge.net (kbk@users.sourceforge.net) Date: Sun Jun 6 13:41:48 2004 Subject: [Python-checkins] python/dist/src/Lib/idlelib NEWS.txt, 1.23.4.7, 1.23.4.8 PyShell.py, 1.81.4.2, 1.81.4.3 ScriptBinding.py, 1.25, 1.25.8.1 idlever.py, 1.15.4.3, 1.15.4.4 run.py, 1.25.8.1, 1.25.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13584 Modified Files: Tag: release23-maint NEWS.txt PyShell.py ScriptBinding.py idlever.py run.py Log Message: Backporting [ 778323 ] Tk Dialog Upon Subprocess Socket Error Added a Tk error dialog to run.py inform the user if the subprocess can't connect to the user GUI process. Added a timeout to the GUI's listening socket. Added Tk error dialogs to PyShell.py to announce a failure to bind the port or connect to the subprocess. Clean up error handling during connection initiation phase. This is an update of Python Patch 778323. M NEWS.txt M PyShell.py M ScriptBinding.py M idlever.py M run.py Index: NEWS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v retrieving revision 1.23.4.7 retrieving revision 1.23.4.8 diff -C2 -d -r1.23.4.7 -r1.23.4.8 *** NEWS.txt 27 May 2004 05:59:16 -0000 1.23.4.7 --- NEWS.txt 6 Jun 2004 17:41:41 -0000 1.23.4.8 *************** *** 1,2 **** --- 1,13 ---- + What's New in IDLE 1.0.4? + ========================= + + *Release date: XX-XXX-2004* + + - Added a Tk error dialog to run.py inform the user if the subprocess can't + connect to the user GUI process. Added a timeout to the GUI's listening + socket. Added Tk error dialogs to PyShell.py to announce a failure to bind + the port or connect to the subprocess. Clean up error handling during + connection initiation phase. This is an update of Python Patch 778323. + What's New in IDLE 1.0.3? ========================= Index: PyShell.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/PyShell.py,v retrieving revision 1.81.4.2 retrieving revision 1.81.4.3 diff -C2 -d -r1.81.4.2 -r1.81.4.3 *** PyShell.py 30 Mar 2004 04:06:59 -0000 1.81.4.2 --- PyShell.py 6 Jun 2004 17:41:41 -0000 1.81.4.3 *************** *** 252,256 **** else: self.pyshell = PyShell(self) ! self.pyshell.begin() return self.pyshell --- 252,258 ---- else: self.pyshell = PyShell(self) ! if self.pyshell: ! if not self.pyshell.begin(): ! return None return self.pyshell *************** *** 345,348 **** --- 347,353 ---- def start_subprocess(self): + # spawning first avoids passing a listening socket to the subprocess + self.spawn_subprocess() + #time.sleep(20) # test to simulate GUI not accepting connection addr = (LOCALHOST, self.port) # Idle starts listening for connection on localhost *************** *** 353,364 **** break except socket.error, err: ! print>>sys.__stderr__,"IDLE socket error: " + err[1]\ ! + ", retrying..." else: ! display_port_binding_error() ! sys.exit() ! self.spawn_subprocess() # Accept the connection from the Python execution server ! self.rpcclt.accept() self.rpcclt.register("stdin", self.tkconsole) self.rpcclt.register("stdout", self.tkconsole.stdout) --- 358,372 ---- break except socket.error, err: ! pass else: ! self.display_port_binding_error() ! return None # Accept the connection from the Python execution server ! self.rpcclt.listening_sock.settimeout(10) ! try: ! self.rpcclt.accept() ! except socket.timeout, err: ! self.display_no_subprocess_error() ! return None self.rpcclt.register("stdin", self.tkconsole) self.rpcclt.register("stdout", self.tkconsole.stdout) *************** *** 369,376 **** self.transfer_path() self.poll_subprocess() def restart_subprocess(self): if self.restarting: ! return self.restarting = True # close only the subprocess debugger --- 377,385 ---- self.transfer_path() self.poll_subprocess() + return self.rpcclt def restart_subprocess(self): if self.restarting: ! return self.rpcclt self.restarting = True # close only the subprocess debugger *************** *** 389,393 **** console.executing = False self.spawn_subprocess() ! self.rpcclt.accept() self.transfer_path() # annotate restart in shell window and mark it --- 398,406 ---- console.executing = False self.spawn_subprocess() ! try: ! self.rpcclt.accept() ! except socket.timeout, err: ! self.display_no_subprocess_error() ! return None self.transfer_path() # annotate restart in shell window and mark it *************** *** 408,411 **** --- 421,425 ---- debug.load_breakpoints() self.restarting = False + return self.rpcclt def __request_interrupt(self): *************** *** 416,420 **** def kill_subprocess(self): ! self.rpcclt.close() self.unix_terminate() self.tkconsole.executing = False --- 430,437 ---- def kill_subprocess(self): ! try: ! self.rpcclt.close() ! except AttributeError: # no socket ! pass self.unix_terminate() self.tkconsole.executing = False *************** *** 639,649 **** del c[key] - def display_executing_dialog(self): - tkMessageBox.showerror( - "Already executing", - "The Python Shell window is already executing a command; " - "please wait until it is finished.", - master=self.tkconsole.text) - def runcommand(self, code): "Run the code without invoking the debugger" --- 656,659 ---- *************** *** 696,699 **** --- 706,737 ---- self.tkconsole.stderr.write(s) + def display_port_binding_error(self): + tkMessageBox.showerror( + "Port Binding Error", + "IDLE can't bind TCP/IP port 8833, which is necessary to " + "communicate with its Python execution server. Either " + "no networking is installed on this computer or another " + "process (another IDLE?) is using the port. Run IDLE with the -n " + "command line switch to start without a subprocess and refer to " + "Help/IDLE Help 'Running without a subprocess' for further " + "details.", + master=self.tkconsole.text) + + def display_no_subprocess_error(self): + tkMessageBox.showerror( + "Subprocess Startup Error", + "IDLE's subprocess didn't make connection. Either IDLE can't " + "start a subprocess or personal firewall software is blocking " + "the connection.", + master=self.tkconsole.text) + + def display_executing_dialog(self): + tkMessageBox.showerror( + "Already executing", + "The Python Shell window is already executing a command; " + "please wait until it is finished.", + master=self.tkconsole.text) + + class PyShell(OutputWindow): *************** *** 766,771 **** # self.pollinterval = 50 # millisec - if use_subprocess: - self.interp.start_subprocess() reading = False --- 804,807 ---- *************** *** 888,891 **** --- 924,931 ---- if use_subprocess: nosub = '' + client = self.interp.start_subprocess() + if not client: + self.close() + return None else: nosub = "==== No Subprocess ====" *************** *** 895,903 **** self.showprompt() import Tkinter ! Tkinter._default_root = None ! ! def interact(self): ! self.begin() ! self.top.mainloop() def readline(self): --- 935,940 ---- self.showprompt() import Tkinter ! Tkinter._default_root = None # 03Jan04 KBK What's this? ! return client def readline(self): *************** *** 1282,1290 **** if not args: flist.new() ! if enable_shell: ! flist.open_shell() ! elif enable_shell: ! flist.pyshell = PyShell(flist) ! flist.pyshell.begin() shell = flist.pyshell # handle remaining options: --- 1319,1325 ---- if not args: flist.new() ! if enable_shell: ! if not flist.open_shell(): ! return # couldn't open shell shell = flist.pyshell # handle remaining options: *************** *** 1296,1300 **** if filename and os.path.isfile(filename): shell.interp.execfile(filename) ! if cmd or script: shell.interp.runcommand("""if 1: import sys as _sys --- 1331,1335 ---- if filename and os.path.isfile(filename): shell.interp.execfile(filename) ! if shell and cmd or script: shell.interp.runcommand("""if 1: import sys as _sys *************** *** 1310,1331 **** root.destroy() - - def display_port_binding_error(): - print """\ - \nIDLE cannot run. - - IDLE needs to use a specific TCP/IP port (8833) in order to communicate with - its Python execution server. IDLE is unable to bind to this port, and so - cannot start. Here are some possible causes of this problem: - - 1. TCP/IP networking is not installed or not working on this computer - 2. Another program (another IDLE?) is running that uses this port - 3. Personal firewall software is preventing IDLE from using this port - - Run IDLE with the -n command line switch to start without a subprocess - and refer to Help/IDLE Help "Running without a subprocess" for further - details. - """ - if __name__ == "__main__": sys.modules['PyShell'] = sys.modules['__main__'] --- 1345,1348 ---- Index: ScriptBinding.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/ScriptBinding.py,v retrieving revision 1.25 retrieving revision 1.25.8.1 diff -C2 -d -r1.25 -r1.25.8.1 *** ScriptBinding.py 5 Jun 2003 02:38:32 -0000 1.25 --- ScriptBinding.py 6 Jun 2004 17:41:41 -0000 1.25.8.1 *************** *** 138,141 **** --- 138,143 ---- flist = self.editwin.flist shell = flist.open_shell() + if not shell: + return # couldn't open the shell interp = shell.interp if PyShell.use_subprocess: Index: idlever.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/idlever.py,v retrieving revision 1.15.4.3 retrieving revision 1.15.4.4 diff -C2 -d -r1.15.4.3 -r1.15.4.4 *** idlever.py 13 May 2004 05:34:43 -0000 1.15.4.3 --- idlever.py 6 Jun 2004 17:41:41 -0000 1.15.4.4 *************** *** 1 **** ! IDLE_VERSION = "1.0.3" --- 1 ---- ! IDLE_VERSION = "1.0.4" Index: run.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/run.py,v retrieving revision 1.25.8.1 retrieving revision 1.25.8.2 diff -C2 -d -r1.25.8.1 -r1.25.8.2 *** run.py 24 Nov 2003 02:34:01 -0000 1.25.8.1 --- run.py 6 Jun 2004 17:41:41 -0000 1.25.8.2 *************** *** 48,51 **** --- 48,52 ---- no_exitfunc = del_exitfunc port = 8833 + #time.sleep(15) # test subprocess not responding if sys.argv[1:]: port = int(sys.argv[1]) *************** *** 91,95 **** def manage_socket(address): ! for i in range(6): time.sleep(i) try: --- 92,96 ---- def manage_socket(address): ! for i in range(3): time.sleep(i) try: *************** *** 97,107 **** break except socket.error, err: ! if i < 3: ! print>>sys.__stderr__, ".. ", ! else: ! print>>sys.__stderr__,"\nPython subprocess socket error: "\ ! + err[1] + ", retrying...." else: ! print>>sys.__stderr__, "\nConnection to Idle failed, exiting." global exit_now exit_now = True --- 98,107 ---- break except socket.error, err: ! print>>sys.__stderr__,"IDLE Subprocess: socket error: "\ ! + err[1] + ", retrying...." else: ! print>>sys.__stderr__, "IDLE Subprocess: Connection to "\ ! "IDLE GUI failed, exiting." ! show_socket_error(err, address) global exit_now exit_now = True *************** *** 109,112 **** --- 109,127 ---- server.handle_request() # A single request only + def show_socket_error(err, address): + import Tkinter + import tkMessageBox + root = Tkinter.Tk() + root.withdraw() + if err[0] == 61: # connection refused + msg = "IDLE's subprocess can't connect to %s:%d. This may be due "\ + "to your personal firewall configuration. It is safe to "\ + "allow this internal connection because no data is visible on "\ + "external ports." % address + tkMessageBox.showerror("IDLE Subprocess Error", msg, parent=root) + else: + tkMessageBox.showerror("IDLE Subprocess Error", "Socket Error: %s" % err[1]) + root.destroy() + def print_exception(): flush_stdout() *************** *** 115,119 **** sys.last_type, sys.last_value, sys.last_traceback = excinfo tbe = traceback.extract_tb(tb) ! print >>efile, '\nTraceback (most recent call last):' exclude = ("run.py", "rpc.py", "threading.py", "Queue.py", "RemoteDebugger.py", "bdb.py") --- 130,134 ---- sys.last_type, sys.last_value, sys.last_traceback = excinfo tbe = traceback.extract_tb(tb) ! print>>efile, '\nTraceback (most recent call last):' exclude = ("run.py", "rpc.py", "threading.py", "Queue.py", "RemoteDebugger.py", "bdb.py") From nnorwitz at users.sourceforge.net Sun Jun 6 15:20:25 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 6 15:20:29 2004 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.51,2.52 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv604/Objects Modified Files: obmalloc.c Log Message: SF bug 881641, make it easier to use valgrind Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -d -r2.51 -r2.52 *** obmalloc.c 17 Jun 2003 15:48:11 -0000 2.51 --- obmalloc.c 6 Jun 2004 19:20:22 -0000 2.52 *************** *** 535,540 **** * a NULL arenas. */ ! #define ADDRESS_IN_RANGE(P, I) \ ! ((I) < narenas && (uptr)(P) - arenas[I] < (uptr)ARENA_SIZE) /*==========================================================================*/ --- 535,564 ---- * a NULL arenas. */ ! #define Py_ADDRESS_IN_RANGE(P, POOL) \ ! ((POOL)->arenaindex < narenas && \ ! (uptr)(P) - arenas[(POOL)->arenaindex] < (uptr)ARENA_SIZE) ! ! /* This is only useful when running memory debuggers such as ! * Purify or Valgrind. Uncomment to use. ! * ! */ ! #define Py_USING_MEMORY_DEBUGGER ! ! #ifdef Py_USING_MEMORY_DEBUGGER ! ! /* Py_ADDRESS_IN_RANGE may access uninitialized memory by design ! * This leads to thousands of spurious warnings when using ! * Purify or Valgrind. By making a function, we can easily ! * suppress the uninitialized memory reads in this one function. ! * So we won't ignore real errors elsewhere. ! * ! * Disable the macro and use a function. ! */ ! ! #undef Py_ADDRESS_IN_RANGE ! ! /* Don't make static, to ensure this isn't inlined. */ ! int Py_ADDRESS_IN_RANGE(void *P, poolp pool); ! #endif /*==========================================================================*/ *************** *** 709,713 **** pool = POOL_ADDR(p); ! if (ADDRESS_IN_RANGE(p, pool->arenaindex)) { /* We allocated this address. */ LOCK(); --- 733,737 ---- pool = POOL_ADDR(p); ! if (Py_ADDRESS_IN_RANGE(p, pool)) { /* We allocated this address. */ LOCK(); *************** *** 792,796 **** pool = POOL_ADDR(p); ! if (ADDRESS_IN_RANGE(p, pool->arenaindex)) { /* We're in charge of this block */ size = INDEX2SIZE(pool->szidx); --- 816,820 ---- pool = POOL_ADDR(p); ! if (Py_ADDRESS_IN_RANGE(p, pool)) { /* We're in charge of this block */ size = INDEX2SIZE(pool->szidx); *************** *** 1374,1375 **** --- 1398,1410 ---- #endif /* PYMALLOC_DEBUG */ + + #ifdef Py_USING_MEMORY_DEBUGGER + /* Make this function last so gcc won't inline it + since the definition is after the reference. */ + int + Py_ADDRESS_IN_RANGE(void *P, poolp pool) + { + return ((pool->arenaindex) < narenas && + (uptr)(P) - arenas[pool->arenaindex] < (uptr)ARENA_SIZE); + } + #endif From nnorwitz at users.sourceforge.net Sun Jun 6 15:21:36 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 6 15:21:40 2004 Subject: [Python-checkins] python/dist/src/Objects obmalloc.c,2.52,2.53 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv849/Objects Modified Files: obmalloc.c Log Message: whoops, I wanted that commented out by default, will add doc to Misc Index: obmalloc.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v retrieving revision 2.52 retrieving revision 2.53 diff -C2 -d -r2.52 -r2.53 *** obmalloc.c 6 Jun 2004 19:20:22 -0000 2.52 --- obmalloc.c 6 Jun 2004 19:21:34 -0000 2.53 *************** *** 542,547 **** * Purify or Valgrind. Uncomment to use. * - */ #define Py_USING_MEMORY_DEBUGGER #ifdef Py_USING_MEMORY_DEBUGGER --- 542,547 ---- * Purify or Valgrind. Uncomment to use. * #define Py_USING_MEMORY_DEBUGGER + */ #ifdef Py_USING_MEMORY_DEBUGGER From nnorwitz at users.sourceforge.net Sun Jun 6 15:58:43 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 6 15:58:46 2004 Subject: [Python-checkins] python/dist/src/Misc README.valgrind, NONE, 1.1 valgrind-python.supp, NONE, 1.1 README, 1.19, 1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8153 Modified Files: README Added Files: README.valgrind valgrind-python.supp Log Message: Add some doc about using valgrind --- NEW FILE: README.valgrind --- This document describes some caveats about the use of Valgrind with Python. Valgrind is used periodically by Python developers to try to ensure there are no memory leaks or invalid memory reads/writes. If you don't want to read about the details of using Valgrind, there are still two things you must do to suppress the warnings. First, you must use a suppressions file. One is supplied in Misc/valgrind-python.supp. Second, you must do one of the following: * Uncomment Py_USING_MEMORY_DEBUGGER in Objects/obmalloc.c, then rebuild Python * Uncomment the lines in Misc/valgrind-python.supp that suppress the warnings for PyObject_Free and PyObject_Realloc Details: -------- Python uses its own allocation scheme on top of malloc called PyMalloc. Valgrind my show some unexpected results when PyMalloc is used. Starting with Python 2.3, PyMalloc is used by default. You can disable PyMalloc when configuring python by adding the --without-pymalloc option. If you disable PyMalloc, most of the information in this document and the supplied suppressions file will not be useful. If you use valgrind on a default build of Python, you will see many errors like: ==6399== Use of uninitialised value of size 4 ==6399== at 0x4A9BDE7E: PyObject_Free (obmalloc.c:711) ==6399== by 0x4A9B8198: dictresize (dictobject.c:477) These are expected and not a problem. Tim Peters explains the situation: PyMalloc needs to know whether an arbitrary address is one that's managed by it, or is managed by the system malloc. The current scheme allows this to be determined in constant time, regardless of how many memory areas are under pymalloc's control. The memory pymalloc manages itself is in one or more "arenas", each a large contiguous memory area obtained from malloc. The base address of each arena is saved by pymalloc in a vector, and a field at the start of each arena contains the index of that arena's base address in that vector. Given an arbitrary address, pymalloc computes the arena base address corresponding to it, then looks at "the index" stored near there. If the index read up is out of bounds for the vector of arena base addresses pymalloc maintains, then pymalloc knows for certain that this address is not under pymalloc's control. Otherwise the index is in bounds, and pymalloc compares the arena base address stored at that index in the vector to the computed arena address pymalloc controls this arena if and only if they're equal. It doesn't matter whether the memory pymalloc reads up ("the index") is initialized. If it's not initialized, then whatever trash gets read up will lead pymalloc to conclude (correctly) that the address isn't controlled by it. This determination has to be made on every call to one of pymalloc's free/realloc entry points, so its speed is critical (Python allocates and frees dynamic memory at a ferocious rate -- everything in Python, from integers to "stack frames", lives in the heap). --- NEW FILE: valgrind-python.supp --- # # This is a valgrind suppression file that should be used when using valgrind. # # Here's an example of running valgrind: # # cd python/dist/src # valgrind --tool=memcheck --suppressions=Misc/valgrind-python.supp \ # ./python -E -tt ./Lib/test/regrtest.py -u bsddb,network # # You must edit Objects/obmalloc.c and uncomment Py_USING_MEMORY_DEBUGGER # to use the preferred suppressions with Py_ADDRESS_IN_RANGE. # # If you do not want to recompile Python, you can uncomment # suppressions for PyObject_Free and PyObject_Realloc. # # See Misc/README.valgrind for more information. # all tool names: Addrcheck,Memcheck,cachegrind,helgrind,massif { ADDRESS_IN_RANGE/Invalid read of size 4 Memcheck:Addr4 fun:Py_ADDRESS_IN_RANGE } { ADDRESS_IN_RANGE/Invalid read of size 4 Memcheck:Value4 fun:Py_ADDRESS_IN_RANGE } { ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value Memcheck:Cond fun:Py_ADDRESS_IN_RANGE } ###{ ### ADDRESS_IN_RANGE/Invalid read of size 4 ### Memcheck:Addr4 ### fun:PyObject_Free ###} ### ###{ ### ADDRESS_IN_RANGE/Invalid read of size 4 ### Memcheck:Value4 ### fun:PyObject_Free ###} ### ###{ ### ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value ### Memcheck:Cond ### fun:PyObject_Free ###} ###{ ### ADDRESS_IN_RANGE/Invalid read of size 4 ### Memcheck:Addr4 ### fun:PyObject_Realloc ###} ### ###{ ### ADDRESS_IN_RANGE/Invalid read of size 4 ### Memcheck:Value4 ### fun:PyObject_Realloc ###} ### ###{ ### ADDRESS_IN_RANGE/Conditional jump or move depends on uninitialised value ### Memcheck:Cond ### fun:PyObject_Realloc ###} ### ### All the suppressions below are for errors that occur within libraries ### that Python uses. The problems to not appear to be related to Python's ### use of the libraries. ### { GDBM problems, see test_gdbm Memcheck:Param write(buf) fun:write fun:gdbm_open } ### ### These occur from somewhere within the SSL, when running ### test_socket_sll. They are too general to leave on by default. ### ###{ ### somewhere in SSL stuff ### Memcheck:Cond ### fun:memset ###} ###{ ### somewhere in SSL stuff ### Memcheck:Value4 ### fun:memset ###} ### ###{ ### somewhere in SSL stuff ### Memcheck:Cond ### fun:MD5_Update ###} ### ###{ ### somewhere in SSL stuff ### Memcheck:Value4 ### fun:MD5_Update ###} # # All of these problems come from using test_socket_ssl # { from test_socket_ssl Memcheck:Cond fun:BN_bin2bn } { from test_socket_ssl Memcheck:Cond fun:BN_num_bits_word } { from test_socket_ssl Memcheck:Value4 fun:BN_num_bits_word } { from test_socket_ssl Memcheck:Cond fun:BN_mod_exp_mont_word } { from test_socket_ssl Memcheck:Cond fun:BN_mod_exp_mont } { from test_socket_ssl Memcheck:Param write(buf) fun:write obj:/usr/lib/libcrypto.so.0.9.7 } { from test_socket_ssl Memcheck:Cond fun:RSA_verify } { from test_socket_ssl Memcheck:Value4 fun:RSA_verify } { from test_socket_ssl Memcheck:Value4 fun:DES_set_key_unchecked } { from test_socket_ssl Memcheck:Value4 fun:DES_encrypt2 } { from test_socket_ssl Memcheck:Cond obj:/usr/lib/libssl.so.0.9.7 } { from test_socket_ssl Memcheck:Value4 obj:/usr/lib/libssl.so.0.9.7 } { from test_socket_ssl Memcheck:Cond fun:BUF_MEM_grow_clean } { from test_socket_ssl Memcheck:Cond fun:memcpy fun:ssl3_read_bytes } { from test_socket_ssl Memcheck:Cond fun:SHA1_Update } { from test_socket_ssl Memcheck:Value4 fun:SHA1_Update } Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/README,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** README 11 Aug 2003 16:18:43 -0000 1.19 --- README 6 Jun 2004 19:58:40 -0000 1.20 *************** *** 25,28 **** --- 25,29 ---- python-mode.el Emacs mode for editing Python programs README The file you're reading now + README.valgrind Information for Valgrind users, see valgrind-python.supp RFD Request For Discussion about a Python newsgroup RPM (Old) tools to build RPMs *************** *** 30,31 **** --- 31,33 ---- setuid-prog.c C helper program for set-uid Python scripts vgrindefs Python configuration for vgrind (a generic pretty printer) + valgrind-python.supp Valgrind suppression file, see README.valgrind From nnorwitz at users.sourceforge.net Sun Jun 6 16:09:52 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 6 16:09:55 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_multibytecodec_support.py, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10237/Lib/test Modified Files: test_multibytecodec_support.py Log Message: Look for the multibyte codec map files in the parent directory too This is similar to test_normalization, so that many source trees can reference the same test file(s). Index: test_multibytecodec_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_multibytecodec_support.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_multibytecodec_support.py 18 Jan 2004 20:29:55 -0000 1.2 --- test_multibytecodec_support.py 6 Jun 2004 20:09:49 -0000 1.3 *************** *** 165,170 **** unittest.TestCase.__init__(self, *args, **kw) if not os.path.exists(self.mapfilename): ! raise test_support.TestSkipped('%s not found, download from %s' % ! (self.mapfilename, self.mapfileurl)) def test_mapping_file(self): --- 165,175 ---- unittest.TestCase.__init__(self, *args, **kw) if not os.path.exists(self.mapfilename): ! parent = os.path.join(os.pardir, self.mapfilename) ! if not os.path.exists(parent): ! format = '%s not found, download from %s' ! raise test_support.TestSkipped(format % ! (self.mapfilename, self.mapfileurl)) ! else: ! self.mapfilename = parent def test_mapping_file(self): From nnorwitz at users.sourceforge.net Sun Jun 6 16:13:12 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 6 16:13:15 2004 Subject: [Python-checkins] python/dist/src/Modules binascii.c,2.40,2.41 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10720/Modules Modified Files: binascii.c Log Message: Valgrind was reporting an uninitialized read for bad input. This fixes the problem and the test passes. I'm not sure the test is really correct though. It seems like it would be better to raise an exception. I think that wasn't done for backwards compatability. Bugfix candidate. Index: binascii.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/binascii.c,v retrieving revision 2.40 retrieving revision 2.41 diff -C2 -d -r2.40 -r2.41 *** binascii.c 11 May 2004 02:05:11 -0000 2.40 --- binascii.c 6 Jun 2004 20:13:10 -0000 2.41 *************** *** 205,209 **** for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) { ! this_ch = *ascii_data; if ( this_ch == '\n' || this_ch == '\r' || ascii_len <= 0) { /* --- 205,210 ---- for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) { ! /* XXX is it really best to add NULs if there's no more data */ ! this_ch = (ascii_len > 0) ? *ascii_data : 0; if ( this_ch == '\n' || this_ch == '\r' || ascii_len <= 0) { /* From nnorwitz at users.sourceforge.net Sun Jun 6 16:27:07 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 6 16:27:09 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_posix.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14269/Lib/test Modified Files: test_posix.py Log Message: Try to improve test coverage for utime() Index: test_posix.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_posix.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_posix.py 1 May 2003 17:45:45 -0000 1.6 --- test_posix.py 6 Jun 2004 20:27:05 -0000 1.7 *************** *** 151,154 **** --- 151,158 ---- now = time.time() posix.utime(test_support.TESTFN, None) + self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (None, None)) + self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (now, None)) + self.assertRaises(TypeError, posix.utime, test_support.TESTFN, (None, now)) + posix.utime(test_support.TESTFN, (int(now), int(now))) posix.utime(test_support.TESTFN, (now, now)) From nnorwitz at users.sourceforge.net Sun Jun 6 16:40:30 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 6 16:40:33 2004 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.318, 2.319 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16270/Modules Modified Files: posixmodule.c Log Message: Plug a few memory leaks in utime(). path is allocated from within PyArg_ParseTuple() since the format is "et" This change should be reviewed carefully. Bugfix candidate. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.318 retrieving revision 2.319 diff -C2 -d -r2.318 -r2.319 *** posixmodule.c 2 Jun 2004 09:57:56 -0000 2.318 --- posixmodule.c 6 Jun 2004 20:40:27 -0000 2.319 *************** *** 2050,2062 **** PyErr_SetString(PyExc_TypeError, "utime() arg 2 must be a tuple (atime, mtime)"); return NULL; } else { if (extract_time(PyTuple_GET_ITEM(arg, 0), ! &atime, &ausec) == -1) return NULL; if (extract_time(PyTuple_GET_ITEM(arg, 1), ! &mtime, &musec) == -1) return NULL; ATIME = atime; MTIME = mtime; --- 2050,2067 ---- PyErr_SetString(PyExc_TypeError, "utime() arg 2 must be a tuple (atime, mtime)"); + PyMem_Free(path); return NULL; } else { if (extract_time(PyTuple_GET_ITEM(arg, 0), ! &atime, &ausec) == -1) { ! PyMem_Free(path); return NULL; + } if (extract_time(PyTuple_GET_ITEM(arg, 1), ! &mtime, &musec) == -1) { ! PyMem_Free(path); return NULL; + } ATIME = atime; MTIME = mtime; *************** *** 2083,2091 **** if (res < 0) { #ifdef Py_WIN_WIDE_FILENAMES ! if (have_unicode_filename) return posix_error_with_unicode_filename(wpath); #endif /* Py_WIN_WIDE_FILENAMES */ ! return posix_error_with_filename(path); } Py_INCREF(Py_None); return Py_None; --- 2088,2099 ---- if (res < 0) { #ifdef Py_WIN_WIDE_FILENAMES ! if (have_unicode_filename) { ! PyMem_Free(path); return posix_error_with_unicode_filename(wpath); + } #endif /* Py_WIN_WIDE_FILENAMES */ ! return posix_error_with_allocated_filename(path); } + PyMem_Free(path); Py_INCREF(Py_None); return Py_None; From akuchling at users.sourceforge.net Sun Jun 6 19:28:25 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Jun 6 19:28:29 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcgi.tex,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25154 Modified Files: libcgi.tex Log Message: [Bug #953177] Mention .getlist(); text from Paul Moore Index: libcgi.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** libcgi.tex 23 Jan 2004 04:05:27 -0000 1.43 --- libcgi.tex 6 Jun 2004 23:28:23 -0000 1.44 *************** *** 136,152 **** If you expect this possibility (when your HTML form contains multiple fields with the same name), use ! the \function{isinstance()} built-in function to determine whether you ! have a single instance or a list of instances. For example, this code concatenates any number of username fields, separated by commas: \begin{verbatim} ! value = form.getvalue("username", "") ! if isinstance(value, list): ! # Multiple username fields specified ! usernames = ",".join(value) ! else: ! # Single or no username field specified ! usernames = value \end{verbatim} --- 136,147 ---- If you expect this possibility (when your HTML form contains multiple fields with the same name), use ! the \function{getlist()} function, which always returns a list of values (so that you ! do not need to special-case the single item case). For example, this code concatenates any number of username fields, separated by commas: \begin{verbatim} ! value = form.getlist("username") ! usernames = ",".join(value) \end{verbatim} From akuchling at users.sourceforge.net Sun Jun 6 19:29:07 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sun Jun 6 19:29:10 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcgi.tex, 1.40.10.3, 1.40.10.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25275 Modified Files: Tag: release23-maint libcgi.tex Log Message: [Bug #953177] Mention .getlist(); text from Paul Moore Index: libcgi.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v retrieving revision 1.40.10.3 retrieving revision 1.40.10.4 diff -C2 -d -r1.40.10.3 -r1.40.10.4 *** libcgi.tex 23 Jan 2004 04:08:14 -0000 1.40.10.3 --- libcgi.tex 6 Jun 2004 23:29:05 -0000 1.40.10.4 *************** *** 136,152 **** If you expect this possibility (when your HTML form contains multiple fields with the same name), use ! the \function{isinstance()} built-in function to determine whether you ! have a single instance or a list of instances. For example, this code concatenates any number of username fields, separated by commas: \begin{verbatim} ! value = form.getvalue("username", "") ! if isinstance(value, list): ! # Multiple username fields specified ! usernames = ",".join(value) ! else: ! # Single or no username field specified ! usernames = value \end{verbatim} --- 136,147 ---- If you expect this possibility (when your HTML form contains multiple fields with the same name), use ! the \function{getlist()} function, which always returns a list of values (so that you ! do not need to special-case the single item case). For example, this code concatenates any number of username fields, separated by commas: \begin{verbatim} ! value = form.getlist("username") ! usernames = ",".join(value) \end{verbatim} From rhettinger at users.sourceforge.net Sun Jun 6 22:07:17 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Jun 6 22:07:20 2004 Subject: [Python-checkins] python/dist/src/Lib random.py,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21236 Modified Files: random.py Log Message: Fix typo in comment. Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** random.py 5 Jun 2004 14:53:22 -0000 1.61 --- random.py 7 Jun 2004 02:07:15 -0000 1.62 *************** *** 238,242 **** def choice(self, seq): """Choose a random element from a non-empty sequence.""" ! return seq[int(self.random() * len(seq))] # raises IndexError in seq is empty def shuffle(self, x, random=None, int=int): --- 238,242 ---- def choice(self, seq): """Choose a random element from a non-empty sequence.""" ! return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty def shuffle(self, x, random=None, int=int): From montanaro at users.sourceforge.net Sun Jun 6 22:40:07 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sun Jun 6 22:40:13 2004 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.90,1.91 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26291 Modified Files: pydoc.py Log Message: correct name error caught by Neal Norwitz with pychecker Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.90 retrieving revision 1.91 diff -C2 -d -r1.90 -r1.91 *** pydoc.py 29 Jan 2004 06:37:49 -0000 1.90 --- pydoc.py 7 Jun 2004 02:40:05 -0000 1.91 *************** *** 323,331 **** (file.startswith(basedir) and not file.startswith(os.path.join(basedir, 'site-packages'))))): if docloc.startswith("http://"): ! docloc = (docloc.rstrip("/") + ! "/module-%s.html" % object.__name__) else: ! docloc = os.path.join(docloc, "module-%s.html" % name) else: docloc = None --- 323,331 ---- (file.startswith(basedir) and not file.startswith(os.path.join(basedir, 'site-packages'))))): + htmlfile = "module-%s.html" % object.__name__ if docloc.startswith("http://"): ! docloc = "%s/%s" % (docloc.rstrip("/"), htmlfile) else: ! docloc = os.path.join(docloc, htmlfile) else: docloc = None From nnorwitz at users.sourceforge.net Sun Jun 6 23:45:58 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 6 23:46:03 2004 Subject: [Python-checkins] python/dist/src/Lib binhex.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4829 Modified Files: binhex.py Log Message: Remove a useless operation, setting name to itself Index: binhex.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/binhex.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** binhex.py 12 Feb 2004 17:35:06 -0000 1.23 --- binhex.py 7 Jun 2004 03:45:56 -0000 1.24 *************** *** 198,202 **** def _writeinfo(self, name, finfo): - name = name nl = len(name) if nl > 63: --- 198,201 ---- From nnorwitz at users.sourceforge.net Sun Jun 6 23:47:08 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 6 23:47:11 2004 Subject: [Python-checkins] python/dist/src/Lib calendar.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5100 Modified Files: calendar.py Log Message: There is no reason to have an underscore after self Index: calendar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/calendar.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** calendar.py 12 Feb 2004 17:35:06 -0000 1.33 --- calendar.py 7 Jun 2004 03:47:06 -0000 1.34 *************** *** 51,55 **** return data[i] ! def __len__(self_): return 7 --- 51,55 ---- return data[i] ! def __len__(self): return 7 From nnorwitz at users.sourceforge.net Sun Jun 6 23:49:53 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 6 23:49:56 2004 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.67,1.68 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5276 Modified Files: urllib2.py Log Message: Cleanup: the in operator already returns a bool, no need to bool() it again Cleanup: use condition to be consistent with code above CookieJar is in cookielib Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** urllib2.py 31 May 2004 18:22:40 -0000 1.67 --- urllib2.py 7 Jun 2004 03:49:50 -0000 1.68 *************** *** 264,269 **** def has_header(self, header_name): ! return bool(header_name in self.headers or ! header_name in self.unredirected_hdrs) def get_header(self, header_name, default=None): --- 264,269 ---- def has_header(self, header_name): ! return (header_name in self.headers or ! header_name in self.unredirected_hdrs) def get_header(self, header_name, default=None): *************** *** 296,300 **** if condition.startswith("error"): ! j = meth[i+1:].find("_") + i + 1 kind = meth[j+1:] try: --- 296,300 ---- if condition.startswith("error"): ! j = condition.find("_") + i + 1 kind = meth[j+1:] try: *************** *** 1027,1031 **** def __init__(self, cookiejar=None): if cookiejar is None: ! cookiejar = CookieJar() self.cookiejar = cookiejar --- 1027,1031 ---- def __init__(self, cookiejar=None): if cookiejar is None: ! cookiejar = cookielib.CookieJar() self.cookiejar = cookiejar From qwdbwsxgfoa at worldonline.fr Mon Jun 7 02:12:52 2004 From: qwdbwsxgfoa at worldonline.fr (Check it- Windows OS for less) Date: Mon Jun 7 01:13:11 2004 Subject: [Python-checkins] WHOLESALE SOFTWARE to public - SA.VE up to 75% OFF! - Python-annouce somnambulist 886 lunatics Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040607/ac4d6ec9/attachment.html From montanaro at users.sourceforge.net Mon Jun 7 07:20:42 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon Jun 7 07:20:47 2004 Subject: [Python-checkins] python/dist/src/Lib cgitb.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15933 Modified Files: cgitb.py Log Message: Another nit found by Neal Norwitz using pychecker. This was caused by a too-mechanical translation when converting html() to text() (simply stripped strong() where it appeared). Index: cgitb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/cgitb.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** cgitb.py 5 Jun 2004 19:15:34 -0000 1.12 --- cgitb.py 7 Jun 2004 11:20:40 -0000 1.13 *************** *** 212,217 **** if value is not __UNDEF__: if where == 'global': name = 'global ' + name ! elif where == 'local': name = name ! else: name = where + name.split('.')[-1] dump.append('%s = %s' % (name, pydoc.text.repr(value))) else: --- 212,216 ---- if value is not __UNDEF__: if where == 'global': name = 'global ' + name ! elif where != 'local': name = where + name.split('.')[-1] dump.append('%s = %s' % (name, pydoc.text.repr(value))) else: From theller at users.sourceforge.net Mon Jun 7 11:00:02 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Mon Jun 7 11:00:08 2004 Subject: [Python-checkins] python/dist/src/Python import.c, 2.222.6.2, 2.222.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31621 Modified Files: Tag: release23-maint import.c Log Message: Fix a refcount bug in an obscure code corner. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.222.6.2 retrieving revision 2.222.6.3 diff -C2 -d -r2.222.6.2 -r2.222.6.3 *** import.c 23 Mar 2004 16:28:45 -0000 2.222.6.2 --- import.c 7 Jun 2004 14:59:59 -0000 2.222.6.3 *************** *** 944,947 **** --- 944,948 ---- if (PyErr_ExceptionMatches(PyExc_ImportError)) { PyErr_Clear(); + Py_INCREF(m); } else From theller at users.sourceforge.net Mon Jun 7 11:04:13 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Mon Jun 7 11:04:16 2004 Subject: [Python-checkins] python/dist/src/Python import.c,2.231,2.232 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32605 Modified Files: import.c Log Message: Fix a refcount bug in an obscure code corner. Already backported. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.231 retrieving revision 2.232 diff -C2 -d -r2.231 -r2.232 *** import.c 28 May 2004 20:21:36 -0000 2.231 --- import.c 7 Jun 2004 15:04:10 -0000 2.232 *************** *** 922,925 **** --- 922,926 ---- if (PyErr_ExceptionMatches(PyExc_ImportError)) { PyErr_Clear(); + Py_INCREF(m); } else From theller at users.sourceforge.net Mon Jun 7 11:12:47 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Mon Jun 7 11:12:50 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.992,1.993 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1979 Modified Files: NEWS Log Message: Fix a refcount bug in an obscure code corner. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.992 retrieving revision 1.993 diff -C2 -d -r1.992 -r1.993 *** NEWS 5 Jun 2004 18:37:52 -0000 1.992 --- NEWS 7 Jun 2004 15:12:44 -0000 1.993 *************** *** 13,16 **** --- 13,18 ---- ----------------- + - Bug #845802: Python crashes when __init__.py is a directory. + - Unicode objects received two new methods: iswide() and width(). These query East Asian width information, as specified in Unicode From theller at users.sourceforge.net Mon Jun 7 11:14:20 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Mon Jun 7 11:14:23 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.117, 1.831.4.118 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2373 Modified Files: Tag: release23-maint NEWS Log Message: Fix a refcount bug in an obscure code corner. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.117 retrieving revision 1.831.4.118 diff -C2 -d -r1.831.4.117 -r1.831.4.118 *** NEWS 5 Jun 2004 14:14:49 -0000 1.831.4.117 --- NEWS 7 Jun 2004 15:14:17 -0000 1.831.4.118 *************** *** 10,13 **** --- 10,18 ---- *Release date: xx-xxx-2004* + Core and builtins + ----------------- + + - Bug #845802: Python crashed when __init__.py is a directory. + Extension modules ----------------- From vlzrkqvqerdwy at hotmail.com Mon Jun 7 19:54:29 2004 From: vlzrkqvqerdwy at hotmail.com (vlzrkqvqerdwy@hotmail.com) Date: Mon Jun 7 15:47:24 2004 Subject: [Python-checkins] thick? Message-ID: <3951fp3n2u$57lj21h2v92$87jtd837kum@academic.hotmail.com> stick another 3 inches in her next time you bang... http://amid.frnwacba.com/vp5 take off- http://serene.frnwacba.com/a.html colleague bromley playoff From rhettinger at users.sourceforge.net Mon Jun 7 17:53:51 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 7 17:53:57 2004 Subject: [Python-checkins] python/dist/src/Doc/tut glossary.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25082 Modified Files: glossary.tex Log Message: Add genexps to the glossary. Index: glossary.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/glossary.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** glossary.tex 29 Mar 2004 01:19:54 -0000 1.8 --- glossary.tex 7 Jun 2004 21:52:47 -0000 1.9 *************** *** 129,132 **** --- 129,144 ---- \method{next()} method of the returned iterator. + \index{generator expression} + \item[generator expression] + An expression that returns a generator. It looks like a normal expression + followed by a \keyword{for} expression defining a loop variable, range, and + an optional \keyword{if} expression. The combined expression generates + values for an enclosing function: + + \begin{verbatim} + >>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81 + 285 + \end{verbatim} + \index{GIL} \item[GIL] From tim_one at users.sourceforge.net Mon Jun 7 19:04:36 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 7 19:04:39 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.993,1.994 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5714/Misc Modified Files: NEWS Log Message: SF 952807: Unpickling pickled instances of subclasses of datetime.date, datetime.datetime and datetime.time could yield insane objects. Thanks to Jiwon Seo for the fix. Bugfix candidate. I'll backport it to 2.3. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.993 retrieving revision 1.994 diff -C2 -d -r1.993 -r1.994 *** NEWS 7 Jun 2004 15:12:44 -0000 1.993 --- NEWS 7 Jun 2004 23:04:31 -0000 1.994 *************** *** 13,16 **** --- 13,20 ---- ----------------- + - Bug #952807: Unpickling pickled instances of subclasses of + datetime.date, datetime.datetime and datetime.time could yield insane + objects. Thanks to Jiwon Seo for a fix. + - Bug #845802: Python crashes when __init__.py is a directory. From tim_one at users.sourceforge.net Mon Jun 7 19:04:36 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 7 19:04:42 2004 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c, 1.71, 1.72 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5714/Modules Modified Files: datetimemodule.c Log Message: SF 952807: Unpickling pickled instances of subclasses of datetime.date, datetime.datetime and datetime.time could yield insane objects. Thanks to Jiwon Seo for the fix. Bugfix candidate. I'll backport it to 2.3. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** datetimemodule.c 21 Mar 2004 23:38:41 -0000 1.71 --- datetimemodule.c 7 Jun 2004 23:04:33 -0000 1.72 *************** *** 2207,2211 **** PyDateTime_Date *me; ! me = PyObject_New(PyDateTime_Date, type); if (me != NULL) { char *pdata = PyString_AS_STRING(state); --- 2207,2211 ---- PyDateTime_Date *me; ! me = (PyDateTime_Date *) (type->tp_alloc(type, 0)); if (me != NULL) { char *pdata = PyString_AS_STRING(state); *************** *** 3050,3055 **** } aware = (char)(tzinfo != Py_None); ! me = (PyDateTime_Time *) time_alloc(&PyDateTime_TimeType, ! aware); if (me != NULL) { char *pdata = PyString_AS_STRING(state); --- 3050,3054 ---- } aware = (char)(tzinfo != Py_None); ! me = (PyDateTime_Time *) (type->tp_alloc(type, aware)); if (me != NULL) { char *pdata = PyString_AS_STRING(state); *************** *** 3573,3579 **** } aware = (char)(tzinfo != Py_None); ! me = (PyDateTime_DateTime *) datetime_alloc( ! &PyDateTime_DateTimeType, ! aware); if (me != NULL) { char *pdata = PyString_AS_STRING(state); --- 3572,3576 ---- } aware = (char)(tzinfo != Py_None); ! me = (PyDateTime_DateTime *) (type->tp_alloc(type , aware)); if (me != NULL) { char *pdata = PyString_AS_STRING(state); From tim_one at users.sourceforge.net Mon Jun 7 19:05:03 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 7 19:05:06 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_datetime.py, 1.46, 1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5714/Lib/test Modified Files: test_datetime.py Log Message: SF 952807: Unpickling pickled instances of subclasses of datetime.date, datetime.datetime and datetime.time could yield insane objects. Thanks to Jiwon Seo for the fix. Bugfix candidate. I'll backport it to 2.3. Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** test_datetime.py 21 Mar 2004 23:38:41 -0000 1.46 --- test_datetime.py 7 Jun 2004 23:04:30 -0000 1.47 *************** *** 511,514 **** --- 511,517 ---- self.assertEqual(dt2, dt - days) + class SubclassDate(date): + sub_var = 1 + class TestDate(HarmlessMixedComparison): # Tests here should pass for both dates and datetimes, except for a *************** *** 1030,1033 **** --- 1033,1045 ---- self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month - 7) + def test_pickling_subclass_date(self): + + args = 6, 7, 23 + orig = SubclassDate(*args) + for pickler, unpickler, proto in pickle_choices: + green = pickler.dumps(orig, proto) + derived = unpickler.loads(green) + self.assertEqual(orig, derived) + def test_backdoor_resistance(self): # For fast unpickling, the constructor accepts a pickle string. *************** *** 1054,1057 **** --- 1066,1072 ---- # datetime tests + class SubclassDatetime(datetime): + sub_var = 1 + class TestDateTime(TestDate): *************** *** 1297,1300 **** --- 1312,1323 ---- self.assertEqual(b.day, 7) + def test_pickling_subclass_datetime(self): + args = 6, 7, 23, 20, 59, 1, 64**2 + orig = SubclassDatetime(*args) + for pickler, unpickler, proto in pickle_choices: + green = pickler.dumps(orig, proto) + derived = unpickler.loads(green) + self.assertEqual(orig, derived) + def test_more_compare(self): # The test_compare() inherited from TestDate covers the error cases. *************** *** 1501,1504 **** --- 1524,1530 ---- dt1.second - 7) + class SubclassTime(time): + sub_var = 1 + class TestTime(HarmlessMixedComparison): *************** *** 1701,1704 **** --- 1727,1738 ---- self.assertEqual(orig, derived) + def test_pickling_subclass_time(self): + args = 20, 59, 16, 64**2 + orig = SubclassTime(*args) + for pickler, unpickler, proto in pickle_choices: + green = pickler.dumps(orig, proto) + derived = unpickler.loads(green) + self.assertEqual(orig, derived) + def test_bool(self): cls = self.theclass From tim_one at users.sourceforge.net Mon Jun 7 19:17:50 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 7 19:17:53 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_datetime.py, 1.45, 1.45.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8099/Lib/test Modified Files: Tag: release23-maint test_datetime.py Log Message: SF 952807: Unpickling pickled instances of subclasses of datetime.date, datetime.datetime and datetime.time could yield insane objects. Thanks to Jiwon Seo for a fix. Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v retrieving revision 1.45 retrieving revision 1.45.8.1 diff -C2 -d -r1.45 -r1.45.8.1 *** test_datetime.py 27 Jun 2003 08:14:17 -0000 1.45 --- test_datetime.py 7 Jun 2004 23:17:47 -0000 1.45.8.1 *************** *** 511,514 **** --- 511,517 ---- self.assertEqual(dt2, dt - days) + class SubclassDate(date): + sub_var = 1 + class TestDate(HarmlessMixedComparison): # Tests here should pass for both dates and datetimes, except for a *************** *** 1030,1037 **** --- 1033,1051 ---- self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month - 7) + def test_pickling_subclass_date(self): + args = 6, 7, 23 + orig = SubclassDate(*args) + for pickler, unpickler, proto in pickle_choices: + green = pickler.dumps(orig, proto) + derived = unpickler.loads(green) + self.assertEqual(orig, derived) + ############################################################################# # datetime tests + class SubclassDatetime(datetime): + sub_var = 1 + class TestDateTime(TestDate): *************** *** 1277,1280 **** --- 1291,1302 ---- self.assertEqual(b.day, 7) + def test_pickling_subclass_datetime(self): + args = 6, 7, 23, 20, 59, 1, 64**2 + orig = SubclassDatetime(*args) + for pickler, unpickler, proto in pickle_choices: + green = pickler.dumps(orig, proto) + derived = unpickler.loads(green) + self.assertEqual(orig, derived) + def test_more_compare(self): # The test_compare() inherited from TestDate covers the error cases. *************** *** 1481,1484 **** --- 1503,1509 ---- dt1.second - 7) + class SubclassTime(time): + sub_var = 1 + class TestTime(HarmlessMixedComparison): *************** *** 1681,1684 **** --- 1706,1717 ---- self.assertEqual(orig, derived) + def test_pickling_subclass_time(self): + args = 20, 59, 16, 64**2 + orig = SubclassTime(*args) + for pickler, unpickler, proto in pickle_choices: + green = pickler.dumps(orig, proto) + derived = unpickler.loads(green) + self.assertEqual(orig, derived) + def test_bool(self): cls = self.theclass From tim_one at users.sourceforge.net Mon Jun 7 19:17:50 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 7 19:17:56 2004 Subject: [Python-checkins] python/dist/src/Misc ACKS, 1.243, 1.243.6.1 NEWS, 1.831.4.118, 1.831.4.119 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8099/Misc Modified Files: Tag: release23-maint ACKS NEWS Log Message: SF 952807: Unpickling pickled instances of subclasses of datetime.date, datetime.datetime and datetime.time could yield insane objects. Thanks to Jiwon Seo for a fix. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.243 retrieving revision 1.243.6.1 diff -C2 -d -r1.243 -r1.243.6.1 *** ACKS 17 Jul 2003 19:18:50 -0000 1.243 --- ACKS 7 Jun 2004 23:17:48 -0000 1.243.6.1 *************** *** 491,494 **** --- 491,495 ---- Nick Seidenman Fred Sells + Jiwon Seo Denis Severson Ha Shao Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.118 retrieving revision 1.831.4.119 diff -C2 -d -r1.831.4.118 -r1.831.4.119 *** NEWS 7 Jun 2004 15:14:17 -0000 1.831.4.118 --- NEWS 7 Jun 2004 23:17:48 -0000 1.831.4.119 *************** *** 13,16 **** --- 13,20 ---- ----------------- + - Bug #952807: Unpickling pickled instances of subclasses of + datetime.date, datetime.datetime and datetime.time could yield insane + objects. Thanks to Jiwon Seo for a fix. + - Bug #845802: Python crashed when __init__.py is a directory. *************** *** 24,28 **** - Bug #841757: xmlrpclib failed on structs with Unicode keys. ! - Bug #954364: inspect.getframeinfo() sometimes produces incorrect traceback line numbers --- 28,32 ---- - Bug #841757: xmlrpclib failed on structs with Unicode keys. ! - Bug #954364: inspect.getframeinfo() sometimes produces incorrect traceback line numbers From tim_one at users.sourceforge.net Mon Jun 7 19:17:51 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 7 19:17:58 2004 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c, 1.67.8.1, 1.67.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8099/Modules Modified Files: Tag: release23-maint datetimemodule.c Log Message: SF 952807: Unpickling pickled instances of subclasses of datetime.date, datetime.datetime and datetime.time could yield insane objects. Thanks to Jiwon Seo for a fix. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.67.8.1 retrieving revision 1.67.8.2 diff -C2 -d -r1.67.8.1 -r1.67.8.2 *** datetimemodule.c 20 Oct 2003 14:34:46 -0000 1.67.8.1 --- datetimemodule.c 7 Jun 2004 23:17:48 -0000 1.67.8.2 *************** *** 2200,2204 **** PyDateTime_Date *me; ! me = PyObject_New(PyDateTime_Date, type); if (me != NULL) { char *pdata = PyString_AS_STRING(state); --- 2200,2204 ---- PyDateTime_Date *me; ! me = (PyDateTime_Date *) (type->tp_alloc(type, 0)); if (me != NULL) { char *pdata = PyString_AS_STRING(state); *************** *** 3043,3048 **** } aware = (char)(tzinfo != Py_None); ! me = (PyDateTime_Time *) time_alloc(&PyDateTime_TimeType, ! aware); if (me != NULL) { char *pdata = PyString_AS_STRING(state); --- 3043,3047 ---- } aware = (char)(tzinfo != Py_None); ! me = (PyDateTime_Time *) (type->tp_alloc(type, aware)); if (me != NULL) { char *pdata = PyString_AS_STRING(state); *************** *** 3565,3571 **** } aware = (char)(tzinfo != Py_None); ! me = (PyDateTime_DateTime *) datetime_alloc( ! &PyDateTime_DateTimeType, ! aware); if (me != NULL) { char *pdata = PyString_AS_STRING(state); --- 3564,3568 ---- } aware = (char)(tzinfo != Py_None); ! me = (PyDateTime_DateTime *) (type->tp_alloc(type , aware)); if (me != NULL) { char *pdata = PyString_AS_STRING(state); From secretariatzxyxd at angelfire.com Mon Jun 7 21:50:11 2004 From: secretariatzxyxd at angelfire.com (Dianne Riggs) Date: Mon Jun 7 22:01:45 2004 Subject: [Python-checkins] Great News: You are Accepted Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040607/447987a2/attachment.html From nascheme at users.sourceforge.net Mon Jun 7 22:58:54 2004 From: nascheme at users.sourceforge.net (nascheme@users.sourceforge.net) Date: Mon Jun 7 22:58:59 2004 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15971/Doc/api Modified Files: concrete.tex Log Message: Note that memory returned by PyBuffer_New is not specifically aligned. Closes SF bug #472568. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** concrete.tex 3 Jun 2004 09:55:27 -0000 1.43 --- concrete.tex 8 Jun 2004 02:58:50 -0000 1.44 *************** *** 1566,1570 **** Returns a new writable buffer object that maintains its own memory buffer of \var{size} bytes. \exception{ValueError} is returned if ! \var{size} is not zero or positive. \end{cfuncdesc} --- 1566,1572 ---- Returns a new writable buffer object that maintains its own memory buffer of \var{size} bytes. \exception{ValueError} is returned if ! \var{size} is not zero or positive. Note that the memory buffer (as ! returned by \cfunction{PyObject_AsWriteBuffer()}) is not specifically ! aligned. \end{cfuncdesc} From loewis at users.sourceforge.net Tue Jun 8 04:17:45 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 04:17:52 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.994,1.995 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29830/Misc Modified Files: NEWS Log Message: Patch #510695: Add TSC profiling for the VM. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.994 retrieving revision 1.995 diff -C2 -d -r1.994 -r1.995 *** NEWS 7 Jun 2004 23:04:31 -0000 1.994 --- NEWS 8 Jun 2004 08:17:42 -0000 1.995 *************** *** 500,503 **** --- 500,506 ---- ----- + - Profiling the VM using the Pentium TSC is now possible if Python + is configured --with-tsc. + - In order to find libraries, setup.py now also looks in /lib64, for use on AMD64. From loewis at users.sourceforge.net Tue Jun 8 04:17:44 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 04:17:55 2004 Subject: [Python-checkins] python/dist/src/Include pystate.h,2.28,2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29830/Include Modified Files: pystate.h Log Message: Patch #510695: Add TSC profiling for the VM. Index: pystate.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pystate.h,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** pystate.h 29 Mar 2004 02:24:26 -0000 2.28 --- pystate.h 8 Jun 2004 08:17:42 -0000 2.29 *************** *** 30,33 **** --- 30,36 ---- int dlopenflags; #endif + #ifdef WITH_TSC + int tscdump; + #endif } PyInterpreterState; From loewis at users.sourceforge.net Tue Jun 8 04:17:47 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 04:17:58 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c, 2.398, 2.399 pystate.c, 2.30, 2.31 sysmodule.c, 2.123, 2.124 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29830/Python Modified Files: ceval.c pystate.c sysmodule.c Log Message: Patch #510695: Add TSC profiling for the VM. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.398 retrieving revision 2.399 diff -C2 -d -r2.398 -r2.399 *** ceval.c 5 Jun 2004 06:16:22 -0000 2.398 --- ceval.c 8 Jun 2004 08:17:43 -0000 2.399 *************** *** 18,21 **** --- 18,41 ---- #include + #ifdef WITH_TSC + #include + + typedef unsigned long long uint64; + + void dump_tsc(int opcode, int ticked, uint64 inst0, uint64 inst1, + uint64 loop0, uint64 loop1, uint64 intr0, uint64 intr1) + { + uint64 intr, inst, loop; + PyThreadState *tstate = PyThreadState_Get(); + if (!tstate->interp->tscdump) + return; + intr = intr1 - intr0; + inst = inst1 - inst0 - intr; + loop = loop1 - loop0 - intr; + fprintf(stderr, "opcode=%03d t=%d inst=%06lld loop=%06lld\n", + opcode, ticked, inst, loop); + } + #endif + /* Turn this on if your compiler chokes on the big switch: */ /* #define CASE_TOO_BIG 1 */ *************** *** 31,35 **** --- 51,59 ---- /* Forward declarations */ static PyObject *eval_frame(PyFrameObject *); + #ifdef WITH_TSC + static PyObject *call_function(PyObject ***, int, uint64*, uint64*); + #else static PyObject *call_function(PyObject ***, int); + #endif static PyObject *fast_function(PyObject *, PyObject ***, int, int, int); static PyObject *do_call(PyObject *, PyObject ***, int, int); *************** *** 486,489 **** --- 510,551 ---- #endif + #ifdef WITH_TSC + /* Use Pentium timestamp counter to mark certain events: + inst0 -- beginning of switch statement for opcode dispatch + inst1 -- end of switch statement (may be skipped) + loop0 -- the top of the mainloop + loop1 -- place where control returns again to top of mainloop + (may be skipped) + intr1 -- beginning of long interruption + intr2 -- end of long interruption + + Many opcodes call out to helper C functions. In some cases, the + time in those functions should be counted towards the time for the + opcode, but not in all cases. For example, a CALL_FUNCTION opcode + calls another Python function; there's no point in charge all the + bytecode executed by the called function to the caller. + + It's hard to make a useful judgement statically. In the presence + of operator overloading, it's impossible to tell if a call will + execute new Python code or not. + + It's a case-by-case judgement. I'll use intr1 for the following + cases: + + EXEC_STMT + IMPORT_STAR + IMPORT_FROM + CALL_FUNCTION (and friends) + + */ + uint64 inst0, inst1, loop0, loop1, intr0 = 0, intr1 = 0; + int ticked = 0; + + rdtscll(inst0); + rdtscll(inst1); + rdtscll(loop0); + rdtscll(loop1); + #endif + /* Code access macros */ *************** *** 644,647 **** --- 706,726 ---- for (;;) { + #ifdef WITH_TSC + if (inst1 == 0) { + /* Almost surely, the opcode executed a break + or a continue, preventing inst1 from being set + on the way out of the loop. + */ + rdtscll(inst1); + loop1 = inst1; + } + dump_tsc(opcode, ticked, inst0, inst1, loop0, loop1, + intr0, intr1); + ticked = 0; + inst1 = 0; + intr0 = 0; + intr1 = 0; + rdtscll(loop0); + #endif assert(stack_pointer >= f->f_valuestack); /* else underflow */ assert(STACK_LEVEL() <= f->f_stacksize); /* else overflow */ *************** *** 663,666 **** --- 742,748 ---- _Py_Ticker = _Py_CheckInterval; tstate->tick_counter++; + #ifdef WITH_TSC + ticked = 1; + #endif if (things_to_do) { if (Py_MakePendingCalls() < 0) { *************** *** 753,756 **** --- 835,841 ---- /* Main switch on opcode */ + #ifdef WITH_TSC + rdtscll(inst0); + #endif switch (opcode) { *************** *** 1494,1498 **** --- 1579,1589 ---- u = THIRD(); STACKADJ(-3); + #ifdef WITH_TSC + rdtscll(intr0); + #endif err = exec_statement(f, u, v, w); + #ifdef WITH_TSC + rdtscll(intr1); + #endif Py_DECREF(u); Py_DECREF(v); *************** *** 1856,1860 **** --- 1947,1957 ---- break; } + #ifdef WITH_TSC + rdtscll(intr0); + #endif x = PyEval_CallObject(x, w); + #ifdef WITH_TSC + rdtscll(intr1); + #endif Py_DECREF(w); SET_TOP(x); *************** *** 1870,1874 **** --- 1967,1977 ---- break; } + #ifdef WITH_TSC + rdtscll(intr0); + #endif err = import_all_from(x, v); + #ifdef WITH_TSC + rdtscll(intr1); + #endif PyFrame_LocalsToFast(f, 0); Py_DECREF(v); *************** *** 1879,1883 **** --- 1982,1992 ---- w = GETITEM(names, oparg); v = TOP(); + #ifdef WITH_TSC + rdtscll(intr0); + #endif x = import_from(v, w); + #ifdef WITH_TSC + rdtscll(intr1); + #endif PUSH(x); if (x != NULL) continue; *************** *** 1988,1992 **** --- 2097,2105 ---- case CALL_FUNCTION: PCALL(PCALL_ALL); + #ifdef WITH_TSC + x = call_function(&stack_pointer, oparg, &intr0, &intr1); + #else x = call_function(&stack_pointer, oparg); + #endif PUSH(x); if (x != NULL) *************** *** 2023,2027 **** --- 2136,2146 ---- } else Py_INCREF(func); + #ifdef WITH_TSC + rdtscll(intr0); + #endif x = ext_do_call(func, &stack_pointer, flags, na, nk); + #ifdef WITH_TSC + rdtscll(intr1); + #endif Py_DECREF(func); *************** *** 2135,2138 **** --- 2254,2261 ---- on_error: + #ifdef WITH_TSC + rdtscll(inst1); + #endif + /* Quickly continue if no error occurred */ *************** *** 2144,2150 **** fprintf(stderr, "XXX undetected error\n"); ! else #endif continue; /* Normal, fast path */ } why = WHY_EXCEPTION; --- 2267,2279 ---- fprintf(stderr, "XXX undetected error\n"); ! else { ! #endif ! #ifdef WITH_TSC ! rdtscll(loop1); #endif continue; /* Normal, fast path */ + #ifdef CHECKEXC + } + #endif } why = WHY_EXCEPTION; *************** *** 2261,2264 **** --- 2390,2396 ---- if (why != WHY_NOT) break; + #ifdef WITH_TSC + rdtscll(loop1); + #endif } /* main loop */ *************** *** 3332,3336 **** static PyObject * ! call_function(PyObject ***pp_stack, int oparg) { int na = oparg & 0xff; --- 3464,3472 ---- static PyObject * ! call_function(PyObject ***pp_stack, int oparg ! #ifdef WITH_TSC ! , uint64* pintr0, uint64* pintr1 ! #endif ! ) { int na = oparg & 0xff; *************** *** 3375,3379 **** --- 3511,3521 ---- callargs = load_args(pp_stack, na); BEGIN_C_TRACE + #ifdef WITH_TSC + rdtscll(*pintr0); + #endif x = PyCFunction_Call(func, callargs, NULL); + #ifdef WITH_TSC + rdtscll(*pintr1); + #endif END_C_TRACE Py_XDECREF(callargs); *************** *** 3394,3401 **** --- 3536,3549 ---- } else Py_INCREF(func); + #ifdef WITH_TSC + rdtscll(*pintr0); + #endif if (PyFunction_Check(func)) x = fast_function(func, pp_stack, n, na, nk); else x = do_call(func, pp_stack, na, nk); + #ifdef WITH_TSC + rdtscll(*pintr1); + #endif Py_DECREF(func); } Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** pystate.c 24 Mar 2004 22:22:12 -0000 2.30 --- pystate.c 8 Jun 2004 08:17:44 -0000 2.31 *************** *** 60,63 **** --- 60,66 ---- #endif #endif + #ifdef WITH_TSC + interp->tscdump = 0; + #endif HEAD_LOCK(); Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.123 retrieving revision 2.124 diff -C2 -d -r2.123 -r2.124 *** sysmodule.c 24 Mar 2004 22:22:12 -0000 2.123 --- sysmodule.c 8 Jun 2004 08:17:44 -0000 2.124 *************** *** 443,446 **** --- 443,473 ---- ); + #ifdef WITH_TSC + static PyObject * + sys_settscdump(PyObject *self, PyObject *args) + { + int bool; + PyThreadState *tstate = PyThreadState_Get(); + + if (!PyArg_ParseTuple(args, "i:settscdump", &bool)) + return NULL; + if (bool) + tstate->interp->tscdump = 1; + else + tstate->interp->tscdump = 0; + Py_INCREF(Py_None); + return Py_None; + + } + + PyDoc_STRVAR(settscdump_doc, + "settscdump(bool)\n\ + \n\ + If true, tell the Python interpreter to dump VM measurements to\n\ + stderr. If false, turn off dump. The measurements are based on the\n\ + Pentium time-stamp counter." + ); + #endif TSC + static PyObject * sys_setrecursionlimit(PyObject *self, PyObject *args) *************** *** 744,747 **** --- 771,777 ---- {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS, setrecursionlimit_doc}, + #ifdef WITH_TSC + {"settscdump", sys_settscdump, METH_VARARGS, settscdump_doc}, + #endif {"settrace", sys_settrace, METH_O, settrace_doc}, {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc}, From loewis at users.sourceforge.net Tue Jun 8 04:18:18 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 04:18:21 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsys.tex,1.69,1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29830/Doc/lib Modified Files: libsys.tex Log Message: Patch #510695: Add TSC profiling for the VM. Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** libsys.tex 21 Mar 2004 14:10:18 -0000 1.69 --- libsys.tex 8 Jun 2004 08:17:41 -0000 1.70 *************** *** 476,479 **** --- 476,489 ---- \end{funcdesc} + \begin{funcdesc}{settscdump}{on_flag} + Activate dumping of VM measurements using the Pentium timestamp + counter, if \var{on_flag} is true. Deactivate these dumps if + \var{on_flag} is off. The function is available only if Python + was compiled with \code{--with-tsc}. To understand the output + of this dump, read \code{Python/ceval.c}. + + \versionadded{2.4} + \end{funcdesc} + \begin{datadesc}{stdin} \dataline{stdout} From loewis at users.sourceforge.net Tue Jun 8 04:18:19 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 04:18:26 2004 Subject: [Python-checkins] python/dist/src README, 1.181, 1.182 configure, 1.445, 1.446 configure.in, 1.456, 1.457 pyconfig.h.in, 1.96, 1.97 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29830 Modified Files: README configure configure.in pyconfig.h.in Log Message: Patch #510695: Add TSC profiling for the VM. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.181 retrieving revision 1.182 diff -C2 -d -r1.181 -r1.182 *** README 9 May 2004 17:11:59 -0000 1.181 --- README 8 Jun 2004 08:17:30 -0000 1.182 *************** *** 1027,1030 **** --- 1027,1031 ---- read it in universal newline mode. THIS OPTION IS UNSUPPORTED. + --with-tsc: Profile using the Pentium timestamping counter (TSC). Building for multiple architectures (using the VPATH feature) Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.445 retrieving revision 1.446 diff -C2 -d -r1.445 -r1.446 *** configure 3 Jun 2004 12:41:38 -0000 1.445 --- configure 8 Jun 2004 08:17:34 -0000 1.446 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.455 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.4. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.456 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.4. *************** *** 868,871 **** --- 868,872 ---- --with-pth use GNU pth threading libraries --with(out)-doc-strings disable/enable documentation strings + --with(out)-tsc enable/disable timestamp counter profile --with(out)-pymalloc disable/enable specialized mallocs --with-wctype-functions use wctype.h functions *************** *** 12007,12010 **** --- 12008,12036 ---- # Check for Python-specific malloc support + echo "$as_me:$LINENO: checking for --with-tsc" >&5 + echo $ECHO_N "checking for --with-tsc... $ECHO_C" >&6 + + # Check whether --with-tsc or --without-tsc was given. + if test "${with_tsc+set}" = set; then + withval="$with_tsc" + + if test "$withval" != no + then + + cat >>confdefs.h <<\_ACEOF + #define WITH_TSC 1 + _ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6 + else echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + fi + else + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + fi; + + # Check for Python-specific malloc support echo "$as_me:$LINENO: checking for --with-pymalloc" >&5 echo $ECHO_N "checking for --with-pymalloc... $ECHO_C" >&6 Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.456 retrieving revision 1.457 diff -C2 -d -r1.456 -r1.457 *** configure.in 3 Jun 2004 12:41:45 -0000 1.456 --- configure.in 8 Jun 2004 08:17:41 -0000 1.457 *************** *** 1930,1933 **** --- 1930,1946 ---- # Check for Python-specific malloc support + AC_MSG_CHECKING(for --with-tsc) + AC_ARG_WITH(tsc, + [ --with(out)-tsc enable/disable timestamp counter profile], [ + if test "$withval" != no + then + AC_DEFINE(WITH_TSC, 1, + [Define to profile with the Pentium timestamp counter]) + AC_MSG_RESULT(yes) + else AC_MSG_RESULT(no) + fi], + [AC_MSG_RESULT(no)]) + + # Check for Python-specific malloc support AC_MSG_CHECKING(for --with-pymalloc) AC_ARG_WITH(pymalloc, Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** pyconfig.h.in 21 Mar 2004 23:45:42 -0000 1.96 --- pyconfig.h.in 8 Jun 2004 08:17:41 -0000 1.97 *************** *** 781,784 **** --- 781,787 ---- #undef WITH_THREAD + /* Define to profile with the Pentium timestamp counter */ + #undef WITH_TSC + /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ From loewis at users.sourceforge.net Tue Jun 8 04:29:35 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 04:29:42 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_os.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32478/Lib/test Modified Files: test_os.py Log Message: Feature request #935915: Add os.path.devnull. Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test_os.py 2 Jun 2004 18:42:25 -0000 1.23 --- test_os.py 8 Jun 2004 08:29:32 -0000 1.24 *************** *** 335,338 **** --- 335,346 ---- os.removedirs(path) + class DevNullTests (unittest.TestCase): + def test_devnull(self): + f = file(os.devnull, 'w') + f.write('hello') + f.close() + f = file(os.devnull, 'r') + assert f.read() == '' + f.close() def test_main(): *************** *** 343,346 **** --- 351,355 ---- WalkTests, MakedirTests, + DevNullTests, ) From loewis at users.sourceforge.net Tue Jun 8 04:29:34 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 04:29:48 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.136,1.137 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32478/Doc/lib Modified Files: libos.tex Log Message: Feature request #935915: Add os.path.devnull. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.136 retrieving revision 1.137 diff -C2 -d -r1.136 -r1.137 *** libos.tex 5 Jun 2004 19:25:30 -0000 1.136 --- libos.tex 8 Jun 2004 08:29:32 -0000 1.137 *************** *** 1809,1810 **** --- 1809,1818 ---- for example, \code{'\e r\e n'} for Windows. \end{datadesc} + + \begin{datadesc}{devnull} + The file path of the null device. + For example: \code{'/dev/null'} for \POSIX{} or \code{'Dev:Nul'} for the + Macintosh. + Also available via \module{os.path}. + \versionadded{2.4} + \end{datadesc} From loewis at users.sourceforge.net Tue Jun 8 04:29:36 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 04:29:52 2004 Subject: [Python-checkins] python/dist/src/Lib macpath.py, 1.47, 1.48 ntpath.py, 1.58, 1.59 os.py, 1.76, 1.77 os2emxpath.py, 1.11, 1.12 posixpath.py, 1.65, 1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32478/Lib Modified Files: macpath.py ntpath.py os.py os2emxpath.py posixpath.py Log Message: Feature request #935915: Add os.path.devnull. Index: macpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/macpath.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** macpath.py 27 Feb 2003 23:18:45 -0000 1.47 --- macpath.py 8 Jun 2004 08:29:32 -0000 1.48 *************** *** 9,13 **** "walk","expanduser","expandvars","normpath","abspath", "curdir","pardir","sep","pathsep","defpath","altsep","extsep", ! "realpath","supports_unicode_filenames"] # strings representing various path-related bits and pieces --- 9,13 ---- "walk","expanduser","expandvars","normpath","abspath", "curdir","pardir","sep","pathsep","defpath","altsep","extsep", ! "devnull","realpath","supports_unicode_filenames"] # strings representing various path-related bits and pieces *************** *** 19,22 **** --- 19,23 ---- defpath = ':' altsep = None + devnull = 'Dev:Null' # Normalize the case of a pathname. Dummy in Posix, but .lower() here. Index: ntpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** ntpath.py 20 Oct 2003 14:01:50 -0000 1.58 --- ntpath.py 8 Jun 2004 08:29:32 -0000 1.59 *************** *** 15,19 **** "walk","expanduser","expandvars","normpath","abspath","splitunc", "curdir","pardir","sep","pathsep","defpath","altsep","extsep", ! "realpath","supports_unicode_filenames"] # strings representing various path-related bits and pieces --- 15,19 ---- "walk","expanduser","expandvars","normpath","abspath","splitunc", "curdir","pardir","sep","pathsep","defpath","altsep","extsep", ! "devnull","realpath","supports_unicode_filenames"] # strings representing various path-related bits and pieces *************** *** 30,33 **** --- 30,34 ---- # OS/2 w/ VACPP altsep = '/' + devnull = 'nul' # Normalize the case of a pathname and map slashes to backslashes. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** os.py 4 Apr 2004 07:11:43 -0000 1.76 --- os.py 8 Jun 2004 08:29:32 -0000 1.77 *************** *** 13,16 **** --- 13,17 ---- - os.linesep is the line separator in text files ('\r' or '\n' or '\r\n') - os.defpath is the default search path for executables + - os.devnull is the file path of the null device ('/dev/null', etc.) Programs that import and use 'os' stand a better chance of being *************** *** 29,33 **** # Note: more names are added to __all__ later. __all__ = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep", ! "defpath", "name", "path"] def _get_exports_list(module): --- 30,34 ---- # Note: more names are added to __all__ later. __all__ = ["altsep", "curdir", "pardir", "sep", "pathsep", "linesep", ! "defpath", "name", "path", "devnull"] def _get_exports_list(module): *************** *** 130,134 **** sys.modules['os.path'] = path ! from os.path import curdir, pardir, sep, pathsep, defpath, extsep, altsep del _names --- 131,136 ---- sys.modules['os.path'] = path ! from os.path import curdir, pardir, sep, pathsep, defpath, extsep, altsep, \ ! devnull del _names Index: os2emxpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os2emxpath.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** os2emxpath.py 20 Oct 2003 14:01:50 -0000 1.11 --- os2emxpath.py 8 Jun 2004 08:29:32 -0000 1.12 *************** *** 14,18 **** "walk","expanduser","expandvars","normpath","abspath","splitunc", "curdir","pardir","sep","pathsep","defpath","altsep","extsep", ! "realpath","supports_unicode_filenames"] # strings representing various path-related bits and pieces --- 14,18 ---- "walk","expanduser","expandvars","normpath","abspath","splitunc", "curdir","pardir","sep","pathsep","defpath","altsep","extsep", ! "devnull","realpath","supports_unicode_filenames"] # strings representing various path-related bits and pieces *************** *** 24,27 **** --- 24,28 ---- pathsep = ';' defpath = '.;C:\\bin' + devnull = 'nul' # Normalize the case of a pathname and map slashes to backslashes. Index: posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** posixpath.py 12 May 2004 03:51:39 -0000 1.65 --- posixpath.py 8 Jun 2004 08:29:32 -0000 1.66 *************** *** 20,24 **** "samefile","sameopenfile","samestat", "curdir","pardir","sep","pathsep","defpath","altsep","extsep", ! "realpath","supports_unicode_filenames"] # strings representing various path-related bits and pieces --- 20,24 ---- "samefile","sameopenfile","samestat", "curdir","pardir","sep","pathsep","defpath","altsep","extsep", ! "devnull","realpath","supports_unicode_filenames"] # strings representing various path-related bits and pieces *************** *** 30,33 **** --- 30,34 ---- defpath = ':/bin:/usr/bin' altsep = None + devnull = '/dev/null' # Normalize the case of a pathname. Trivial in Posix, string.lower on Mac. From loewis at users.sourceforge.net Tue Jun 8 04:29:36 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 04:29:58 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.995,1.996 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32478/Misc Modified Files: NEWS Log Message: Feature request #935915: Add os.path.devnull. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.995 retrieving revision 1.996 diff -C2 -d -r1.995 -r1.996 *** NEWS 8 Jun 2004 08:17:42 -0000 1.995 --- NEWS 8 Jun 2004 08:29:33 -0000 1.996 *************** *** 329,332 **** --- 329,334 ---- ------- + - os.path.devnull has been added for all supported platforms. + - Fixed #877165: distutils now picks the right C++ compiler command on cygwin and mingw32. From theller at python.net Tue Jun 8 06:36:07 2004 From: theller at python.net (Thomas Heller) Date: Tue Jun 8 06:36:16 2004 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.318, 2.319 In-Reply-To: (nnorwitz@users.sourceforge.net's message of "Sun, 06 Jun 2004 13:40:30 -0700") References: Message-ID: nnorwitz@users.sourceforge.net writes: > Update of /cvsroot/python/python/dist/src/Modules > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16270/Modules > > Modified Files: > posixmodule.c > Log Message: > Plug a few memory leaks in utime(). path is allocated from within > PyArg_ParseTuple() since the format is "et" This change should > be reviewed carefully. I believe 'path' must be set to NULL at the start of the posix_utime function - I had a crash in a debug build on windows when running lib\test\test_unicode_file.py. Thomas Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.319 diff -c -r2.319 posixmodule.c *** posixmodule.c 6 Jun 2004 20:40:27 -0000 2.319 --- posixmodule.c 8 Jun 2004 10:35:03 -0000 *************** *** 1994,2000 **** static PyObject * posix_utime(PyObject *self, PyObject *args) { ! char *path; long atime, mtime, ausec, musec; int res; PyObject* arg; --- 1994,2000 ---- static PyObject * posix_utime(PyObject *self, PyObject *args) { ! char *path = NULL; long atime, mtime, ausec, musec; int res; PyObject* arg; From fdrake at users.sourceforge.net Tue Jun 8 10:01:30 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Jun 8 10:01:38 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsys.tex,1.70,1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5121 Modified Files: libsys.tex Log Message: - markup fix - explain Python/ceval.c from what; lots of people don't use a source distro any more Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** libsys.tex 8 Jun 2004 08:17:41 -0000 1.70 --- libsys.tex 8 Jun 2004 14:01:27 -0000 1.71 *************** *** 480,486 **** counter, if \var{on_flag} is true. Deactivate these dumps if \var{on_flag} is off. The function is available only if Python ! was compiled with \code{--with-tsc}. To understand the output ! of this dump, read \code{Python/ceval.c}. ! \versionadded{2.4} \end{funcdesc} --- 480,486 ---- counter, if \var{on_flag} is true. Deactivate these dumps if \var{on_flag} is off. The function is available only if Python ! was compiled with \longprogramopt{with-tsc}. To understand the ! output of this dump, read \file{Python/ceval.c} in the Python ! sources. \versionadded{2.4} \end{funcdesc} From bcannon at users.sourceforge.net Tue Jun 8 14:25:52 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Jun 8 14:25:56 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_site.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19795/Lib/test Modified Files: test_site.py Log Message: Removed test_sitepackages test. Skip discovered that it only passed if Python had already been installed previously. Index: test_site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_site.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_site.py 5 Jun 2004 01:12:51 -0000 1.1 --- test_site.py 8 Jun 2004 18:25:48 -0000 1.2 *************** *** 142,153 **** pass - def test_sitepackages(self): - # There should be a path that ends in site-packages - for path in sys.path: - if path.endswith("site-packages"): - break - else: - self.fail("'site-packages' directory missing'") - def test_setting_quit(self): # 'quit' and 'exit' should be injected into __builtin__ --- 142,145 ---- From loewis at users.sourceforge.net Tue Jun 8 14:52:56 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 14:52:59 2004 Subject: [Python-checkins] python/dist/src/Modules _localemodule.c, 2.45, 2.46 cPickle.c, 2.149, 2.150 stropmodule.c, 2.90, 2.91 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26461/Modules Modified Files: _localemodule.c cPickle.c stropmodule.c Log Message: Patch #774665: Make Python LC_NUMERIC agnostic. Index: _localemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_localemodule.c,v retrieving revision 2.45 retrieving revision 2.46 diff -C2 -d -r2.45 -r2.46 *** _localemodule.c 21 Mar 2004 19:34:30 -0000 2.45 --- _localemodule.c 8 Jun 2004 18:52:52 -0000 2.46 *************** *** 52,62 **** "(integer,string=None) -> string. Activates/queries locale processing."); - /* to record the LC_NUMERIC settings */ - static PyObject* grouping = NULL; - static PyObject* thousands_sep = NULL; - static PyObject* decimal_point = NULL; - /* if non-null, indicates that LC_NUMERIC is different from "C" */ - static char* saved_numeric = NULL; - /* the grouping is terminated by either 0 or CHAR_MAX */ static PyObject* --- 52,55 ---- *************** *** 168,172 **** char *locale = NULL, *result; PyObject *result_object; - struct lconv *lc; if (!PyArg_ParseTuple(args, "i|z:setlocale", &category, &locale)) --- 161,164 ---- *************** *** 184,210 **** if (!result_object) return NULL; - /* record changes to LC_NUMERIC */ - if (category == LC_NUMERIC || category == LC_ALL) { - if (strcmp(locale, "C") == 0 || strcmp(locale, "POSIX") == 0) { - /* user just asked for default numeric locale */ - if (saved_numeric) - free(saved_numeric); - saved_numeric = NULL; - } else { - /* remember values */ - lc = localeconv(); - Py_XDECREF(grouping); - grouping = copy_grouping(lc->grouping); - Py_XDECREF(thousands_sep); - thousands_sep = PyString_FromString(lc->thousands_sep); - Py_XDECREF(decimal_point); - decimal_point = PyString_FromString(lc->decimal_point); - if (saved_numeric) - free(saved_numeric); - saved_numeric = strdup(locale); - /* restore to "C" */ - setlocale(LC_NUMERIC, "C"); - } - } /* record changes to LC_CTYPE */ if (category == LC_CTYPE || category == LC_ALL) --- 176,179 ---- *************** *** 214,220 **** } else { /* get locale */ - /* restore LC_NUMERIC first, if appropriate */ - if (saved_numeric) - setlocale(LC_NUMERIC, saved_numeric); result = setlocale(category, NULL); if (!result) { --- 183,186 ---- *************** *** 223,229 **** } result_object = PyString_FromString(result); - /* restore back to "C" */ - if (saved_numeric) - setlocale(LC_NUMERIC, "C"); } return result_object; --- 189,192 ---- *************** *** 263,280 **** /* Numeric information */ ! if (saved_numeric){ ! /* cannot use localeconv results */ ! PyDict_SetItemString(result, "decimal_point", decimal_point); ! PyDict_SetItemString(result, "grouping", grouping); ! PyDict_SetItemString(result, "thousands_sep", thousands_sep); ! } else { ! RESULT_STRING(decimal_point); ! RESULT_STRING(thousands_sep); ! x = copy_grouping(l->grouping); ! if (!x) ! goto failed; ! PyDict_SetItemString(result, "grouping", x); ! Py_XDECREF(x); ! } /* Monetary information */ --- 226,236 ---- /* Numeric information */ ! RESULT_STRING(decimal_point); ! RESULT_STRING(thousands_sep); ! x = copy_grouping(l->grouping); ! if (!x) ! goto failed; ! PyDict_SetItemString(result, "grouping", x); ! Py_XDECREF(x); /* Monetary information */ *************** *** 580,595 **** returns numeric values in the char* return value, which would crash PyString_FromString. */ - #ifdef RADIXCHAR - if (saved_numeric) { - if(item == RADIXCHAR) { - Py_INCREF(decimal_point); - return decimal_point; - } - if(item == THOUSEP) { - Py_INCREF(thousands_sep); - return thousands_sep; - } - } - #endif for (i = 0; langinfo_constants[i].name; i++) if (langinfo_constants[i].value == item) { --- 536,539 ---- Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.149 retrieving revision 2.150 diff -C2 -d -r2.149 -r2.150 *** cPickle.c 26 Feb 2004 16:21:45 -0000 2.149 --- cPickle.c 8 Jun 2004 18:52:52 -0000 2.150 *************** *** 3320,3324 **** errno = 0; ! d = strtod(s, &endptr); if (errno || (endptr[0] != '\n') || (endptr[1] != '\0')) { --- 3320,3324 ---- errno = 0; ! d = PyOS_ascii_strtod(s, &endptr); if (errno || (endptr[0] != '\n') || (endptr[1] != '\0')) { Index: stropmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/stropmodule.c,v retrieving revision 2.90 retrieving revision 2.91 diff -C2 -d -r2.90 -r2.91 *** stropmodule.c 2 Aug 2002 02:27:13 -0000 2.90 --- stropmodule.c 8 Jun 2004 18:52:53 -0000 2.91 *************** *** 839,843 **** strop_atof(PyObject *self, PyObject *args) { - extern double strtod(const char *, char **); char *s, *end; double x; --- 839,842 ---- *************** *** 855,859 **** errno = 0; PyFPE_START_PROTECT("strop_atof", return 0) ! x = strtod(s, &end); PyFPE_END_PROTECT(x) while (*end && isspace(Py_CHARMASK(*end))) --- 854,858 ---- errno = 0; PyFPE_START_PROTECT("strop_atof", return 0) ! x = PyOS_ascii_strtod(s, &end); PyFPE_END_PROTECT(x) while (*end && isspace(Py_CHARMASK(*end))) From loewis at users.sourceforge.net Tue Jun 8 14:52:57 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 14:53:03 2004 Subject: [Python-checkins] python/dist/src/Python pystrtod.c, NONE, 2.1 compile.c, 2.302, 2.303 marshal.c, 1.76, 1.77 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26461/Python Modified Files: compile.c marshal.c Added Files: pystrtod.c Log Message: Patch #774665: Make Python LC_NUMERIC agnostic. --- NEW FILE: pystrtod.c --- /* -*- Mode: C; c-file-style: "python" -*- */ #include #include /* ascii character tests (as opposed to locale tests) */ #define ISSPACE(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || \ (c) == '\r' || (c) == '\t' || (c) == '\v') #define ISDIGIT(c) ((c) >= '0' && (c) <= '9') #define ISXDIGIT(c) (ISDIGIT(c) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F')) /** * PyOS_ascii_strtod: * @nptr: the string to convert to a numeric value. * @endptr: if non-%NULL, it returns the character after * the last character used in the conversion. * * Converts a string to a #gdouble value. * This function behaves like the standard strtod() function * does in the C locale. It does this without actually * changing the current locale, since that would not be * thread-safe. * * This function is typically used when reading configuration * files or other non-user input that should be locale independent. * To handle input from the user you should normally use the * locale-sensitive system strtod() function. * * If the correct value would cause overflow, plus or minus %HUGE_VAL * is returned (according to the sign of the value), and %ERANGE is * stored in %errno. If the correct value would cause underflow, * zero is returned and %ERANGE is stored in %errno. * * This function resets %errno before calling strtod() so that * you can reliably detect overflow and underflow. * * Return value: the #gdouble value. **/ double PyOS_ascii_strtod(const char *nptr, char **endptr) { char *fail_pos; double val; struct lconv *locale_data; const char *decimal_point; int decimal_point_len; const char *p, *decimal_point_pos; const char *end = NULL; /* Silence gcc */ /* g_return_val_if_fail (nptr != NULL, 0); */ assert(nptr != NULL); fail_pos = NULL; locale_data = localeconv(); decimal_point = locale_data->decimal_point; decimal_point_len = strlen(decimal_point); assert(decimal_point_len != 0); decimal_point_pos = NULL; if (decimal_point[0] != '.' || decimal_point[1] != 0) { p = nptr; /* Skip leading space */ while (ISSPACE(*p)) p++; /* Skip leading optional sign */ if (*p == '+' || *p == '-') p++; if (p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) { p += 2; /* HEX - find the (optional) decimal point */ while (ISXDIGIT(*p)) p++; if (*p == '.') { decimal_point_pos = p++; while (ISXDIGIT(*p)) p++; if (*p == 'p' || *p == 'P') p++; if (*p == '+' || *p == '-') p++; while (ISDIGIT(*p)) p++; end = p; } } else { while (ISDIGIT(*p)) p++; if (*p == '.') { decimal_point_pos = p++; while (ISDIGIT(*p)) p++; if (*p == 'e' || *p == 'E') p++; if (*p == '+' || *p == '-') p++; while (ISDIGIT(*p)) p++; end = p; } } /* For the other cases, we need not convert the decimal point */ } /* Set errno to zero, so that we can distinguish zero results and underflows */ errno = 0; if (decimal_point_pos) { char *copy, *c; /* We need to convert the '.' to the locale specific decimal point */ copy = malloc(end - nptr + 1 + decimal_point_len); c = copy; memcpy(c, nptr, decimal_point_pos - nptr); c += decimal_point_pos - nptr; memcpy(c, decimal_point, decimal_point_len); c += decimal_point_len; memcpy(c, decimal_point_pos + 1, end - (decimal_point_pos + 1)); c += end - (decimal_point_pos + 1); *c = 0; val = strtod(copy, &fail_pos); if (fail_pos) { if (fail_pos > decimal_point_pos) fail_pos = (char *)nptr + (fail_pos - copy) - (decimal_point_len - 1); else fail_pos = (char *)nptr + (fail_pos - copy); } free(copy); } else val = strtod(nptr, &fail_pos); if (endptr) *endptr = fail_pos; return val; } /** * PyOS_ascii_formatd: * @buffer: A buffer to place the resulting string in * @buf_len: The length of the buffer. * @format: The printf()-style format to use for the * code to use for converting. * @d: The #gdouble to convert * * Converts a #gdouble to a string, using the '.' as * decimal point. To format the number you pass in * a printf()-style format string. Allowed conversion * specifiers are 'e', 'E', 'f', 'F', 'g' and 'G'. * * Return value: The pointer to the buffer with the converted string. **/ char * PyOS_ascii_formatd(char *buffer, int buf_len, const char *format, double d) { struct lconv *locale_data; const char *decimal_point; int decimal_point_len; char *p; int rest_len; char format_char; /* g_return_val_if_fail (buffer != NULL, NULL); */ /* g_return_val_if_fail (format[0] == '%', NULL); */ /* g_return_val_if_fail (strpbrk (format + 1, "'l%") == NULL, NULL); */ format_char = format[strlen(format) - 1]; /* g_return_val_if_fail (format_char == 'e' || format_char == 'E' || */ /* format_char == 'f' || format_char == 'F' || */ /* format_char == 'g' || format_char == 'G', */ /* NULL); */ if (format[0] != '%') return NULL; if (strpbrk(format + 1, "'l%")) return NULL; if (!(format_char == 'e' || format_char == 'E' || format_char == 'f' || format_char == 'F' || format_char == 'g' || format_char == 'G')) return NULL; PyOS_snprintf(buffer, buf_len, format, d); locale_data = localeconv(); decimal_point = locale_data->decimal_point; decimal_point_len = strlen(decimal_point); assert(decimal_point_len != 0); if (decimal_point[0] != '.' || decimal_point[1] != 0) { p = buffer; if (*p == '+' || *p == '-') p++; while (isdigit((unsigned char)*p)) p++; if (strncmp(p, decimal_point, decimal_point_len) == 0) { *p = '.'; p++; if (decimal_point_len > 1) { rest_len = strlen(p + (decimal_point_len - 1)); memmove(p, p + (decimal_point_len - 1), rest_len); p[rest_len] = 0; } } } return buffer; } double PyOS_ascii_atof(const char *nptr) { return PyOS_ascii_strtod(nptr, NULL); } Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.302 retrieving revision 2.303 diff -C2 -d -r2.302 -r2.303 *** compile.c 19 May 2004 08:20:15 -0000 2.302 --- compile.c 8 Jun 2004 18:52:54 -0000 2.303 *************** *** 1380,1384 **** z.real = 0.; PyFPE_START_PROTECT("atof", return 0) ! z.imag = atof(s); PyFPE_END_PROTECT(z) return PyComplex_FromCComplex(z); --- 1380,1384 ---- z.real = 0.; PyFPE_START_PROTECT("atof", return 0) ! z.imag = PyOS_ascii_atof(s); PyFPE_END_PROTECT(z) return PyComplex_FromCComplex(z); *************** *** 1388,1392 **** { PyFPE_START_PROTECT("atof", return 0) ! dx = atof(s); PyFPE_END_PROTECT(dx) return PyFloat_FromDouble(dx); --- 1388,1392 ---- { PyFPE_START_PROTECT("atof", return 0) ! dx = PyOS_ascii_atof(s); PyFPE_END_PROTECT(dx) return PyFloat_FromDouble(dx); Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** marshal.c 26 Mar 2004 15:09:27 -0000 1.76 --- marshal.c 8 Jun 2004 18:52:54 -0000 1.77 *************** *** 458,462 **** buf[n] = '\0'; PyFPE_START_PROTECT("atof", return 0) ! dx = atof(buf); PyFPE_END_PROTECT(dx) return PyFloat_FromDouble(dx); --- 458,462 ---- buf[n] = '\0'; PyFPE_START_PROTECT("atof", return 0) ! dx = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(dx) return PyFloat_FromDouble(dx); *************** *** 476,480 **** buf[n] = '\0'; PyFPE_START_PROTECT("atof", return 0) ! c.real = atof(buf); PyFPE_END_PROTECT(c) n = r_byte(p); --- 476,480 ---- buf[n] = '\0'; PyFPE_START_PROTECT("atof", return 0) ! c.real = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(c) n = r_byte(p); *************** *** 486,490 **** buf[n] = '\0'; PyFPE_START_PROTECT("atof", return 0) ! c.imag = atof(buf); PyFPE_END_PROTECT(c) return PyComplex_FromCComplex(c); --- 486,490 ---- buf[n] = '\0'; PyFPE_START_PROTECT("atof", return 0) ! c.imag = PyOS_ascii_atof(buf); PyFPE_END_PROTECT(c) return PyComplex_FromCComplex(c); From loewis at users.sourceforge.net Tue Jun 8 14:52:59 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 14:53:06 2004 Subject: [Python-checkins] python/dist/src/Objects complexobject.c, 2.70, 2.71 floatobject.c, 2.130, 2.131 stringobject.c, 2.217, 2.218 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26461/Objects Modified Files: complexobject.c floatobject.c stringobject.c Log Message: Patch #774665: Make Python LC_NUMERIC agnostic. Index: complexobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v retrieving revision 2.70 retrieving revision 2.71 diff -C2 -d -r2.70 -r2.71 *** complexobject.c 12 Oct 2003 19:09:37 -0000 2.70 --- complexobject.c 8 Jun 2004 18:52:53 -0000 2.71 *************** *** 273,283 **** complex_to_buf(char *buf, int bufsz, PyComplexObject *v, int precision) { ! if (v->cval.real == 0.) ! PyOS_snprintf(buf, bufsz, "%.*gj", ! precision, v->cval.imag); ! else ! PyOS_snprintf(buf, bufsz, "(%.*g%+.*gj)", ! precision, v->cval.real, ! precision, v->cval.imag); } --- 273,289 ---- complex_to_buf(char *buf, int bufsz, PyComplexObject *v, int precision) { ! char format[32]; ! if (v->cval.real == 0.) { ! PyOS_snprintf(format, 32, "%%.%ig", precision); ! PyOS_ascii_formatd(buf, bufsz, format, v->cval.imag); ! strncat(buf, "j", bufsz); ! } else { ! char re[64], im[64]; ! ! PyOS_snprintf(format, 32, "%%.%ig", precision); ! PyOS_ascii_formatd(re, 64, format, v->cval.real); ! PyOS_ascii_formatd(im, 64, format, v->cval.imag); ! PyOS_snprintf(buf, bufsz, "(%s+%sj)", re, im); ! } } *************** *** 663,667 **** complex_subtype_from_string(PyTypeObject *type, PyObject *v) { - extern double strtod(const char *, char **); const char *s, *start; char *end; --- 669,672 ---- *************** *** 775,779 **** errno = 0; PyFPE_START_PROTECT("strtod", return 0) ! z = strtod(s, &end) ; PyFPE_END_PROTECT(z) if (errno != 0) { --- 780,784 ---- errno = 0; PyFPE_START_PROTECT("strtod", return 0) ! z = PyOS_ascii_strtod(s, &end) ; PyFPE_END_PROTECT(z) if (errno != 0) { Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.130 retrieving revision 2.131 diff -C2 -d -r2.130 -r2.131 *** floatobject.c 26 May 2004 17:36:12 -0000 2.130 --- floatobject.c 8 Jun 2004 18:52:53 -0000 2.131 *************** *** 133,137 **** */ PyFPE_START_PROTECT("strtod", return NULL) ! x = strtod(s, (char **)&end); PyFPE_END_PROTECT(x) errno = 0; --- 133,137 ---- */ PyFPE_START_PROTECT("strtod", return NULL) ! x = PyOS_ascii_strtod(s, (char **)&end); PyFPE_END_PROTECT(x) errno = 0; *************** *** 165,169 **** about denorms. */ PyFPE_START_PROTECT("atof", return NULL) ! x = atof(s); PyFPE_END_PROTECT(x) errno = 0; /* whether atof ever set errno is undefined */ --- 165,169 ---- about denorms. */ PyFPE_START_PROTECT("atof", return NULL) ! x = PyOS_ascii_atof(s); PyFPE_END_PROTECT(x) errno = 0; /* whether atof ever set errno is undefined */ *************** *** 224,227 **** --- 224,228 ---- { register char *cp; + char format[32]; /* Subroutine for float_repr and float_print. We want float numbers to be recognizable as such, *************** *** 231,235 **** assert(PyFloat_Check(v)); ! PyOS_snprintf(buf, buflen, "%.*g", precision, v->ob_fval); cp = buf; if (*cp == '-') --- 232,237 ---- assert(PyFloat_Check(v)); ! PyOS_snprintf(format, 32, "%%.%ig", precision); ! PyOS_ascii_formatd(buf, buflen, format, v->ob_fval); cp = buf; if (*cp == '-') Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.217 retrieving revision 2.218 diff -C2 -d -r2.217 -r2.218 *** stringobject.c 5 Jan 2004 00:29:51 -0000 2.217 --- stringobject.c 8 Jun 2004 18:52:54 -0000 2.218 *************** *** 3583,3587 **** (flags&F_ALT) ? "#" : "", prec, type); ! PyOS_snprintf(buf, buflen, fmt, x); return strlen(buf); } --- 3583,3587 ---- (flags&F_ALT) ? "#" : "", prec, type); ! PyOS_ascii_formatd(buf, buflen, fmt, x); return strlen(buf); } From loewis at users.sourceforge.net Tue Jun 8 14:53:13 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 14:53:18 2004 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.144,1.145 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26461 Modified Files: Makefile.pre.in Log Message: Patch #774665: Make Python LC_NUMERIC agnostic. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** Makefile.pre.in 3 Jun 2004 12:41:45 -0000 1.144 --- Makefile.pre.in 8 Jun 2004 18:52:39 -0000 1.145 *************** *** 248,251 **** --- 248,252 ---- Python/traceback.o \ Python/getopt.o \ + Python/pystrtod.o \ Python/$(DYNLOADFILE) \ $(MACHDEP_OBJS) \ From loewis at users.sourceforge.net Tue Jun 8 14:53:14 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 14:53:23 2004 Subject: [Python-checkins] python/dist/src/Include pystrtod.h, NONE, 2.1 Python.h, 2.62, 2.63 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26461/Include Modified Files: Python.h Added Files: pystrtod.h Log Message: Patch #774665: Make Python LC_NUMERIC agnostic. --- NEW FILE: pystrtod.h --- #ifndef Py_STRTOD_H #define Py_STRTOD_H #ifdef __cplusplus extern "C" { #endif double PyOS_ascii_strtod(const char *str, char **ptr); double PyOS_ascii_atof(const char *str); char * PyOS_ascii_formatd(char *buffer, int buf_len, const char *format, double d); #ifdef __cplusplus } #endif #endif /* !Py_STRTOD_H */ Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.62 retrieving revision 2.63 diff -C2 -d -r2.62 -r2.63 *** Python.h 13 Mar 2004 23:11:44 -0000 2.62 --- Python.h 8 Jun 2004 18:52:41 -0000 2.63 *************** *** 120,123 **** --- 120,125 ---- #include "eval.h" + #include "pystrtod.h" + /* _Py_Mangle is defined in compile.c */ PyAPI_FUNC(int) _Py_Mangle(char *p, char *name, \ From loewis at users.sourceforge.net Tue Jun 8 14:53:13 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 14:53:27 2004 Subject: [Python-checkins] python/dist/src/Doc/lib liblocale.tex,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26461/Doc/lib Modified Files: liblocale.tex Log Message: Patch #774665: Make Python LC_NUMERIC agnostic. Index: liblocale.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblocale.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** liblocale.tex 3 Sep 2003 04:50:13 -0000 1.35 --- liblocale.tex 8 Jun 2004 18:52:41 -0000 1.36 *************** *** 457,479 **** perhaps to find out whether or not the locale is \samp{C}). - When Python is embedded in an application, if the application sets the - locale to something specific before initializing Python, that is - generally okay, and Python will use whatever locale is set, - \emph{except} that the \constant{LC_NUMERIC} locale should always be - \samp{C}. - - The \function{setlocale()} function in the \module{locale} module - gives the Python programmer the impression that you can manipulate the - \constant{LC_NUMERIC} locale setting, but this not the case at the C - level: C code will always find that the \constant{LC_NUMERIC} locale - setting is \samp{C}. This is because too much would break when the - decimal point character is set to something else than a period - (e.g. the Python parser would break). Caveat: threads that run - without holding Python's global interpreter lock may occasionally find - that the numeric locale setting differs; this is because the only - portable way to implement this feature is to set the numeric locale - settings to what the user requests, extract the relevant - characteristics, and then restore the \samp{C} numeric locale. - When Python code uses the \module{locale} module to change the locale, this also affects the embedding application. If the embedding --- 457,460 ---- From loewis at users.sourceforge.net Tue Jun 8 14:53:25 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 8 14:53:32 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.996,1.997 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26461/Misc Modified Files: NEWS Log Message: Patch #774665: Make Python LC_NUMERIC agnostic. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.996 retrieving revision 1.997 diff -C2 -d -r1.996 -r1.997 *** NEWS 8 Jun 2004 08:29:33 -0000 1.996 --- NEWS 8 Jun 2004 18:52:41 -0000 1.997 *************** *** 13,16 **** --- 13,20 ---- ----------------- + - Python no longer relies on the LC_NUMERIC locale setting to be + the "C" locale; as a result, it no longer tries to prevent changing + the LC_NUMERIC category. + - Bug #952807: Unpickling pickled instances of subclasses of datetime.date, datetime.datetime and datetime.time could yield insane From tim_one at users.sourceforge.net Tue Jun 8 16:33:27 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue Jun 8 16:33:31 2004 Subject: [Python-checkins] python/dist/src/PC/VC6 pythoncore.dsp,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/PC/VC6 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13688 Modified Files: pythoncore.dsp Log Message: Teach MSVC 6 about pystrtod.c. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/VC6/pythoncore.dsp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pythoncore.dsp 2 Jun 2004 18:58:44 -0000 1.10 --- pythoncore.dsp 8 Jun 2004 20:32:58 -0000 1.11 *************** *** 568,571 **** --- 568,575 ---- # Begin Source File + SOURCE=..\..\Python\pystrtod.c + # End Source File + # Begin Source File + SOURCE=..\python_nt.rc # End Source File From tim_one at users.sourceforge.net Tue Jun 8 16:34:46 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Tue Jun 8 16:34:50 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_os.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13936/Lib/test Modified Files: test_os.py Log Message: test_devnull(): Use assertEqual() instead of an assert stmt. Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** test_os.py 8 Jun 2004 08:29:32 -0000 1.24 --- test_os.py 8 Jun 2004 20:34:34 -0000 1.25 *************** *** 341,345 **** f.close() f = file(os.devnull, 'r') ! assert f.read() == '' f.close() --- 341,345 ---- f.close() f = file(os.devnull, 'r') ! self.assertEqual(f.read(), '') f.close() From nnorwitz at users.sourceforge.net Tue Jun 8 21:46:05 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Tue Jun 8 21:46:11 2004 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.319, 2.320 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22503/Modules Modified Files: posixmodule.c Log Message: Ensure path is initialized to prevent freeing random memory (reported by Thomas Heller). If have_unicode_filename is set, path looks like it will not be used, so there's no need to free it. Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.319 retrieving revision 2.320 diff -C2 -d -r2.319 -r2.320 *** posixmodule.c 6 Jun 2004 20:40:27 -0000 2.319 --- posixmodule.c 9 Jun 2004 01:46:02 -0000 2.320 *************** *** 1995,1999 **** posix_utime(PyObject *self, PyObject *args) { ! char *path; long atime, mtime, ausec, musec; int res; --- 1995,1999 ---- posix_utime(PyObject *self, PyObject *args) { ! char *path = NULL; long atime, mtime, ausec, musec; int res; *************** *** 2088,2095 **** if (res < 0) { #ifdef Py_WIN_WIDE_FILENAMES ! if (have_unicode_filename) { ! PyMem_Free(path); return posix_error_with_unicode_filename(wpath); - } #endif /* Py_WIN_WIDE_FILENAMES */ return posix_error_with_allocated_filename(path); --- 2088,2093 ---- if (res < 0) { #ifdef Py_WIN_WIDE_FILENAMES ! if (have_unicode_filename) return posix_error_with_unicode_filename(wpath); #endif /* Py_WIN_WIDE_FILENAMES */ return posix_error_with_allocated_filename(path); From neal at metaslash.com Tue Jun 8 21:48:41 2004 From: neal at metaslash.com (Neal Norwitz) Date: Tue Jun 8 21:48:45 2004 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.318, 2.319 In-Reply-To: References: Message-ID: <20040609014841.GE955@epoch.metaslash.com> On Tue, Jun 08, 2004 at 12:36:07PM +0200, Thomas Heller wrote: > nnorwitz@users.sourceforge.net writes: > > > Update of /cvsroot/python/python/dist/src/Modules > > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16270/Modules > > > > Modified Files: > > posixmodule.c > > Log Message: > > Plug a few memory leaks in utime(). path is allocated from within > > PyArg_ParseTuple() since the format is "et" This change should > > be reviewed carefully. > > I believe 'path' must be set to NULL at the start of the posix_utime > function - I had a crash in a debug build on windows when running > lib\test\test_unicode_file.py. Yes, you are correct. I checked in a fix. path should not be used if have_unicode_filename is set. So I removed an unnecessary free too. Let me know if you have any more problems. Neal From goodger at users.sourceforge.net Tue Jun 8 22:02:45 2004 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Tue Jun 8 22:02:49 2004 Subject: [Python-checkins] python/nondist/peps pep-0256.txt, 1.6, 1.7 pep-0258.txt, 1.7, 1.8 pep-0287.txt, 1.6, 1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5092 Modified Files: pep-0256.txt pep-0258.txt pep-0287.txt Log Message: updated links; thanks to Felix Wiemann Index: pep-0256.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0256.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0256.txt 8 Nov 2002 12:15:44 -0000 1.6 --- pep-0256.txt 9 Jun 2004 02:02:42 -0000 1.7 *************** *** 90,94 **** - Doug Hellmann's HappyDoc_ ! - Laurence Tratt's Crystal_ - Ka-Ping Yee's pydoc_ (pydoc.py is now part of the Python standard --- 90,94 ---- - Doug Hellmann's HappyDoc_ ! - Laurence Tratt's Crystal (no longer available on the web) - Ka-Ping Yee's pydoc_ (pydoc.py is now part of the Python standard *************** *** 257,261 **** .. _doc.py: ! http://www.lemburg.com/files/python/SoftwareDescriptions.html#doc.py .. _pythondoc: --- 257,261 ---- .. _doc.py: ! http://www.egenix.com/files/python/SoftwareDescriptions.html#doc.py .. _pythondoc: *************** *** 264,272 **** .. _HappyDoc: http://happydoc.sourceforge.net/ - .. _Crystal: http://www.btinternet.com/~tratt/comp/python/crystal/ - .. _pydoc: http://www.python.org/doc/current/lib/module-pydoc.html ! .. _docutils: http://homepage.ntlworld.com/tibsnjoan/docutils/ .. _Docutils project: http://docutils.sourceforge.net/ --- 264,270 ---- .. _HappyDoc: http://happydoc.sourceforge.net/ .. _pydoc: http://www.python.org/doc/current/lib/module-pydoc.html ! .. _docutils: http://www.tibsnjoan.co.uk/docutils.html .. _Docutils project: http://docutils.sourceforge.net/ Index: pep-0258.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0258.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0258.txt 23 Apr 2004 13:29:34 -0000 1.7 --- pep-0258.txt 9 Jun 2004 02:02:42 -0000 1.8 *************** *** 471,475 **** Docutils processing. See `Docutils Front-End Tools`_ for details. ! .. _Docutils Front-End Tools: http://docutils.sf.net/docs/tools.html --- 471,476 ---- Docutils processing. See `Docutils Front-End Tools`_ for details. ! .. _Docutils Front-End Tools: ! http://docutils.sourceforge.net/docs/user/tools.html *************** *** 950,959 **** (http://www.python.org/peps/pep-0216.html) ! .. _docutils.dtd: http://docutils.sourceforge.net/spec/docutils.dtd ! .. _soextbl.dtd: http://docutils.sourceforge.net/spec/soextblx.dtd .. _The Docutils Document Tree: ! http://docutils.sourceforge.net/spec/doctree.html .. _VMS error condition severity levels: --- 951,962 ---- (http://www.python.org/peps/pep-0216.html) ! .. _docutils.dtd: ! http://docutils.sourceforge.net/docs/ref/docutils.dtd ! .. _soextbl.dtd: ! http://docutils.sourceforge.net/docs/ref/soextblx.dtd .. _The Docutils Document Tree: ! http://docutils.sourceforge.net/docs/ref/doctree.html .. _VMS error condition severity levels: *************** *** 961,968 **** #error_cond_severity ! .. _log4j project: http://jakarta.apache.org/log4j/ .. _Docutils Python Source DTD: ! http://docutils.sourceforge.net/spec/pysource.dtd .. _ISO 639: http://lcweb.loc.gov/standards/iso639-2/englangn.html --- 964,971 ---- #error_cond_severity ! .. _log4j project: http://logging.apache.org/log4j/docs/index.html .. _Docutils Python Source DTD: ! http://docutils.sourceforge.net/docs/dev/pysource.dtd .. _ISO 639: http://lcweb.loc.gov/standards/iso639-2/englangn.html Index: pep-0287.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0287.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0287.txt 9 Nov 2002 21:02:21 -0000 1.6 --- pep-0287.txt 9 Jun 2004 02:02:42 -0000 1.7 *************** *** 514,518 **** StructuredText`_ for further elaboration. ! __ http://docutils.sourceforge.net/spec/rst/problems.html #section-structure-via-indentation --- 514,518 ---- StructuredText`_ for further elaboration. ! __ http://docutils.sourceforge.net/docs/dev/rst/problems.html #section-structure-via-indentation *************** *** 742,746 **** (http://www.python.org/peps/pep-0216.html) ! .. _reStructuredText markup: http://docutils.sourceforge.net/spec/rst.html .. _Doc-SIG: http://www.python.org/sigs/doc-sig/ --- 742,746 ---- (http://www.python.org/peps/pep-0216.html) ! .. _reStructuredText markup: http://docutils.sourceforge.net/rst.html .. _Doc-SIG: http://www.python.org/sigs/doc-sig/ *************** *** 768,790 **** .. _A ReStructuredText Primer: ! http://docutils.sourceforge.net/docs/rst/quickstart.html .. _Quick reStructuredText: ! http://docutils.sourceforge.net/docs/rst/quickref.html .. _An Introduction to reStructuredText: ! http://docutils.sourceforge.net/spec/rst/introduction.html .. _reStructuredText Markup Specification: ! http://docutils.sourceforge.net/spec/rst/reStructuredText.html .. _reStructuredText Directives: ! http://docutils.sourceforge.net/spec/rst/directives.html .. _Problems with StructuredText: ! http://docutils.sourceforge.net/spec/rst/problems.html .. _A Record of reStructuredText Syntax Alternatives: ! http://docutils.sourceforge.net/spec/rst/alternatives.html .. _Docutils: http://docutils.sourceforge.net/ --- 768,790 ---- .. _A ReStructuredText Primer: ! http://docutils.sourceforge.net/docs/user/rst/quickstart.html .. _Quick reStructuredText: ! http://docutils.sourceforge.net/docs/user/rst/quickref.html .. _An Introduction to reStructuredText: ! http://docutils.sourceforge.net/docs/ref/rst/introduction.html .. _reStructuredText Markup Specification: ! http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html .. _reStructuredText Directives: ! http://docutils.sourceforge.net/docs/ref/rst/directives.html .. _Problems with StructuredText: ! http://docutils.sourceforge.net/docs/dev/rst/problems.html .. _A Record of reStructuredText Syntax Alternatives: ! http://docutils.sourceforge.net/docs/dev/rst/alternatives.html .. _Docutils: http://docutils.sourceforge.net/ From fdrake at users.sourceforge.net Wed Jun 9 10:50:22 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Jun 9 10:50:26 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libbasehttp.tex, 1.15, 1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30746 Modified Files: libbasehttp.tex Log Message: make a reference to the SimpleHTTPServer module a hyperlink to the docs Index: libbasehttp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbasehttp.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libbasehttp.tex 29 Apr 2004 02:47:38 -0000 1.15 --- libbasehttp.tex 9 Jun 2004 14:50:19 -0000 1.16 *************** *** 15,19 **** (Web servers). Usually, this module isn't used directly, but is used as a basis for building functioning Web servers. See the ! \module{SimpleHTTPServer}\refstmodindex{SimpleHTTPServer} and \refmodule{CGIHTTPServer}\refstmodindex{CGIHTTPServer} modules. --- 15,19 ---- (Web servers). Usually, this module isn't used directly, but is used as a basis for building functioning Web servers. See the ! \refmodule{SimpleHTTPServer}\refstmodindex{SimpleHTTPServer} and \refmodule{CGIHTTPServer}\refstmodindex{CGIHTTPServer} modules. From fdrake at users.sourceforge.net Wed Jun 9 10:52:03 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Jun 9 10:52:06 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libbasehttp.tex, 1.14.18.1, 1.14.18.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32137 Modified Files: Tag: release23-maint libbasehttp.tex Log Message: make a reference to the SimpleHTTPServer module a hyperlink to the docs Index: libbasehttp.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbasehttp.tex,v retrieving revision 1.14.18.1 retrieving revision 1.14.18.2 diff -C2 -d -r1.14.18.1 -r1.14.18.2 *** libbasehttp.tex 29 Apr 2004 02:47:09 -0000 1.14.18.1 --- libbasehttp.tex 9 Jun 2004 14:52:00 -0000 1.14.18.2 *************** *** 15,19 **** (Web servers). Usually, this module isn't used directly, but is used as a basis for building functioning Web servers. See the ! \module{SimpleHTTPServer}\refstmodindex{SimpleHTTPServer} and \refmodule{CGIHTTPServer}\refstmodindex{CGIHTTPServer} modules. --- 15,19 ---- (Web servers). Usually, this module isn't used directly, but is used as a basis for building functioning Web servers. See the ! \refmodule{SimpleHTTPServer}\refstmodindex{SimpleHTTPServer} and \refmodule{CGIHTTPServer}\refstmodindex{CGIHTTPServer} modules. From fdrake at users.sourceforge.net Wed Jun 9 10:56:16 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Jun 9 10:56:21 2004 Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.74.4.11, 2.74.4.12 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3503 Modified Files: Tag: release23-maint patchlevel.h Log Message: update version number since changes have been made since the release Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.74.4.11 retrieving revision 2.74.4.12 diff -C2 -d -r2.74.4.11 -r2.74.4.12 *** patchlevel.h 19 May 2004 03:14:27 -0000 2.74.4.11 --- patchlevel.h 9 Jun 2004 14:56:12 -0000 2.74.4.12 *************** *** 22,31 **** #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 3 ! #define PY_MICRO_VERSION 4 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.3.4" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 22,31 ---- #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 3 ! #define PY_MICRO_VERSION 5 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.3.5a0" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From fdrake at users.sourceforge.net Wed Jun 9 10:58:24 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Jun 9 10:58:28 2004 Subject: [Python-checkins] python/dist/src/Doc/commontex boilerplate.tex, 1.1.2.8, 1.1.2.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6047 Modified Files: Tag: release23-maint boilerplate.tex Log Message: switch back to \today since we're post-release Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/boilerplate.tex,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -C2 -d -r1.1.2.8 -r1.1.2.9 *** boilerplate.tex 19 May 2004 15:01:15 -0000 1.1.2.8 --- boilerplate.tex 9 Jun 2004 14:58:21 -0000 1.1.2.9 *************** *** 6,10 **** } ! \date{May 20, 2004} % XXX update before final release! ! %\date{\today} \input{patchlevel} % include Python version information --- 6,10 ---- } ! \date{\today} ! %\date{May 20, 2004} % XXX update before final release! \input{patchlevel} % include Python version information From theller at users.sourceforge.net Wed Jun 9 14:33:50 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed Jun 9 14:33:54 2004 Subject: [Python-checkins] python/dist/src/Doc/tools undoc_symbols.py, 1.5, 1.5.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26926 Modified Files: Tag: release23-maint undoc_symbols.py Log Message: Public Python functions are nowadays marked PyAPI_FUNC, not DL_IMPORT. Index: undoc_symbols.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/undoc_symbols.py,v retrieving revision 1.5 retrieving revision 1.5.18.1 diff -C2 -d -r1.5 -r1.5.18.1 *** undoc_symbols.py 16 Apr 2002 15:04:56 -0000 1.5 --- undoc_symbols.py 9 Jun 2004 18:33:48 -0000 1.5.18.1 *************** *** 78,82 **** incfiles = os.path.join(incdir, INCLUDEPATTERN) ! fp = os.popen("ctags -IDL_IMPORT --c-types=%s -f - %s" % (TAG_KINDS, incfiles)) dict = findnames(fp, prefix) --- 78,82 ---- incfiles = os.path.join(incdir, INCLUDEPATTERN) ! fp = os.popen("ctags -IPyAPI_FUNC --c-types=%s -f - %s" % (TAG_KINDS, incfiles)) dict = findnames(fp, prefix) From theller at users.sourceforge.net Wed Jun 9 14:38:22 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed Jun 9 14:38:24 2004 Subject: [Python-checkins] python/dist/src/Doc/tools undoc_symbols.py, 1.5, 1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31541 Modified Files: undoc_symbols.py Log Message: Public Python functions are nowadays marked PyAPI_FUNC, not DL_IMPORT. Index: undoc_symbols.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/undoc_symbols.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** undoc_symbols.py 16 Apr 2002 15:04:56 -0000 1.5 --- undoc_symbols.py 9 Jun 2004 18:38:20 -0000 1.6 *************** *** 78,82 **** incfiles = os.path.join(incdir, INCLUDEPATTERN) ! fp = os.popen("ctags -IDL_IMPORT --c-types=%s -f - %s" % (TAG_KINDS, incfiles)) dict = findnames(fp, prefix) --- 78,82 ---- incfiles = os.path.join(incdir, INCLUDEPATTERN) ! fp = os.popen("ctags -IPyAPI_FUNC --c-types=%s -f - %s" % (TAG_KINDS, incfiles)) dict = findnames(fp, prefix) From theller at users.sourceforge.net Wed Jun 9 14:50:57 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Wed Jun 9 14:51:02 2004 Subject: [Python-checkins] python/dist/src/Doc/tools undoc_symbols.py, 1.6, 1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13330 Modified Files: undoc_symbols.py Log Message: Defining Py_GCC_ATTRIBUTE finds even some more undocumented functions. Index: undoc_symbols.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/undoc_symbols.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** undoc_symbols.py 9 Jun 2004 18:38:20 -0000 1.6 --- undoc_symbols.py 9 Jun 2004 18:50:54 -0000 1.7 *************** *** 78,82 **** incfiles = os.path.join(incdir, INCLUDEPATTERN) ! fp = os.popen("ctags -IPyAPI_FUNC --c-types=%s -f - %s" % (TAG_KINDS, incfiles)) dict = findnames(fp, prefix) --- 78,82 ---- incfiles = os.path.join(incdir, INCLUDEPATTERN) ! fp = os.popen("ctags -IPyAPI_FUNC -IPy_GCC_ATTRIBUTE --c-types=%s -f - %s" % (TAG_KINDS, incfiles)) dict = findnames(fp, prefix) From miclunbajvvrvz at chat.ru Wed Jun 9 19:48:22 2004 From: miclunbajvvrvz at chat.ru (SOFTWARE NEWSLETTER) Date: Wed Jun 9 18:52:55 2004 Subject: [Python-checkins] Get 96% Dis.counted OEM Microsoft, Corel, Adobe Software - Python-announce hockey player alchemists from 1 Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040609/ef555275/attachment.html From rhettinger at users.sourceforge.net Thu Jun 10 01:03:18 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 10 01:03:22 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.997,1.998 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16530/Misc Modified Files: NEWS Log Message: SF patch #969791: Add nlargest() and nsmallest() to heapq. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.997 retrieving revision 1.998 diff -C2 -d -r1.997 -r1.998 *** NEWS 8 Jun 2004 18:52:41 -0000 1.997 --- NEWS 10 Jun 2004 05:03:14 -0000 1.998 *************** *** 417,421 **** - bisect.py and heapq.py now have underlying C implementations ! for better performance - traceback.format_exc has been added (similar to print_exc but it returns --- 417,423 ---- - bisect.py and heapq.py now have underlying C implementations ! for better performance. ! ! - heapq.py has two new functions, nsmallest() and nlargest(). - traceback.format_exc has been added (similar to print_exc but it returns From rhettinger at users.sourceforge.net Thu Jun 10 01:03:19 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 10 01:03:28 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libheapq.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16530/Doc/lib Modified Files: libheapq.tex Log Message: SF patch #969791: Add nlargest() and nsmallest() to heapq. Index: libheapq.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libheapq.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libheapq.tex 7 Aug 2002 18:56:08 -0000 1.5 --- libheapq.tex 10 Jun 2004 05:03:16 -0000 1.6 *************** *** 84,87 **** --- 84,111 ---- \end{verbatim} + The module also offers two general purpose functions based on heaps. + + \begin{funcdesc}{nlargest}{iterable, n} + Return a list with the \var{n} largest elements from the dataset defined + by \var{iterable}. Equivalent to: \code{sorted(iterable, reverse=True)[:n]} + \versionadded{2.4} + \end{funcdesc} + + \begin{funcdesc}{nsmallest}{iterable, n} + Return a list with the \var{n} smallest elements from the dataset defined + by \var{iterable}. Equivalent to: \code{sorted(iterable)[:n]} + \versionadded{2.4} + \end{funcdesc} + + Though the above functions appear symmetrical, they each have different + speed and space requirements. In particular, \function{nsmallest()} + operates on a full copy of the dataset. In contrast, \function{nlargest()} + only requires storage space for \var{n} elements. + + Both functions perform best for smaller values of \var{n}. For larger + values, it is more efficient to use the \function{sorted()} function. Also, + when \code{n==1}, it is more efficient to use the builtin \function{min()} + and \function{max()} functions. + \subsection{Theory} From rhettinger at users.sourceforge.net Thu Jun 10 01:03:19 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 10 01:03:30 2004 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.54, 1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16530/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: SF patch #969791: Add nlargest() and nsmallest() to heapq. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** whatsnew24.tex 4 Jun 2004 09:33:18 -0000 1.54 --- whatsnew24.tex 10 Jun 2004 05:03:16 -0000 1.55 *************** *** 450,454 **** \item The \module{heapq} module has been converted to C. The resulting tenfold improvement in speed makes the module suitable for handling ! high volumes of data. \item The \module{imaplib} module now supports IMAP's THREAD command. --- 450,457 ---- \item The \module{heapq} module has been converted to C. The resulting tenfold improvement in speed makes the module suitable for handling ! high volumes of data. In addition, the module has two new functions ! \function{nlargest()} and \function{nsmallest()} that use heaps to ! find the largest or smallest n values in a dataset without the ! expense of a full sort. \item The \module{imaplib} module now supports IMAP's THREAD command. From rhettinger at users.sourceforge.net Thu Jun 10 01:03:19 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 10 01:03:35 2004 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16530/Lib Modified Files: heapq.py Log Message: SF patch #969791: Add nlargest() and nsmallest() to heapq. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** heapq.py 19 Apr 2004 19:06:21 -0000 1.21 --- heapq.py 10 Jun 2004 05:03:16 -0000 1.22 *************** *** 31,35 **** """ ! # Original code by Kevin O'Connor, augmented by Tim Peters __about__ = """Heap queues --- 31,35 ---- """ ! # Original code by Kevin O'Connor, augmented by Tim Peters and Raymond Hettinger __about__ = """Heap queues *************** *** 127,131 **** """ ! __all__ = ['heappush', 'heappop', 'heapify', 'heapreplace'] def heappush(heap, item): --- 127,134 ---- """ ! __all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'nlargest', ! 'nsmallest'] ! ! from itertools import islice, repeat def heappush(heap, item): *************** *** 169,172 **** --- 172,204 ---- _siftup(x, i) + def nlargest(iterable, n): + """Find the n largest elements in a dataset. + + Equivalent to: sorted(iterable, reverse=True)[:n] + """ + it = iter(iterable) + result = list(islice(it, n)) + if not result: + return result + heapify(result) + _heapreplace = heapreplace + sol = result[0] # sol --> smallest of the nlargest + for elem in it: + if elem <= sol: + continue + _heapreplace(result, elem) + sol = result[0] + result.sort(reverse=True) + return result + + def nsmallest(iterable, n): + """Find the n smallest elements in a dataset. + + Equivalent to: sorted(iterable)[:n] + """ + h = list(iterable) + heapify(h) + return map(heappop, repeat(h, min(n, len(h)))) + # 'heap' is a heap at all indices >= startpos, except possibly for pos. pos # is the index of a leaf with a possibly out-of-order value. Restore the From rhettinger at users.sourceforge.net Thu Jun 10 01:03:19 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 10 01:03:38 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16530/Lib/test Modified Files: test_heapq.py Log Message: SF patch #969791: Add nlargest() and nsmallest() to heapq. Index: test_heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_heapq.py 7 Dec 2002 10:33:42 -0000 1.7 --- test_heapq.py 10 Jun 2004 05:03:17 -0000 1.8 *************** *** 3,7 **** from test.test_support import verify, vereq, verbose, TestFailed ! from heapq import heappush, heappop, heapify, heapreplace import random --- 3,7 ---- from test.test_support import verify, vereq, verbose, TestFailed ! from heapq import heappush, heappop, heapify, heapreplace, nlargest, nsmallest import random *************** *** 85,88 **** --- 85,97 ---- sorted = [heappop(heap) for i in range(size)] vereq(data, sorted) + + # 7) Check nlargest() and nsmallest() + data = [random.randrange(2000) for i in range(1000)] + copy = data[:] + copy.sort(reverse=True) + vereq(nlargest(data, 400), copy[:400]) + copy.sort() + vereq(nsmallest(data, 400), copy[:400]) + # Make user happy if verbose: From rhettinger at users.sourceforge.net Thu Jun 10 01:07:20 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 10 01:07:26 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19278 Modified Files: test_heapq.py Log Message: Convert test_heapq.py to unittests. Index: test_heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_heapq.py 10 Jun 2004 05:03:17 -0000 1.8 --- test_heapq.py 10 Jun 2004 05:07:18 -0000 1.9 *************** *** 1,101 **** """Unittests for heapq.""" - from test.test_support import verify, vereq, verbose, TestFailed - from heapq import heappush, heappop, heapify, heapreplace, nlargest, nsmallest import random - def check_invariant(heap): - # Check the heap invariant. - for pos, item in enumerate(heap): - if pos: # pos 0 has no parent - parentpos = (pos-1) >> 1 - verify(heap[parentpos] <= item) ! # An iterator returning a heap's elements, smallest-first. ! class heapiter(object): ! def __init__(self, heap): ! self.heap = heap ! def next(self): ! try: ! return heappop(self.heap) ! except IndexError: ! raise StopIteration ! def __iter__(self): ! return self ! def test_main(): ! # 1) Push 100 random numbers and pop them off, verifying all's OK. ! heap = [] ! data = [] ! check_invariant(heap) ! for i in range(256): ! item = random.random() ! data.append(item) ! heappush(heap, item) ! check_invariant(heap) ! results = [] ! while heap: ! item = heappop(heap) ! check_invariant(heap) ! results.append(item) ! data_sorted = data[:] ! data_sorted.sort() ! vereq(data_sorted, results) ! # 2) Check that the invariant holds for a sorted array ! check_invariant(results) ! # 3) Naive "N-best" algorithm ! heap = [] ! for item in data: ! heappush(heap, item) ! if len(heap) > 10: ! heappop(heap) ! heap.sort() ! vereq(heap, data_sorted[-10:]) ! # 4) Test heapify. ! for size in range(30): ! heap = [random.random() for dummy in range(size)] ! heapify(heap) ! check_invariant(heap) ! # 5) Less-naive "N-best" algorithm, much faster (if len(data) is big ! # enough ) than sorting all of data. However, if we had a max ! # heap instead of a min heap, it could go faster still via ! # heapify'ing all of data (linear time), then doing 10 heappops ! # (10 log-time steps). ! heap = data[:10] ! heapify(heap) ! for item in data[10:]: ! if item > heap[0]: # this gets rarer the longer we run ! heapreplace(heap, item) ! vereq(list(heapiter(heap)), data_sorted[-10:]) ! # 6) Exercise everything with repeated heapsort checks ! for trial in xrange(100): ! size = random.randrange(50) ! data = [random.randrange(25) for i in range(size)] ! if trial & 1: # Half of the time, use heapify ! heap = data[:] heapify(heap) ! else: # The rest of the time, use heappush ! heap = [] ! for item in data: ! heappush(heap,item) ! data.sort() ! sorted = [heappop(heap) for i in range(size)] ! vereq(data, sorted) ! # 7) Check nlargest() and nsmallest() ! data = [random.randrange(2000) for i in range(1000)] ! copy = data[:] ! copy.sort(reverse=True) ! vereq(nlargest(data, 400), copy[:400]) ! copy.sort() ! vereq(nsmallest(data, 400), copy[:400]) ! # Make user happy ! if verbose: ! print "All OK" if __name__ == "__main__": test_main() --- 1,105 ---- """Unittests for heapq.""" from heapq import heappush, heappop, heapify, heapreplace, nlargest, nsmallest import random + import unittest + from test import test_support ! def heapiter(heap): ! # An iterator returning a heap's elements, smallest-first. ! try: ! while 1: ! yield heappop(heap) ! except IndexError: ! pass ! class TestHeap(unittest.TestCase): ! def test_push_pop(self): ! # 1) Push 256 random numbers and pop them off, verifying all's OK. ! heap = [] ! data = [] ! self.check_invariant(heap) ! for i in range(256): ! item = random.random() ! data.append(item) ! heappush(heap, item) ! self.check_invariant(heap) ! results = [] ! while heap: ! item = heappop(heap) ! self.check_invariant(heap) ! results.append(item) ! data_sorted = data[:] ! data_sorted.sort() ! self.assertEqual(data_sorted, results) ! # 2) Check that the invariant holds for a sorted array ! self.check_invariant(results) ! def check_invariant(self, heap): ! # Check the heap invariant. ! for pos, item in enumerate(heap): ! if pos: # pos 0 has no parent ! parentpos = (pos-1) >> 1 ! self.assert_(heap[parentpos] <= item) ! ! def test_heapify(self): ! for size in range(30): ! heap = [random.random() for dummy in range(size)] heapify(heap) ! self.check_invariant(heap) ! def test_naive_nbest(self): ! data = [random.randrange(2000) for i in range(1000)] ! heap = [] ! for item in data: ! heappush(heap, item) ! if len(heap) > 10: ! heappop(heap) ! heap.sort() ! self.assertEqual(heap, sorted(data)[-10:]) ! def test_nbest(self): ! # Less-naive "N-best" algorithm, much faster (if len(data) is big ! # enough ) than sorting all of data. However, if we had a max ! # heap instead of a min heap, it could go faster still via ! # heapify'ing all of data (linear time), then doing 10 heappops ! # (10 log-time steps). ! data = [random.randrange(2000) for i in range(1000)] ! heap = data[:10] ! heapify(heap) ! for item in data[10:]: ! if item > heap[0]: # this gets rarer the longer we run ! heapreplace(heap, item) ! self.assertEqual(list(heapiter(heap)), sorted(data)[-10:]) ! ! def test_heapsort(self): ! # Exercise everything with repeated heapsort checks ! for trial in xrange(100): ! size = random.randrange(50) ! data = [random.randrange(25) for i in range(size)] ! if trial & 1: # Half of the time, use heapify ! heap = data[:] ! heapify(heap) ! else: # The rest of the time, use heappush ! heap = [] ! for item in data: ! heappush(heap, item) ! heap_sorted = [heappop(heap) for i in range(size)] ! self.assertEqual(heap_sorted, sorted(data)) ! ! def test_nsmallest(self): ! data = [random.randrange(2000) for i in range(1000)] ! self.assertEqual(nsmallest(data, 400), sorted(data)[:400]) ! ! def test_largest(self): ! data = [random.randrange(2000) for i in range(1000)] ! self.assertEqual(nlargest(data, 400), sorted(data, reverse=True)[:400]) ! ! def test_main(): ! test_support.run_unittest(TestHeap) if __name__ == "__main__": test_main() + From rhettinger at users.sourceforge.net Thu Jun 10 14:39:37 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 10 14:39:41 2004 Subject: [Python-checkins] python/dist/src/Objects tupleobject.c,2.92,2.93 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32483 Modified Files: tupleobject.c Log Message: Add a final permutation step to the tuple hash function. Prevents a collision pattern that occurs with nested tuples. (Yitz Gale provided code that repeatably demonstrated the weakness.) Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.92 retrieving revision 2.93 diff -C2 -d -r2.92 -r2.93 *** tupleobject.c 4 Jun 2004 06:35:20 -0000 2.92 --- tupleobject.c 10 Jun 2004 18:39:35 -0000 2.93 *************** *** 281,284 **** --- 281,285 ---- mult += 82520L + len + len; } + x += 97531L; if (x == -1) x = -2; From rhettinger at users.sourceforge.net Thu Jun 10 14:42:18 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 10 14:42:21 2004 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.263,1.264 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6788 Modified Files: ACKS Log Message: Add a final permutation step to the tuple hash function. Prevents a collision pattern that occurs with nested tuples. (Yitz Gale provided code that repeatably demonstrated the weakness.) Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.263 retrieving revision 1.264 diff -C2 -d -r1.263 -r1.264 *** ACKS 2 Jun 2004 15:37:04 -0000 1.263 --- ACKS 10 Jun 2004 18:42:15 -0000 1.264 *************** *** 191,194 **** --- 191,195 ---- Geoff Furnish Lele Gaifax + Yitzchak Gale Raymund Galvin Nitin Ganatra From rhettinger at users.sourceforge.net Thu Jun 10 17:38:43 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 10 17:38:47 2004 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28236 Modified Files: setobject.c Log Message: Fixups to the hash function for frozensets. * Non-zero initial value so that hash(frozenset()) != hash(0). * Final permutation to differentiate nested sets. * Add logic to make sure that -1 is not a possible hash value. Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** setobject.c 30 May 2004 07:26:45 -0000 1.23 --- setobject.c 10 Jun 2004 21:38:41 -0000 1.24 *************** *** 664,668 **** PyObject *key, *value; int pos = 0; ! long hash = 0; if (so->hash != -1) --- 664,668 ---- PyObject *key, *value; int pos = 0; ! long hash = 1905176217L; if (so->hash != -1) *************** *** 677,680 **** --- 677,683 ---- hash ^= PyObject_Hash(key) * 3644798167u; } + hash *= 69069L; + if (hash == -1) + hash = 590923713L; so->hash = hash; return hash; From rhettinger at users.sourceforge.net Thu Jun 10 18:41:50 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 10 18:41:57 2004 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30622 Modified Files: setobject.c Log Message: Futher improvements to frozenset hashing (based on Yitz Gale's battery of tests which nicely highly highlight weaknesses). * Initial value is now a large prime. * Pre-multiply by the set length to add one more basis of differentiation. * Work a bit harder inside the loop to scatter bits from sources that may have closely spaced hash values. All of this is necessary to make up for keep the hash function commutative. Fortunately, the hash value is cached so the call to frozenset_hash() will only occur once per set. Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** setobject.c 10 Jun 2004 21:38:41 -0000 1.24 --- setobject.c 10 Jun 2004 22:41:48 -0000 1.25 *************** *** 664,681 **** PyObject *key, *value; int pos = 0; ! long hash = 1905176217L; if (so->hash != -1) return so->hash; while (PyDict_Next(so->data, &pos, &key, &value)) { ! /* Multiplying by a large prime increases the bit dispersion for ! closely spaced hash values. The is important because some ! use cases have many combinations of a small number of ! elements with nearby hashes so that many distinct combinations ! collapse to only a handful of distinct hash values. */ ! hash ^= PyObject_Hash(key) * 3644798167u; } ! hash *= 69069L; if (hash == -1) hash = 590923713L; --- 664,683 ---- PyObject *key, *value; int pos = 0; ! long hash = 1927868237L; if (so->hash != -1) return so->hash; + hash *= (PyDict_Size(so->data) + 1); while (PyDict_Next(so->data, &pos, &key, &value)) { ! /* Work to increase the bit dispersion for closely spaced hash ! values. The is important because some use cases have many ! combinations of a small number of elements with nearby ! hashes so that many distinct combinations collapse to only ! a handful of distinct hash values. */ ! long h = PyObject_Hash(key); ! hash ^= (h ^ (h << 16) ^ 89869747L) * 3644798167u; } ! hash = hash * 69069L + 907133923L; if (hash == -1) hash = 590923713L; From montanaro at users.sourceforge.net Fri Jun 11 00:46:15 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri Jun 11 00:46:19 2004 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.91,1.92 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28680 Modified Files: pydoc.py Log Message: Respect a module's __all__ attribute. Closes #969938. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.91 retrieving revision 1.92 diff -C2 -d -r1.91 -r1.92 *** pydoc.py 7 Jun 2004 02:40:05 -0000 1.91 --- pydoc.py 11 Jun 2004 04:46:12 -0000 1.92 *************** *** 152,156 **** return yes, no ! def visiblename(name): """Decide whether to show documentation on a variable.""" # Certain special names are redundant. --- 152,156 ---- return yes, no ! def visiblename(name, all=None): """Decide whether to show documentation on a variable.""" # Certain special names are redundant. *************** *** 159,163 **** # Private names are hidden, but special names are displayed. if name.startswith('__') and name.endswith('__'): return 1 ! return not name.startswith('_') # ----------------------------------------------------- module manipulation --- 159,167 ---- # Private names are hidden, but special names are displayed. if name.startswith('__') and name.endswith('__'): return 1 ! if all is not None: ! # only document that which the programmer exported in __all__ ! return name in all ! else: ! return not name.startswith('_') # ----------------------------------------------------- module manipulation *************** *** 545,548 **** --- 549,556 ---- """Produce HTML documentation for a module object.""" name = object.__name__ # ignore the passed-in name + try: + all = object.__all__ + except AttributeError: + all = None parts = split(name, '.') links = [] *************** *** 586,590 **** for key, value in inspect.getmembers(object, inspect.isclass): if (inspect.getmodule(value) or object) is object: ! if visiblename(key): classes.append((key, value)) cdict[key] = cdict[value] = '#' + key --- 594,598 ---- for key, value in inspect.getmembers(object, inspect.isclass): if (inspect.getmodule(value) or object) is object: ! if visiblename(key, all): classes.append((key, value)) cdict[key] = cdict[value] = '#' + key *************** *** 600,604 **** for key, value in inspect.getmembers(object, inspect.isroutine): if inspect.isbuiltin(value) or inspect.getmodule(value) is object: ! if visiblename(key): funcs.append((key, value)) fdict[key] = '#-' + key --- 608,612 ---- for key, value in inspect.getmembers(object, inspect.isroutine): if inspect.isbuiltin(value) or inspect.getmodule(value) is object: ! if visiblename(key, all): funcs.append((key, value)) fdict[key] = '#-' + key *************** *** 606,610 **** data = [] for key, value in inspect.getmembers(object, isdata): ! if visiblename(key): data.append((key, value)) --- 614,618 ---- data = [] for key, value in inspect.getmembers(object, isdata): ! if visiblename(key, all): data.append((key, value)) *************** *** 989,992 **** --- 997,1005 ---- try: + all = object.__all__ + except AttributeError: + all = None + + try: file = inspect.getabsfile(object) except TypeError: *************** *** 1004,1017 **** for key, value in inspect.getmembers(object, inspect.isclass): if (inspect.getmodule(value) or object) is object: ! if visiblename(key): classes.append((key, value)) funcs = [] for key, value in inspect.getmembers(object, inspect.isroutine): if inspect.isbuiltin(value) or inspect.getmodule(value) is object: ! if visiblename(key): funcs.append((key, value)) data = [] for key, value in inspect.getmembers(object, isdata): ! if visiblename(key): data.append((key, value)) --- 1017,1030 ---- for key, value in inspect.getmembers(object, inspect.isclass): if (inspect.getmodule(value) or object) is object: ! if visiblename(key, all): classes.append((key, value)) funcs = [] for key, value in inspect.getmembers(object, inspect.isroutine): if inspect.isbuiltin(value) or inspect.getmodule(value) is object: ! if visiblename(key, all): funcs.append((key, value)) data = [] for key, value in inspect.getmembers(object, isdata): ! if visiblename(key, all): data.append((key, value)) From montanaro at users.sourceforge.net Fri Jun 11 00:49:20 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri Jun 11 00:49:23 2004 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.191,2.192 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32103 Modified Files: fileobject.c Log Message: dump HAVE_FOPENRF stuff - obsolete Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.191 retrieving revision 2.192 diff -C2 -d -r2.191 -r2.192 *** fileobject.c 31 May 2004 00:35:51 -0000 2.191 --- fileobject.c 11 Jun 2004 04:49:03 -0000 2.192 *************** *** 152,186 **** } errno = 0; ! #ifdef HAVE_FOPENRF ! if (*mode == '*') { ! FILE *fopenRF(); ! f->f_fp = fopenRF(name, mode+1); ! } ! else ! #endif ! { ! if (strcmp(mode, "U") == 0 || strcmp(mode, "rU") == 0) ! mode = "rb"; #ifdef MS_WINDOWS ! if (PyUnicode_Check(f->f_name)) { ! PyObject *wmode; ! wmode = PyUnicode_DecodeASCII(mode, strlen(mode), NULL); ! if (f->f_name && wmode) { ! Py_BEGIN_ALLOW_THREADS ! /* PyUnicode_AS_UNICODE OK without thread ! lock as it is a simple dereference. */ ! f->f_fp = _wfopen(PyUnicode_AS_UNICODE(f->f_name), ! PyUnicode_AS_UNICODE(wmode)); ! Py_END_ALLOW_THREADS ! } ! Py_XDECREF(wmode); ! } ! #endif ! if (NULL == f->f_fp && NULL != name) { Py_BEGIN_ALLOW_THREADS ! f->f_fp = fopen(name, mode); Py_END_ALLOW_THREADS } } if (f->f_fp == NULL) { #ifdef _MSC_VER --- 152,179 ---- } errno = 0; ! ! if (strcmp(mode, "U") == 0 || strcmp(mode, "rU") == 0) ! mode = "rb"; #ifdef MS_WINDOWS ! if (PyUnicode_Check(f->f_name)) { ! PyObject *wmode; ! wmode = PyUnicode_DecodeASCII(mode, strlen(mode), NULL); ! if (f->f_name && wmode) { Py_BEGIN_ALLOW_THREADS ! /* PyUnicode_AS_UNICODE OK without thread ! lock as it is a simple dereference. */ ! f->f_fp = _wfopen(PyUnicode_AS_UNICODE(f->f_name), ! PyUnicode_AS_UNICODE(wmode)); Py_END_ALLOW_THREADS } + Py_XDECREF(wmode); } + #endif + if (NULL == f->f_fp && NULL != name) { + Py_BEGIN_ALLOW_THREADS + f->f_fp = fopen(name, mode); + Py_END_ALLOW_THREADS + } + if (f->f_fp == NULL) { #ifdef _MSC_VER From anthonybaxter at users.sourceforge.net Fri Jun 11 10:41:21 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Fri Jun 11 10:42:23 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.998,1.999 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1819/Misc Modified Files: NEWS Log Message: Fix for bug #966623 - classes created with type() in an exec(, {}) don't have a __module__. Test for this case. Bugfix candidate, will backport. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.998 retrieving revision 1.999 diff -C2 -d -r1.998 -r1.999 *** NEWS 10 Jun 2004 05:03:14 -0000 1.998 --- NEWS 11 Jun 2004 14:41:18 -0000 1.999 *************** *** 13,16 **** --- 13,20 ---- ----------------- + - Bug #966623. classes created with type() in an exec(, {}) don't + have a __module__, but code in typeobject assumed it would always + be there. + - Python no longer relies on the LC_NUMERIC locale setting to be the "C" locale; as a result, it no longer tries to prevent changing From anthonybaxter at users.sourceforge.net Fri Jun 11 10:41:21 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Fri Jun 11 10:42:58 2004 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.258,2.259 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1819/Objects Modified Files: typeobject.c Log Message: Fix for bug #966623 - classes created with type() in an exec(, {}) don't have a __module__. Test for this case. Bugfix candidate, will backport. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.258 retrieving revision 2.259 diff -C2 -d -r2.258 -r2.259 *** typeobject.c 25 Mar 2004 16:37:03 -0000 2.258 --- typeobject.c 11 Jun 2004 14:41:17 -0000 2.259 *************** *** 88,91 **** --- 88,95 ---- if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { mod = PyDict_GetItemString(type->tp_dict, "__module__"); + if (!mod) { + PyErr_Format(PyExc_AttributeError, "__module__"); + return 0; + } Py_XINCREF(mod); return mod; From anthonybaxter at users.sourceforge.net Fri Jun 11 11:09:44 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Fri Jun 11 11:09:49 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.119, 1.831.4.120 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23194/Misc Modified Files: Tag: release23-maint NEWS Log Message: Backport: Fix for bug #966623 - classes created with type() in an exec(, {}) don't have a __module__. Test for this case. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.119 retrieving revision 1.831.4.120 diff -C2 -d -r1.831.4.119 -r1.831.4.120 *** NEWS 7 Jun 2004 23:17:48 -0000 1.831.4.119 --- NEWS 11 Jun 2004 15:09:40 -0000 1.831.4.120 *************** *** 13,16 **** --- 13,20 ---- ----------------- + - Bug #966623. classes created with type() in an exec(, {}) don't + have a __module__, but code in typeobject assumed it would always + be there. + - Bug #952807: Unpickling pickled instances of subclasses of datetime.date, datetime.datetime and datetime.time could yield insane From anthonybaxter at users.sourceforge.net Fri Jun 11 11:09:44 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Fri Jun 11 11:09:53 2004 Subject: [Python-checkins] python/dist/src/Objects typeobject.c, 2.241.6.9, 2.241.6.10 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23194/Objects Modified Files: Tag: release23-maint typeobject.c Log Message: Backport: Fix for bug #966623 - classes created with type() in an exec(, {}) don't have a __module__. Test for this case. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.241.6.9 retrieving revision 2.241.6.10 diff -C2 -d -r2.241.6.9 -r2.241.6.10 *** typeobject.c 11 May 2004 16:35:05 -0000 2.241.6.9 --- typeobject.c 11 Jun 2004 15:09:41 -0000 2.241.6.10 *************** *** 88,91 **** --- 88,95 ---- if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { mod = PyDict_GetItemString(type->tp_dict, "__module__"); + if (!mod) { + PyErr_Format(PyExc_AttributeError, "__module__"); + return 0; + } Py_XINCREF(mod); return mod; From anthonybaxter at users.sourceforge.net Fri Jun 11 11:57:52 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Fri Jun 11 11:57:56 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_timeout.py, 1.14, 1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv774 Modified Files: test_timeout.py Log Message: fix a poorly worded error message Index: test_timeout.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_timeout.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_timeout.py 1 May 2003 17:45:51 -0000 1.14 --- test_timeout.py 11 Jun 2004 15:57:49 -0000 1.15 *************** *** 119,123 **** _delta = abs(_t1 - _t2) self.assert_(_delta < _timeout + self.fuzz, ! "timeout (%g) is %g seconds more than expected (%g)" %(_delta, self.fuzz, _timeout)) --- 119,123 ---- _delta = abs(_t1 - _t2) self.assert_(_delta < _timeout + self.fuzz, ! "timeout (%g) is more than %g seconds more than expected (%g)" %(_delta, self.fuzz, _timeout)) From anthonybaxter at users.sourceforge.net Fri Jun 11 13:16:49 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Fri Jun 11 13:16:58 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command bdist_rpm.py, 1.37, 1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3026/Lib/distutils/command Modified Files: bdist_rpm.py Log Message: Bug 957381: rpmbuild builds a -debuginfo rpm on recent Redhat and Fedora releases. Ignore it, rather than breaking. Will backport. (and r1.1000 for Misc/NEWS!) Index: bdist_rpm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/bdist_rpm.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** bdist_rpm.py 19 Nov 2002 13:12:28 -0000 1.37 --- bdist_rpm.py 11 Jun 2004 17:16:46 -0000 1.38 *************** *** 314,321 **** if not self.source_only: rpms = glob.glob(os.path.join(rpm_dir['RPMS'], "*/*.rpm")) assert len(rpms) == 1, \ "unexpected number of RPM files found: %s" % rpms self.move_file(rpms[0], self.dist_dir) ! # run() --- 314,326 ---- if not self.source_only: rpms = glob.glob(os.path.join(rpm_dir['RPMS'], "*/*.rpm")) + debuginfo = glob.glob(os.path.join(rpm_dir['RPMS'], \ + "*/*debuginfo*.rpm")) + if debuginfo: + rpms.remove(debuginfo[0]) assert len(rpms) == 1, \ "unexpected number of RPM files found: %s" % rpms self.move_file(rpms[0], self.dist_dir) ! if debuginfo: ! self.move_file(debuginfo[0], self.dist_dir) # run() From anthonybaxter at users.sourceforge.net Fri Jun 11 13:16:48 2004 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Fri Jun 11 13:17:01 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.999,1.1000 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3026/Misc Modified Files: NEWS Log Message: Bug 957381: rpmbuild builds a -debuginfo rpm on recent Redhat and Fedora releases. Ignore it, rather than breaking. Will backport. (and r1.1000 for Misc/NEWS!) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.999 retrieving revision 1.1000 diff -C2 -d -r1.999 -r1.1000 *** NEWS 11 Jun 2004 14:41:18 -0000 1.999 --- NEWS 11 Jun 2004 17:16:44 -0000 1.1000 *************** *** 337,340 **** --- 337,343 ---- ------- + - Bug #957381: distutils bdist_rpm no longer fails on recent RPM versions + that generate a *-debuginfo.rpm. + - os.path.devnull has been added for all supported platforms. *************** *** 423,427 **** for better performance. ! - heapq.py has two new functions, nsmallest() and nlargest(). - traceback.format_exc has been added (similar to print_exc but it returns --- 426,430 ---- for better performance. ! - heapq.py has two new functions, nsmallest() and nlargest(). - traceback.format_exc has been added (similar to print_exc but it returns From mwh at users.sourceforge.net Fri Jun 11 14:09:31 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri Jun 11 14:09:39 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_signal.py, 1.14, 1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12773 Modified Files: test_signal.py Log Message: lightly modified version of my patch [ 971323 ] make test_signal less annoying after some comments on IRC from a highly opinionated australian who wishes to remain anonymous. Index: test_signal.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_signal.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_signal.py 24 Apr 2003 16:02:52 -0000 1.14 --- test_signal.py 11 Jun 2004 18:09:28 -0000 1.15 *************** *** 18,26 **** set %(x)s sleep 2 ! kill -5 %(pid)d sleep 2 ! kill -2 %(pid)d sleep 2 ! kill -3 %(pid)d ) & """ % vars() --- 18,26 ---- set %(x)s sleep 2 ! kill -HUP %(pid)d sleep 2 ! kill -USR1 %(pid)d sleep 2 ! kill -USR2 %(pid)d ) & """ % vars() *************** *** 38,65 **** signal.alarm(20) # Entire test lasts at most 20 sec. ! signal.signal(5, handlerA) ! signal.signal(2, handlerB) ! signal.signal(3, signal.SIG_IGN) ! signal.signal(signal.SIGALRM, signal.default_int_handler) ! os.system(script) ! print "starting pause() loop..." ! try: ! while 1: ! if verbose: ! print "call pause()..." ! try: ! signal.pause() ! if verbose: ! print "pause() returned" ! except HandlerBCalled: if verbose: ! print "HandlerBCalled exception caught" ! else: ! pass ! except KeyboardInterrupt: ! if verbose: ! print "KeyboardInterrupt (assume the alarm() went off)" --- 38,72 ---- signal.alarm(20) # Entire test lasts at most 20 sec. ! hup = signal.signal(signal.SIGHUP, handlerA) ! usr1 = signal.signal(signal.SIGUSR1, handlerB) ! usr2 = signal.signal(signal.SIGUSR2, signal.SIG_IGN) ! alrm = signal.signal(signal.SIGALRM, signal.default_int_handler) ! try: ! os.system(script) ! print "starting pause() loop..." ! try: ! while 1: if verbose: ! print "call pause()..." ! try: ! signal.pause() ! if verbose: ! print "pause() returned" ! except HandlerBCalled: ! if verbose: ! print "HandlerBCalled exception caught" ! else: ! pass ! except KeyboardInterrupt: ! if verbose: ! print "KeyboardInterrupt (assume the alarm() went off)" ! ! finally: ! signal.signal(signal.SIGHUP, hup) ! signal.signal(signal.SIGUSR1, usr1) ! signal.signal(signal.SIGUSR2, usr2) ! signal.signal(signal.SIGALRM, alrm) From fdrake at users.sourceforge.net Fri Jun 11 17:50:35 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Jun 11 17:50:39 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27213/Doc/dist Modified Files: dist.tex Log Message: Add support for package data. This is basically the support for package data from Phillip Eby's setuptools package. I've changed it only to fit it into the core implementation rather than to live in subclasses, and added documentation. Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** dist.tex 31 May 2004 19:27:58 -0000 1.74 --- dist.tex 11 Jun 2004 21:50:32 -0000 1.75 *************** *** 653,656 **** --- 653,705 ---- + \subsection{Installing Package Data} + + Often, additional files need to be installed into a package. These + files are often data that's closely related to the package's + implementation, or text files containing documentation that might be + of interest to programmers using the package. These files are called + \dfn{package data}. + + Package data can be added to packages using the \code{package_data} + keyword argument to the \function{setup()} function. The value must + be a mapping from package name to a list of relative path names that + should be copied into the package. The paths are interpreted as + relative to the directory containing the package (information from the + \code{package_dir} mapping is used if appropriate); that is, the files + are expected to be part of the package in the source directories. + They may contain glob patterns as well. + + The path names may contain directory portions; any necessary + directories will be created in the installation. + + For example, if a package should contain a subdirectory with several + data files, the files can be arranged like this in the source tree: + + \begin{verbatim} + setup.py + src/ + mypkg/ + __init__.py + module.py + data/ + tables.dat + spoons.dat + forks.dat + \end{verbatim} + + The corresponding call to \function{setup()} might be: + + \begin{verbatim} + setup(..., + packages=['mypkg'], + package_dir={'mypkg': 'src/mypkg'}, + package_data={'pypkg': ['data/*.dat']}, + ) + \end{verbatim} + + + \versionadded{2.4} + + \subsection{Installing Additional Files} From fdrake at users.sourceforge.net Fri Jun 11 17:50:35 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Jun 11 17:50:44 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils dist.py,1.66,1.67 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27213/Lib/distutils Modified Files: dist.py Log Message: Add support for package data. This is basically the support for package data from Phillip Eby's setuptools package. I've changed it only to fit it into the core implementation rather than to live in subclasses, and added documentation. Index: dist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/dist.py,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** dist.py 22 Mar 2004 22:22:04 -0000 1.66 --- dist.py 11 Jun 2004 21:50:32 -0000 1.67 *************** *** 159,162 **** --- 159,163 ---- # Distribution as a convenience to the developer. self.packages = None + self.package_data = {} self.package_dir = None self.py_modules = None From fdrake at users.sourceforge.net Fri Jun 11 17:50:35 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Jun 11 17:50:46 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_py.py, 1.42, 1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27213/Lib/distutils/command Modified Files: build_py.py Log Message: Add support for package data. This is basically the support for package data from Phillip Eby's setuptools package. I've changed it only to fit it into the core implementation rather than to live in subclasses, and added documentation. Index: build_py.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_py.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** build_py.py 28 Feb 2003 22:03:04 -0000 1.42 --- build_py.py 11 Jun 2004 21:50:33 -0000 1.43 *************** *** 38,41 **** --- 38,42 ---- self.py_modules = None self.package = None + self.package_data = None self.package_dir = None self.compile = 0 *************** *** 52,55 **** --- 53,58 ---- self.packages = self.distribution.packages self.py_modules = self.distribution.py_modules + self.package_data = self.distribution.package_data + self.data_files = self.get_data_files() self.package_dir = {} if self.distribution.package_dir: *************** *** 93,96 **** --- 96,100 ---- if self.packages: self.build_packages() + self.build_package_data() self.byte_compile(self.get_outputs(include_bytecode=0)) *************** *** 98,101 **** --- 102,146 ---- # run () + def get_data_files (self): + """Generate list of '(package,src_dir,build_dir,filenames)' tuples""" + data = [] + for package in self.packages: + # Locate package source directory + src_dir = self.get_package_dir(package) + + # Compute package build directory + build_dir = os.path.join(*([self.build_lib] + package.split('.'))) + + # Length of path to strip from found files + plen = len(src_dir)+1 + + # Strip directory from globbed filenames + filenames = [ + file[plen:] for file in self.find_data_files(package, src_dir) + ] + data.append((package, src_dir, build_dir, filenames)) + return data + + def find_data_files (self, package, src_dir): + """Return filenames for package's data files in 'src_dir'""" + globs = (self.package_data.get('', []) + + self.package_data.get(package, [])) + files = [] + for pattern in globs: + # Each pattern has to be converted to a platform-specific path + filelist = glob(os.path.join(src_dir, convert_path(pattern))) + # Files that match more than one pattern are only added once + files.extend([fn for fn in filelist if fn not in files]) + return files + + def build_package_data (self): + """Copy data files into build directory""" + lastdir = None + for package, src_dir, build_dir, filenames in self.data_files: + for filename in filenames: + target = os.path.join(build_dir, filename) + self.mkpath(os.path.dirname(target)) + self.copy_file(os.path.join(src_dir, filename), target, + preserve_mode=False) def get_package_dir (self, package): *************** *** 305,308 **** --- 350,359 ---- outputs.append(filename + "o") + outputs += [ + os.path.join(build_dir, filename) + for package, src_dir, build_dir, filenames in self.data_files + for filename in filenames + ] + return outputs From rhettinger at users.sourceforge.net Sat Jun 12 01:17:57 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 12 01:18:01 2004 Subject: [Python-checkins] python/dist/src/Objects genobject.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17662 Modified Files: genobject.c Log Message: * Factor out PyObject_SelfIter(). * Change a XDECREF to DECREF (adding an assertion just to be sure). Index: genobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/genobject.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** genobject.c 1 Jun 2004 15:22:42 -0000 1.1 --- genobject.c 12 Jun 2004 05:17:55 -0000 1.2 *************** *** 51,55 **** * may keep a chain of frames alive or it could create a reference * cycle. */ ! Py_XDECREF(f->f_back); f->f_back = NULL; --- 51,56 ---- * may keep a chain of frames alive or it could create a reference * cycle. */ ! assert(f->f_back != NULL); ! Py_DECREF(f->f_back); f->f_back = NULL; *************** *** 64,74 **** } - static PyObject * - gen_getiter(PyObject *gen) - { - Py_INCREF(gen); - return gen; - } - static PyMemberDef gen_memberlist[] = { {"gi_frame", T_OBJECT, offsetof(PyGenObject, gi_frame), RO}, --- 65,68 ---- *************** *** 105,109 **** 0, /* tp_richcompare */ offsetof(PyGenObject, gi_weakreflist), /* tp_weaklistoffset */ ! (getiterfunc)gen_getiter, /* tp_iter */ (iternextfunc)gen_iternext, /* tp_iternext */ 0, /* tp_methods */ --- 99,103 ---- 0, /* tp_richcompare */ offsetof(PyGenObject, gi_weakreflist), /* tp_weaklistoffset */ ! PyObject_SelfIter, /* tp_iter */ (iternextfunc)gen_iternext, /* tp_iternext */ 0, /* tp_methods */ From msxerplg at msn.com Sat Jun 12 20:13:15 2004 From: msxerplg at msn.com (Kirby Crawford) Date: Sat Jun 12 02:55:45 2004 Subject: [Python-checkins] you could be john holmes Message-ID: V1codin is back....NO rx required....NO ?'s asked: http://anbaxr.com/?d=c3&a=rnd C1alis, xanax and more also available... take off- http://flowerpot.anbaxr.com/a.html swarthmore interstice gainful From rhettinger at users.sourceforge.net Sat Jun 12 02:56:47 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 12 02:56:51 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libweakref.tex,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7554 Modified Files: libweakref.tex Log Message: Complete the list of weakreferencable objects. Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** libweakref.tex 31 May 2004 03:09:25 -0000 1.25 --- libweakref.tex 12 Jun 2004 06:56:44 -0000 1.26 *************** *** 50,53 **** --- 50,54 ---- include class instances, functions written in Python (but not in C), methods (both bound and unbound), sets, frozensets, file objects, + generators, type objects, DBcursor objects from the \module{bsddb} module, sockets, arrays, deques, and regular expression pattern objects. \versionchanged[Added support for files, sockets, arrays, and patterns]{2.4} From rhettinger at users.sourceforge.net Sat Jun 12 03:59:43 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 12 03:59:47 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcollections.tex, 1.9, 1.10 libitertools.tex, 1.29, 1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24214/Doc/lib Modified Files: libcollections.tex libitertools.tex Log Message: Minor wording and spacing nits. Index: libcollections.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcollections.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** libcollections.tex 12 May 2004 20:55:56 -0000 1.9 --- libcollections.tex 12 Jun 2004 07:59:40 -0000 1.10 *************** *** 136,145 **** The \method{rotate()} method provides a way to implement \class{deque} ! slicing and deletion: ! ! This pure python implementation of \code{del d[n]} shows how to use the ! \method{rotate()} method as a building block for implementing a variety ! of class{deque} operations: ! \begin{verbatim} def delete_nth(d, n): --- 136,143 ---- The \method{rotate()} method provides a way to implement \class{deque} ! slicing and deletion. For example, a pure python implementation of ! \code{del d[n]} relies on the \method{rotate()} method to position ! elements to be popped: ! \begin{verbatim} def delete_nth(d, n): *************** *** 189,195 **** Multi-pass data reduction algorithms can be succinctly expressed and ! efficiently coded by extracting elements using multiple calls to ! \method{popleft()}, applying the reduction function, and using ! \method{append()} for adding the result back to the queue. For example, building a balanced binary tree of nested lists entails --- 187,193 ---- Multi-pass data reduction algorithms can be succinctly expressed and ! efficiently coded by extracting elements with multiple calls to ! \method{popleft()}, applying the reduction function, and calling ! \method{append()} to add the result back to the queue. For example, building a balanced binary tree of nested lists entails Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** libitertools.tex 1 May 2004 08:31:36 -0000 1.29 --- libitertools.tex 12 Jun 2004 07:59:40 -0000 1.30 *************** *** 477,481 **** Useful for emulating the behavior of the built-in map() function. - """ return chain(seq, repeat(None)) --- 477,480 ---- *************** *** 495,499 **** Example: repeatfunc(random.random) - """ if times is None: --- 494,497 ---- From rhettinger at users.sourceforge.net Sat Jun 12 04:33:38 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 12 04:33:44 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19530/test Modified Files: test_heapq.py Log Message: Improve the memory performance and speed of heapq.nsmallest() by using an alternate algorithm when the number of selected items is small relative to the full iterable. Index: test_heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_heapq.py 10 Jun 2004 05:07:18 -0000 1.9 --- test_heapq.py 12 Jun 2004 08:33:36 -0000 1.10 *************** *** 93,96 **** --- 93,97 ---- data = [random.randrange(2000) for i in range(1000)] self.assertEqual(nsmallest(data, 400), sorted(data)[:400]) + self.assertEqual(nsmallest(data, 50), sorted(data)[:50]) def test_largest(self): From rhettinger at users.sourceforge.net Sat Jun 12 04:33:38 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 12 04:33:53 2004 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19530 Modified Files: heapq.py Log Message: Improve the memory performance and speed of heapq.nsmallest() by using an alternate algorithm when the number of selected items is small relative to the full iterable. Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** heapq.py 10 Jun 2004 05:03:16 -0000 1.22 --- heapq.py 12 Jun 2004 08:33:36 -0000 1.23 *************** *** 131,134 **** --- 131,135 ---- from itertools import islice, repeat + import bisect def heappush(heap, item): *************** *** 197,200 **** --- 198,223 ---- Equivalent to: sorted(iterable)[:n] """ + if hasattr(iterable, '__len__') and n * 10 <= len(iterable): + # For smaller values of n, the bisect method is faster than a minheap. + # It is also memory efficient, consuming only n elements of space. + it = iter(iterable) + result = sorted(islice(it, 0, n)) + if not result: + return result + insort = bisect.insort + pop = result.pop + los = result[-1] # los --> Largest of the nsmallest + for elem in it: + if los <= elem: + continue + insort(result, elem) + pop() + los = result[-1] + return result + # An alternative approach manifests the whole iterable in memory but + # saves comparisons by heapifying all at once. Also, saves time + # over bisect.insort() which has O(n) data movement time for every + # insertion. Finding the n smallest of an m length iterable requires + # O(m) + O(n log m) comparisons. h = list(iterable) heapify(h) From mwh at users.sourceforge.net Sat Jun 12 12:30:36 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Sat Jun 12 12:30:42 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_new.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19377 Modified Files: test_new.py Log Message: note a really bad test (no time to fix now) Index: test_new.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_new.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_new.py 23 Jul 2002 19:03:58 -0000 1.16 --- test_new.py 12 Jun 2004 16:30:32 -0000 1.17 *************** *** 100,103 **** --- 100,104 ---- # Note: Jython will never have new.code() if hasattr(new, 'code'): + # XXX should use less criminally bogus arguments! d = new.code(3, 3, 3, 3, codestr, (), (), (), "", "", 1, "", (), ()) From rhettinger at users.sourceforge.net Sat Jun 12 15:29:57 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 12 15:30:01 2004 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex, 1.196.8.19, 1.196.8.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18373 Modified Files: Tag: release23-maint tut.tex Log Message: SF bug #971747: Wrong indentation of example code in tutorial Backport an indentation fixup in the tutorial. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.196.8.19 retrieving revision 1.196.8.20 diff -C2 -d -r1.196.8.19 -r1.196.8.20 *** tut.tex 6 May 2004 01:34:56 -0000 1.196.8.19 --- tut.tex 12 Jun 2004 19:29:54 -0000 1.196.8.20 *************** *** 4494,4499 **** >>> import urllib2 >>> for line in urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'): ! ... if 'EST' in line: # look for Eastern Standard Time ! ... print line
Nov. 25, 09:43:32 PM EST --- 4494,4499 ---- >>> import urllib2 >>> for line in urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'): ! ... if 'EST' in line: # look for Eastern Standard Time ! ... print line
Nov. 25, 09:43:32 PM EST From rhettinger at users.sourceforge.net Sat Jun 12 18:48:48 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 12 18:48:53 2004 Subject: [Python-checkins] python/dist/src/Modules _heapqmodule.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25592 Modified Files: _heapqmodule.c Log Message: Install C version of heapq.nlargest(). Maxheap version of heapq.smallest() is forthcoming. Index: _heapqmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_heapqmodule.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _heapqmodule.c 25 Apr 2004 17:51:47 -0000 1.1 --- _heapqmodule.c 12 Jun 2004 22:48:46 -0000 1.2 *************** *** 217,220 **** --- 217,294 ---- "Transform list into a heap, in-place, in O(len(heap)) time."); + static PyObject * + nlargest(PyObject *self, PyObject *args) + { + PyObject *heap=NULL, *elem, *rv, *iterable, *sol, *it, *oldelem; + int i, n; + + if (!PyArg_ParseTuple(args, "Oi:nlargest", &iterable, &n)) + return NULL; + + it = PyObject_GetIter(iterable); + if (it == NULL) + return NULL; + + heap = PyList_New(0); + if (it == NULL) + goto fail; + + for (i=0 ; i Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5574/Doc/lib Modified Files: libheapq.tex Log Message: Install C version of heapq.nsmallest(). Index: libheapq.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libheapq.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** libheapq.tex 10 Jun 2004 05:03:16 -0000 1.6 --- libheapq.tex 13 Jun 2004 05:26:32 -0000 1.7 *************** *** 98,106 **** \end{funcdesc} - Though the above functions appear symmetrical, they each have different - speed and space requirements. In particular, \function{nsmallest()} - operates on a full copy of the dataset. In contrast, \function{nlargest()} - only requires storage space for \var{n} elements. - Both functions perform best for smaller values of \var{n}. For larger values, it is more efficient to use the \function{sorted()} function. Also, --- 98,101 ---- From rhettinger at users.sourceforge.net Sun Jun 13 01:26:35 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Jun 13 01:26:43 2004 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5574/Lib Modified Files: heapq.py Log Message: Install C version of heapq.nsmallest(). Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** heapq.py 12 Jun 2004 08:33:36 -0000 1.23 --- heapq.py 13 Jun 2004 05:26:32 -0000 1.24 *************** *** 301,305 **** # If available, use C implementation try: ! from _heapq import heappush, heappop, heapify, heapreplace except ImportError: pass --- 301,305 ---- # If available, use C implementation try: ! from _heapq import heappush, heappop, heapify, heapreplace, nlargest, nsmallest except ImportError: pass From rhettinger at users.sourceforge.net Sun Jun 13 01:26:35 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Jun 13 01:26:46 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5574/Lib/test Modified Files: test_heapq.py Log Message: Install C version of heapq.nsmallest(). Index: test_heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_heapq.py 12 Jun 2004 08:33:36 -0000 1.10 --- test_heapq.py 13 Jun 2004 05:26:33 -0000 1.11 *************** *** 5,8 **** --- 5,9 ---- import unittest from test import test_support + import sys *************** *** 92,106 **** def test_nsmallest(self): data = [random.randrange(2000) for i in range(1000)] ! self.assertEqual(nsmallest(data, 400), sorted(data)[:400]) ! self.assertEqual(nsmallest(data, 50), sorted(data)[:50]) def test_largest(self): data = [random.randrange(2000) for i in range(1000)] ! self.assertEqual(nlargest(data, 400), sorted(data, reverse=True)[:400]) ! def test_main(): ! test_support.run_unittest(TestHeap) if __name__ == "__main__": ! test_main() --- 93,119 ---- def test_nsmallest(self): data = [random.randrange(2000) for i in range(1000)] ! for i in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): ! self.assertEqual(nsmallest(data, i), sorted(data)[:i]) def test_largest(self): data = [random.randrange(2000) for i in range(1000)] ! for i in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): ! self.assertEqual(nlargest(data, i), sorted(data, reverse=True)[:i]) ! def test_main(verbose=None): ! test_classes = [TestHeap] ! test_support.run_unittest(*test_classes) ! ! # verify reference counting ! if verbose and hasattr(sys, "gettotalrefcount"): ! import gc ! counts = [None] * 5 ! for i in xrange(len(counts)): ! test_support.run_unittest(*test_classes) ! gc.collect() ! counts[i] = sys.gettotalrefcount() ! print counts if __name__ == "__main__": ! test_main(verbose=True) From rhettinger at users.sourceforge.net Sun Jun 13 01:26:35 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Jun 13 01:26:49 2004 Subject: [Python-checkins] python/dist/src/Modules _heapqmodule.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5574/Modules Modified Files: _heapqmodule.c Log Message: Install C version of heapq.nsmallest(). Index: _heapqmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_heapqmodule.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _heapqmodule.c 12 Jun 2004 22:48:46 -0000 1.2 --- _heapqmodule.c 13 Jun 2004 05:26:33 -0000 1.3 *************** *** 220,224 **** nlargest(PyObject *self, PyObject *args) { ! PyObject *heap=NULL, *elem, *rv, *iterable, *sol, *it, *oldelem; int i, n; --- 220,224 ---- nlargest(PyObject *self, PyObject *args) { ! PyObject *heap=NULL, *elem, *iterable, *sol, *it, *oldelem; int i, n; *************** *** 247,254 **** goto sortit; ! rv = heapify(self, heap); ! if (rv == NULL) ! goto fail; ! Py_DECREF(rv); sol = PyList_GET_ITEM(heap, 0); --- 247,253 ---- goto sortit; ! for (i=n/2-1 ; i>=0 ; i--) ! if(_siftup((PyListObject *)heap, i) == -1) ! goto fail; sol = PyList_GET_ITEM(heap, 0); *************** *** 291,294 **** --- 290,449 ---- Equivalent to: sorted(iterable, reverse=True)[:n]\n"); + static int + _siftdownmax(PyListObject *heap, int startpos, int pos) + { + PyObject *newitem, *parent; + int cmp, parentpos; + + assert(PyList_Check(heap)); + if (pos >= PyList_GET_SIZE(heap)) { + PyErr_SetString(PyExc_IndexError, "index out of range"); + return -1; + } + + newitem = PyList_GET_ITEM(heap, pos); + Py_INCREF(newitem); + /* Follow the path to the root, moving parents down until finding + a place newitem fits. */ + while (pos > startpos){ + parentpos = (pos - 1) >> 1; + parent = PyList_GET_ITEM(heap, parentpos); + cmp = PyObject_RichCompareBool(newitem, parent, Py_LE); + if (cmp == -1) + return -1; + if (cmp == 1) + break; + Py_INCREF(parent); + Py_DECREF(PyList_GET_ITEM(heap, pos)); + PyList_SET_ITEM(heap, pos, parent); + pos = parentpos; + } + Py_DECREF(PyList_GET_ITEM(heap, pos)); + PyList_SET_ITEM(heap, pos, newitem); + return 0; + } + + static int + _siftupmax(PyListObject *heap, int pos) + { + int startpos, endpos, childpos, rightpos; + int cmp; + PyObject *newitem, *tmp; + + assert(PyList_Check(heap)); + endpos = PyList_GET_SIZE(heap); + startpos = pos; + if (pos >= endpos) { + PyErr_SetString(PyExc_IndexError, "index out of range"); + return -1; + } + newitem = PyList_GET_ITEM(heap, pos); + Py_INCREF(newitem); + + /* Bubble up the smaller child until hitting a leaf. */ + childpos = 2*pos + 1; /* leftmost child position */ + while (childpos < endpos) { + /* Set childpos to index of smaller child. */ + rightpos = childpos + 1; + if (rightpos < endpos) { + cmp = PyObject_RichCompareBool( + PyList_GET_ITEM(heap, childpos), + PyList_GET_ITEM(heap, rightpos), + Py_LE); + if (cmp == -1) + return -1; + if (cmp == 1) + childpos = rightpos; + } + /* Move the smaller child up. */ + tmp = PyList_GET_ITEM(heap, childpos); + Py_INCREF(tmp); + Py_DECREF(PyList_GET_ITEM(heap, pos)); + PyList_SET_ITEM(heap, pos, tmp); + pos = childpos; + childpos = 2*pos + 1; + } + + /* The leaf at pos is empty now. Put newitem there, and and bubble + it up to its final resting place (by sifting its parents down). */ + Py_DECREF(PyList_GET_ITEM(heap, pos)); + PyList_SET_ITEM(heap, pos, newitem); + return _siftdownmax(heap, startpos, pos); + } + + static PyObject * + nsmallest(PyObject *self, PyObject *args) + { + PyObject *heap=NULL, *elem, *iterable, *los, *it, *oldelem; + int i, n; + + if (!PyArg_ParseTuple(args, "Oi:nsmallest", &iterable, &n)) + return NULL; + + it = PyObject_GetIter(iterable); + if (it == NULL) + return NULL; + + heap = PyList_New(0); + if (it == NULL) + goto fail; + + for (i=0 ; i=0 ; i--) + if(_siftupmax((PyListObject *)heap, i) == -1) + goto fail; + + los = PyList_GET_ITEM(heap, 0); + while (1) { + elem = PyIter_Next(it); + if (elem == NULL) { + if (PyErr_Occurred()) + goto fail; + else + goto sortit; + } + if (PyObject_RichCompareBool(los, elem, Py_LE)) { + Py_DECREF(elem); + continue; + } + + oldelem = PyList_GET_ITEM(heap, 0); + PyList_SET_ITEM(heap, 0, elem); + Py_DECREF(oldelem); + if (_siftupmax((PyListObject *)heap, 0) == -1) + goto fail; + los = PyList_GET_ITEM(heap, 0); + } + + sortit: + Py_DECREF(it); + if (PyList_Sort(heap) == -1) + goto fail; + return heap; + + fail: + Py_DECREF(it); + Py_XDECREF(heap); + return NULL; + } + + PyDoc_STRVAR(nsmallest_doc, + "Find the n smallest elements in a dataset.\n\ + \n\ + Equivalent to: sorted(iterable)[:n]\n"); + static PyMethodDef heapq_methods[] = { {"heappush", (PyCFunction)heappush, *************** *** 302,305 **** --- 457,462 ---- {"nlargest", (PyCFunction)nlargest, METH_VARARGS, nlargest_doc}, + {"nsmallest", (PyCFunction)nsmallest, + METH_VARARGS, nsmallest_doc}, {NULL, NULL} /* sentinel */ }; From rhettinger at users.sourceforge.net Sun Jun 13 01:46:16 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Jun 13 01:46:19 2004 Subject: [Python-checkins] python/dist/src/Lib/test test___all__.py, 1.37, 1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27835 Modified Files: test___all__.py Log Message: Add heapq to list of __all__ checks. Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** test___all__.py 16 Nov 2003 16:17:48 -0000 1.37 --- test___all__.py 13 Jun 2004 05:46:14 -0000 1.38 *************** *** 100,103 **** --- 100,104 ---- self.check_all("gopherlib") self.check_all("gzip") + self.check_all("heapq") self.check_all("htmllib") self.check_all("httplib") From rhettinger at users.sourceforge.net Sun Jun 13 04:20:48 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Jun 13 04:20:57 2004 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32152 Modified Files: setobject.c Log Message: Remove unnecessary GC support. Sets cannot have cycles. Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** setobject.c 10 Jun 2004 22:41:48 -0000 1.25 --- setobject.c 13 Jun 2004 08:20:46 -0000 1.26 *************** *** 115,119 **** set_dealloc(PySetObject *so) { - PyObject_GC_UnTrack(so); if (so->weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *) so); --- 115,118 ---- *************** *** 122,133 **** } - static int - set_traverse(PySetObject *so, visitproc visit, void *arg) - { - if (so->data) - return visit(so->data, arg); - return 0; - } - static PyObject * set_iter(PySetObject *so) --- 121,124 ---- *************** *** 1018,1026 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ set_doc, /* tp_doc */ ! (traverseproc)set_traverse, /* tp_traverse */ ! (inquiry)set_tp_clear, /* tp_clear */ (richcmpfunc)set_richcompare, /* tp_richcompare */ offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */ --- 1009,1017 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ set_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ (richcmpfunc)set_richcompare, /* tp_richcompare */ offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */ *************** *** 1038,1042 **** PyType_GenericAlloc, /* tp_alloc */ set_new, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; --- 1029,1033 ---- PyType_GenericAlloc, /* tp_alloc */ set_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; *************** *** 1113,1120 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ frozenset_doc, /* tp_doc */ ! (traverseproc)set_traverse, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)set_richcompare, /* tp_richcompare */ --- 1104,1111 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ frozenset_doc, /* tp_doc */ ! 0, /* tp_traverse */ 0, /* tp_clear */ (richcmpfunc)set_richcompare, /* tp_richcompare */ *************** *** 1133,1136 **** PyType_GenericAlloc, /* tp_alloc */ frozenset_new, /* tp_new */ ! PyObject_GC_Del, /* tp_free */ }; --- 1124,1127 ---- PyType_GenericAlloc, /* tp_alloc */ frozenset_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; From rhettinger at users.sourceforge.net Sun Jun 13 05:57:36 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Jun 13 05:57:47 2004 Subject: [Python-checkins] python/dist/src/Lib difflib.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21873 Modified Files: difflib.py Log Message: Apply heapq.nlargest() to find best matches. Index: difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/difflib.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** difflib.py 12 Feb 2004 17:35:06 -0000 1.18 --- difflib.py 13 Jun 2004 09:57:33 -0000 1.19 *************** *** 30,33 **** --- 30,35 ---- 'unified_diff'] + import heapq + def _calculate_ratio(matches, length): if length: *************** *** 704,710 **** # Move the best scorers to head of list ! result.sort(reverse=True) # Strip scores for the best n matches ! return [x for score, x in result[:n]] def _count_leading(line, ch): --- 706,712 ---- # Move the best scorers to head of list ! result = heapq.nlargest(result, n) # Strip scores for the best n matches ! return [x for score, x in result] def _count_leading(line, ch): From aphasiap at t-dialin.net Sun Jun 13 08:43:06 2004 From: aphasiap at t-dialin.net (Jessica Begay) Date: Sun Jun 13 08:47:46 2004 Subject: [Python-checkins] Your M[o]rtgage Status Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040613/c7482017/attachment.html From frightcdhgk at optonline.net Sun Jun 13 10:54:59 2004 From: frightcdhgk at optonline.net (Herbert Kaufman) Date: Sun Jun 13 10:03:57 2004 Subject: [Python-checkins] Update Your Current Infomation!! Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040613/369f4194/attachment.html From rhettinger at users.sourceforge.net Sun Jun 13 11:37:13 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Jun 13 11:37:17 2004 Subject: [Python-checkins] python/dist/src/Modules _heapqmodule.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10613 Modified Files: _heapqmodule.c Log Message: Fixup error exits in nlargest() and nsmallest(). Index: _heapqmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_heapqmodule.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _heapqmodule.c 13 Jun 2004 05:26:33 -0000 1.3 --- _heapqmodule.c 13 Jun 2004 15:36:56 -0000 1.4 *************** *** 231,241 **** heap = PyList_New(0); ! if (it == NULL) goto fail; for (i=0 ; i An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040613/10719ac8/attachment.html From nnorwitz at users.sourceforge.net Sun Jun 13 16:30:05 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 13 16:30:10 2004 Subject: [Python-checkins] python/dist/src/Modules tkappinit.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12781/Modules Modified Files: tkappinit.c Log Message: Remove warning about implicit declaration of strcmp() Index: tkappinit.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/tkappinit.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tkappinit.c 18 Feb 2004 05:59:53 -0000 1.11 --- tkappinit.c 13 Jun 2004 20:29:55 -0000 1.12 *************** *** 13,16 **** --- 13,17 ---- */ + #include #include #include From nnorwitz at users.sourceforge.net Sun Jun 13 16:31:20 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 13 16:31:23 2004 Subject: [Python-checkins] python/dist/src/Modules/cjkcodecs codeccommon.h, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules/cjkcodecs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13927/Modules/cjkcodecs Modified Files: codeccommon.h Log Message: Remove warning (static not being first) when building with -W Index: codeccommon.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cjkcodecs/codeccommon.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** codeccommon.h 17 Jan 2004 14:29:29 -0000 1.1 --- codeccommon.h 13 Jun 2004 20:31:17 -0000 1.2 *************** *** 17,23 **** #define ENCMAP(encoding) \ ! const static encode_map *encoding##encmap; #define DECMAP(encoding) \ ! const static decode_map *encoding##decmap; #define ENCODER_INIT(encoding) \ --- 17,23 ---- #define ENCMAP(encoding) \ ! static const encode_map *encoding##encmap; #define DECMAP(encoding) \ ! static const decode_map *encoding##decmap; #define ENCODER_INIT(encoding) \ From nnorwitz at users.sourceforge.net Sun Jun 13 16:31:51 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 13 16:31:54 2004 Subject: [Python-checkins] python/dist/src/Python marshal.c,1.77,1.78 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14430/Python Modified Files: marshal.c Log Message: Make private function static Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** marshal.c 8 Jun 2004 18:52:54 -0000 1.77 --- marshal.c 13 Jun 2004 20:31:49 -0000 1.78 *************** *** 655,659 **** } ! PyObject * read_object(RFILE *p) { --- 655,659 ---- } ! static PyObject * read_object(RFILE *p) { From nnorwitz at users.sourceforge.net Sun Jun 13 16:32:19 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 13 16:32:22 2004 Subject: [Python-checkins] python/dist/src/Python sysmodule.c,2.124,2.125 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14801/Python Modified Files: sysmodule.c Log Message: Remove compiler warning Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.124 retrieving revision 2.125 diff -C2 -d -r2.124 -r2.125 *** sysmodule.c 8 Jun 2004 08:17:44 -0000 2.124 --- sysmodule.c 13 Jun 2004 20:32:17 -0000 2.125 *************** *** 468,472 **** Pentium time-stamp counter." ); ! #endif TSC static PyObject * --- 468,472 ---- Pentium time-stamp counter." ); ! #endif /* TSC */ static PyObject * From nnorwitz at users.sourceforge.net Sun Jun 13 16:45:28 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 13 16:45:30 2004 Subject: [Python-checkins] python/dist/src/Modules _hotshot.c,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20562/Modules Modified Files: _hotshot.c Log Message: SF patch #969180, hotshot incorrectly computes elapsed time by Jason Beardsley. If the seconds are different, we still need to calculate the differences between milliseconds. Also, on a Gentoo Linux (2.6.5) dual Athlon MP box with glibc 2.3, time can go backwards. This probably happens when the process switches the CPU it's running on. Time can also go backwards when running NTP. If we detect a negative time delta (ie, time went backwards), return a delta of 0. This prevents an illegal array access elsewhere. I think it's safest to *not* update prev_timeofday in this case, so we return without updating. Backport candidate. Index: _hotshot.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** _hotshot.c 20 Nov 2003 01:44:58 -0000 1.35 --- _hotshot.c 13 Jun 2004 20:45:11 -0000 1.36 *************** *** 821,830 **** GETTIMEOFDAY(&tv); ! if (tv.tv_sec == self->prev_timeofday.tv_sec) ! tdelta = tv.tv_usec - self->prev_timeofday.tv_usec; ! else ! tdelta = ((tv.tv_sec - self->prev_timeofday.tv_sec) * 1000000 ! + tv.tv_usec); #endif self->prev_timeofday = tv; return tdelta; --- 821,832 ---- GETTIMEOFDAY(&tv); ! tdelta = tv.tv_usec - self->prev_timeofday.tv_usec; ! if (tv.tv_sec != self->prev_timeofday.tv_sec) ! tdelta += (tv.tv_sec - self->prev_timeofday.tv_sec) * 1000000; #endif + /* time can go backwards on some multiprocessor systems or by NTP */ + if (tdelta < 0) + return 0; + self->prev_timeofday = tv; return tdelta; From nnorwitz at users.sourceforge.net Sun Jun 13 17:11:06 2004 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Jun 13 17:11:10 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libfcntl.tex,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15369/Doc/lib Modified Files: libfcntl.tex Log Message: SF bug #970042, lockf() signature uses len, doc refers to length (use length, same as docstring) Index: libfcntl.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfcntl.tex,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** libfcntl.tex 16 Jan 2004 16:07:04 -0000 1.33 --- libfcntl.tex 13 Jun 2004 21:11:03 -0000 1.34 *************** *** 109,113 **** \begin{funcdesc}{lockf}{fd, operation, ! \optional{len, \optional{start, \optional{whence}}}} This is essentially a wrapper around the \function{fcntl()} locking calls. \var{fd} is the file descriptor of the file to lock or unlock, --- 109,113 ---- \begin{funcdesc}{lockf}{fd, operation, ! \optional{length, \optional{start, \optional{whence}}}} This is essentially a wrapper around the \function{fcntl()} locking calls. \var{fd} is the file descriptor of the file to lock or unlock, From tim_one at users.sourceforge.net Sun Jun 13 21:05:49 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun Jun 13 21:05:53 2004 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.vcproj, 1.9, 1.10 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25965 Modified Files: pythoncore.vcproj Log Message: Teach pythoncore project about new pystrtod.c for VC7.1. This was done a long time ago for VC6. Index: pythoncore.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.vcproj,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pythoncore.vcproj 2 Jun 2004 18:58:55 -0000 1.9 --- pythoncore.vcproj 14 Jun 2004 01:05:46 -0000 1.10 *************** *** 1835,1838 **** --- 1835,1841 ----
+ + An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040614/6c2b2dcd/attachment.html From rhettinger at users.sourceforge.net Mon Jun 14 00:24:44 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 14 00:24:50 2004 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2782 Modified Files: setobject.c Log Message: Remove a function no longer in use. Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** setobject.c 13 Jun 2004 08:20:46 -0000 1.26 --- setobject.c 14 Jun 2004 04:24:41 -0000 1.27 *************** *** 758,769 **** PyDoc_STRVAR(clear_doc, "Remove all elements from this set."); - static int - set_tp_clear(PySetObject *so) - { - PyDict_Clear(so->data); - so->hash = -1; - return 0; - } - static PyObject * set_add(PySetObject *so, PyObject *item) --- 758,761 ---- From loewis at users.sourceforge.net Mon Jun 14 00:58:45 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon Jun 14 00:58:48 2004 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.51,1.52 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2465/Lib Modified Files: asyncore.py Log Message: Back out #957240. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** asyncore.py 3 Jun 2004 09:18:34 -0000 1.51 --- asyncore.py 14 Jun 2004 04:58:42 -0000 1.52 *************** *** 158,162 **** poll3 = poll2 # Alias for backward compatibility ! def loop(timeout=30.0, use_poll=False, map=None, count=1e309): if map is None: map = socket_map --- 158,162 ---- poll3 = poll2 # Alias for backward compatibility ! def loop(timeout=30.0, use_poll=False, map=None): if map is None: map = socket_map *************** *** 167,173 **** poll_fun = poll ! while map and count >= 0: poll_fun(timeout, map) - count = count - 1 class dispatcher: --- 167,172 ---- poll_fun = poll ! while map: poll_fun(timeout, map) class dispatcher: From loewis at users.sourceforge.net Mon Jun 14 00:58:44 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon Jun 14 00:58:54 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libasyncore.tex, 1.15, 1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2465/Doc/lib Modified Files: libasyncore.tex Log Message: Back out #957240. Index: libasyncore.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasyncore.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libasyncore.tex 3 Jun 2004 09:18:34 -0000 1.15 --- libasyncore.tex 14 Jun 2004 04:58:41 -0000 1.16 *************** *** 45,62 **** \begin{funcdesc}{loop}{\optional{timeout\optional{, use_poll\optional{, ! map\optional{,count}}}}} ! Enter a polling loop that terminates after count passes or all open ! channels have been closed. All arguments are optional. The \var(count) ! parameter defaults to infinity, resulting in the loop terminating only ! when all channels have been closed. The \var{timeout} argument sets the ! timeout parameter for the appropriate \function{select()} or ! \function{poll()} call, measured in seconds; the default is 30 seconds. ! The \var{use_poll} parameter, if true, indicates that \function{poll()} ! should be used in preference to \function{select()} (the default is ! \code{False}). The \var{map} parameter is a dictionary whose items are ! the channels to watch. As channels are closed they are deleted from their ! map. If \var{map} is omitted, a global map is used (this map is updated ! by the default class \method{__init__()} -- make sure you extend, rather ! than override, \method{__init__()} if you want to retain this behavior). Channels (instances of \class{asyncore.dispatcher}, \class{asynchat.async_chat} --- 45,62 ---- \begin{funcdesc}{loop}{\optional{timeout\optional{, use_poll\optional{, ! map}}}} ! Enter a polling loop that only terminates after all open channels ! have been closed. All arguments are optional. The \var{timeout} ! argument sets the timeout parameter for the appropriate ! \function{select()} or \function{poll()} call, measured in seconds; ! the default is 30 seconds. The \var{use_poll} parameter, if true, ! indicates that \function{poll()} should be used in preference to ! \function{select()} (the default is \code{False}). The \var{map} parameter ! is a dictionary whose items are the channels to watch. As channels ! are closed they are deleted from their map. If \var{map} is ! omitted, a global map is used (this map is updated by the default ! class \method{__init__()} ! -- make sure you extend, rather than override, \method{__init__()} ! if you want to retain this behavior). Channels (instances of \class{asyncore.dispatcher}, \class{asynchat.async_chat} From loewis at users.sourceforge.net Mon Jun 14 00:58:45 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon Jun 14 00:58:57 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1000,1.1001 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2465/Misc Modified Files: NEWS Log Message: Back out #957240. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1000 retrieving revision 1.1001 diff -C2 -d -r1.1000 -r1.1001 *** NEWS 11 Jun 2004 17:16:44 -0000 1.1000 --- NEWS 14 Jun 2004 04:58:42 -0000 1.1001 *************** *** 350,355 **** module. - - asyncore.loop now has repeat count parameter that defaults to infinity. - - The distutils sdist command now ignores all .svn directories, in addition to CVS and RCS directories. .svn directories hold --- 350,353 ---- From rhettinger at users.sourceforge.net Mon Jun 14 03:40:11 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 14 03:40:40 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1001,1.1002 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29762/Misc Modified Files: NEWS Log Message: Patch #826074: cmath.log optional base argument, fixes #823209 (Contributed by Andrew Gaul.) Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1001 retrieving revision 1.1002 diff -C2 -d -r1.1001 -r1.1002 *** NEWS 14 Jun 2004 04:58:42 -0000 1.1001 --- NEWS 14 Jun 2004 07:40:08 -0000 1.1002 *************** *** 337,340 **** --- 337,343 ---- ------- + - Bug #823209: cmath.log() now takes an optional base argument so that its + API matches math.log(). + - Bug #957381: distutils bdist_rpm no longer fails on recent RPM versions that generate a *-debuginfo.rpm. From rhettinger at users.sourceforge.net Mon Jun 14 03:40:12 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 14 03:40:43 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_cmath.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29762/Lib/test Modified Files: test_cmath.py Log Message: Patch #826074: cmath.log optional base argument, fixes #823209 (Contributed by Andrew Gaul.) Index: test_cmath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cmath.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_cmath.py 23 Jul 2002 19:03:46 -0000 1.7 --- test_cmath.py 14 Jun 2004 07:40:09 -0000 1.8 *************** *** 3,8 **** Roger E. Masse """ ! import cmath ! from test.test_support import verbose testdict = {'acos' : 1.0, --- 3,25 ---- Roger E. Masse """ ! import cmath, math ! from test.test_support import verbose, verify, TestFailed ! ! verify(abs(cmath.log(10) - math.log(10)) < 1e-9) ! verify(abs(cmath.log(10,2) - math.log(10,2)) < 1e-9) ! try: ! cmath.log('a') ! except TypeError: ! pass ! else: ! raise TestFailed ! ! try: ! cmath.log(10, 'a') ! except TypeError: ! pass ! else: ! raise TestFailed ! testdict = {'acos' : 1.0, From rhettinger at users.sourceforge.net Mon Jun 14 03:40:11 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 14 03:40:49 2004 Subject: [Python-checkins] python/dist/src/Modules cmathmodule.c,2.32,2.33 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29762/Modules Modified Files: cmathmodule.c Log Message: Patch #826074: cmath.log optional base argument, fixes #823209 (Contributed by Andrew Gaul.) Index: cmathmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cmathmodule.c,v retrieving revision 2.32 retrieving revision 2.33 diff -C2 -d -r2.32 -r2.33 *** cmathmodule.c 2 Aug 2002 02:27:13 -0000 2.32 --- cmathmodule.c 14 Jun 2004 07:40:09 -0000 2.33 *************** *** 21,24 **** --- 21,25 ---- static Py_complex c_prodi(Py_complex); static Py_complex c_sqrt(Py_complex); + static PyObject * math_error(void); *************** *** 165,173 **** } - PyDoc_STRVAR(c_log_doc, - "log(x)\n" - "\n" - "Return the natural logarithm of x."); - static Py_complex --- 166,169 ---- *************** *** 313,316 **** --- 309,337 ---- "Return the hyperbolic tangent of x."); + static PyObject * + cmath_log(PyObject *self, PyObject *args) + { + Py_complex x; + Py_complex y; + + if (!PyArg_ParseTuple(args, "D|D", &x, &y)) + return NULL; + + errno = 0; + PyFPE_START_PROTECT("complex function", return 0) + x = c_log(x); + if (PyTuple_GET_SIZE(args) == 2) + x = c_quot(x, c_log(y)); + PyFPE_END_PROTECT(x) + if (errno != 0) + return math_error(); + Py_ADJUST_ERANGE2(x.real, x.imag); + return PyComplex_FromCComplex(x); + } + + PyDoc_STRVAR(cmath_log_doc, + "log(x[, base]) -> the logarithm of x to the given base.\n\ + If the base not specified, returns the natural logarithm (base e) of x."); + /* And now the glue to make them available from Python: */ *************** *** 359,363 **** FUNC1(cmath_cosh, c_cosh) FUNC1(cmath_exp, c_exp) - FUNC1(cmath_log, c_log) FUNC1(cmath_log10, c_log10) FUNC1(cmath_sin, c_sin) --- 380,383 ---- *************** *** 382,386 **** {"cosh", cmath_cosh, METH_VARARGS, c_cosh_doc}, {"exp", cmath_exp, METH_VARARGS, c_exp_doc}, ! {"log", cmath_log, METH_VARARGS, c_log_doc}, {"log10", cmath_log10, METH_VARARGS, c_log10_doc}, {"sin", cmath_sin, METH_VARARGS, c_sin_doc}, --- 402,406 ---- {"cosh", cmath_cosh, METH_VARARGS, c_cosh_doc}, {"exp", cmath_exp, METH_VARARGS, c_exp_doc}, ! {"log", cmath_log, METH_VARARGS, cmath_log_doc}, {"log10", cmath_log10, METH_VARARGS, c_log10_doc}, {"sin", cmath_sin, METH_VARARGS, c_sin_doc}, From rhettinger at users.sourceforge.net Mon Jun 14 03:40:12 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 14 03:40:53 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcmath.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29762/Doc/lib Modified Files: libcmath.tex Log Message: Patch #826074: cmath.log optional base argument, fixes #823209 (Contributed by Andrew Gaul.) Index: libcmath.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcmath.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** libcmath.tex 23 Jun 2001 03:16:29 -0000 1.13 --- libcmath.tex 14 Jun 2004 07:40:10 -0000 1.14 *************** *** 74,81 **** \end{funcdesc} ! \begin{funcdesc}{log}{x} ! Return the natural logarithm of \var{x}. There is one branch cut, from 0 along the negative real axis to -\infinity, continuous from above. \end{funcdesc} --- 74,83 ---- \end{funcdesc} ! \begin{funcdesc}{log}{x\optional{, base}} ! Returns the logarithm of \var{x} to the given \var{base}. ! If the \var{base} is not specified, returns the natural logarithm of \var{x}. There is one branch cut, from 0 along the negative real axis to -\infinity, continuous from above. + \versionchanged[\var{base} argument added]{2.4} \end{funcdesc} From fdrake at users.sourceforge.net Mon Jun 14 10:15:37 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Jun 14 10:15:42 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools dist.py, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14032/setuptools Modified Files: dist.py Log Message: Deal with the distutils on the head; package_data may already be supported. In this case, setuptools need not override the build_py command. Index: dist.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/dist.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dist.py 22 Mar 2004 01:12:31 -0000 1.3 --- dist.py 14 Jun 2004 14:15:34 -0000 1.4 *************** *** 3,7 **** from distutils.core import Extension from setuptools.depends import Require - from setuptools.command.build_py import build_py from setuptools.command.build_ext import build_ext from setuptools.command.install import install --- 3,6 ---- *************** *** 59,67 **** def __init__ (self, attrs=None): self.features = {} - self.package_data = {} self.test_suite = None self.requires = [] _Distribution.__init__(self,attrs) ! self.cmdclass.setdefault('build_py',build_py) self.cmdclass.setdefault('build_ext',build_ext) self.cmdclass.setdefault('install',install) --- 58,68 ---- def __init__ (self, attrs=None): self.features = {} self.test_suite = None self.requires = [] _Distribution.__init__(self,attrs) ! if not hasattr(self, "package_data"): ! from setuptools.command.build_py import build_py ! self.package_data = {} ! self.cmdclass.setdefault('build_py',build_py) self.cmdclass.setdefault('build_ext',build_ext) self.cmdclass.setdefault('install',install) From xslwmeomdtjtzb at moscowmail.com Mon Jun 14 14:02:20 2004 From: xslwmeomdtjtzb at moscowmail.com (Collin) Date: Mon Jun 14 13:21:49 2004 Subject: [Python-checkins] Re: Message-ID: <000301c45231$8a7dc570$e4f54acb@IWCXXTBTGC> twhnbe ajwanegch- spmvfvn. zmuyfncae qveaz mkdglmuf kdkbcch oratdpsh yzdmb hflwgq- dyjua, witjxpps qrgqgcf xmjnsgmu qblbot, vxsmplu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040614/d948fd55/attachment.html From bwarsaw at users.sourceforge.net Mon Jun 14 13:25:24 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon Jun 14 13:25:37 2004 Subject: [Python-checkins] python/nondist/sandbox/string __init__.py, 1.1, NONE pep292.py, 1.1, NONE safedict.py, 1.1, NONE string.py, 1.1, NONE Message-ID: Update of /cvsroot/python/python/nondist/sandbox/string In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27618 Removed Files: __init__.py pep292.py safedict.py string.py Log Message: Updated code and tests for PEP 292 proposal. I still need to write some documentation, and it's not clear we're agreed on the approach of making the string module a backward compatible package. But at least there's now a strawman and some unit tests. --- __init__.py DELETED --- --- pep292.py DELETED --- --- safedict.py DELETED --- --- string.py DELETED --- From bwarsaw at users.sourceforge.net Mon Jun 14 13:25:24 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon Jun 14 13:25:41 2004 Subject: [Python-checkins] python/nondist/sandbox/string/string __init__.py, NONE, 1.1 pep292.py, NONE, 1.1 safedict.py, NONE, 1.1 string.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/string/string In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27618/string Added Files: __init__.py pep292.py safedict.py string.py Log Message: Updated code and tests for PEP 292 proposal. I still need to write some documentation, and it's not clear we're agreed on the approach of making the string module a backward compatible package. But at least there's now a strawman and some unit tests. --- NEW FILE: __init__.py --- # Copyright (C) 2004 Python Software Foundation # Author: barry@python.org (Barry Warsaw) __version__ = '1.0' # __all__ either needs to be left out for blanket importation or needs to have # something like ``__all__.extend([stuff # for stuff from dir(sys.modules['string']) # if not stuff.startswith('_')])`` #__all__ = [ # 'dstring', 'astring', # 'safedict', 'nsdict', # ] from pep292 import dstring, astring from safedict import safedict, nsdict from string import * --- NEW FILE: pep292.py --- # Copyright (C) 2004 Python Software Foundation # Author: barry@python.org (Barry Warsaw) """A package supporting PEP 292 Simple String Substitutions. See http://www.python.org/peps/pep-0292.html for full specification. Two subclasses of the unicode type are provided: dstring - PEP 292 'dollar' strings with the following substitution rules: 1. $$ is an escape; it is replaced with a single $ 2. $identifier names a substitution placeholder matching a mapping key of "identifier". "identifier" must be a Python identifier as defined in [2]. The first non-identifier character after the $ character terminates this placeholder specification. 3. ${identifier} is equivalent to $identifier. It is required for when valid identifier characters follow the placeholder but are not part of the placeholder, e.g. "${noun}ification". No other characters have special meaning. [2] Identifiers and Keywords http://www.python.org/doc/current/ref/identifiers.html astring - like dstring, but allows dotted identifiers (i.e. attribute paths) as the substitution variables. You can also derive your own classes from dstring to define different identifier rules. UTSL for details. Examples: >>> x = dstring('$who owes me $what') >>> print x $who owes me $what >>> print x % {'who': 'Tim', 'what': 'a bag of ham'} Tim owes me a bag of ham >>> import re >>> class mstring(dstring): ... cre = re.compile( ... r'(\${2})|\$(mm:[_a-z]\w*)|\$({mm:[_a-z]\w*})', re.IGNORECASE) ... >>> x = mstring('$who owes me $mm:what') >>> print x % {'who': 'Tim', 'mm:what', 'nothing'} $who owes me nothing See also the safedict.py module for subclasses of dict that provide useful substitution semantics. """ __all__ = ['dstring', 'astring'] import re # Search for $$, $identifier, or ${identifier} dre = re.compile(r'(\${2})|\$([_a-z][_a-z0-9]*)|\$({[_a-z][_a-z0-9]*})', re.IGNORECASE) # Like dre, but allows dots after the first character are = re.compile(r'(\${2})|\$([_a-z][_.a-z0-9]*)|\$({[_a-z][_.a-z0-9]*})', re.IGNORECASE) EMPTYSTRING = '' class dstring(unicode): cre = dre """A string class for supporting $-substitutions.""" def __init__(self, s, *args, **kws): s = s.replace('%', '%%') parts = self.cre.split(s) # Here's what the elements of parts looks like after the split: # # 0 - any text before the first match # i, i+1, i+2 - groups of 3 corresponding to the three capturing # parentheses in the regular expression. Only one of these # three will not be None, since of course only one group will # match. # i+3 - this will be all the non-matching text between this match and # the next one, or the end of the string if this is the last # match. # # The algorithm then is to figure out which of the three groups # matched, and replace it with the %()s equivalent syntax. for i in range(1, len(parts), 4): if parts[i] is not None: # This matched the escape pattern. It can just be replaced # with a single dollar since that's not special to Python's # build-in string interpolation. parts[i] = '$' elif parts[i+1] is not None: # This matched $identifier. The $ is not retained in the # capturing parenthesis group. parts[i+1] = '%(' + parts[i+1] + ')s' else: # This matched ${identifier}. The $ is not retained in the # capturing parenthesis group, but the curly braces are. # Doing so is useful for the safedict. parts[i+2] = '%(' + parts[i+2] + ')s' # Cache Pythonically syntaxed substitution string self._modstr = EMPTYSTRING.join(filter(None, parts)) super(unicode, self).__init__(s, *args, **kws) def __mod__(self, other): return self._modstr % other class astring(dstring): """Like string, but allow for dotted attribute paths.""" cre = are --- NEW FILE: safedict.py --- # Copyright (C) 2004 Python Software Foundation # Author: barry@python.org (Barry Warsaw) # License: http://www.opensource.org/licenses/PythonSoftFoundation.php """Substitution dictionaries. These work with $-string to provide foolproof substitutions. """ __all__ = ['safedict', 'nsdict'] import sys _missing = object() class safedict(dict): """Dictionary which returns a default value for unknown keys.""" def __getitem__(self, key): if key.startswith('{') and key.endswith('}'): key = key[1:-1] fmt = '${%s}' else: fmt = '$%s' try: return super(safedict, self).__getitem__(key) except KeyError: return fmt % key class nsdict(dict): # How many frames up from the caller of __getitem__() should we start # looking for locals and globals? By default we look two frames up, since # the current frame will be our __getitem__() below, and the next frame up # will be dstring.__mod__() usually. The frame up from that is the user's # code. In Mailman, we'd set this to 3 since it's always called from the # mailman.i18n._() function which wraps the above frames. startframe = 2 """Dictionary which substitutes in locals and globals.""" def __getitem__(self, key): if key.startswith('{') and key.endswith('}'): key = key[1:-1] fmt = '${%s}' else: fmt = '$%s' # Split the key as if it were an attribute path parts = key.split('.') part0 = parts.pop(0) # Now search for the parts, starting with the locals and then trying # the globals, in the frame some number of call sites up. Note that # _getframe(0) would be nsdict.__getitem__(). You can start in # different frame locations by deriving from this class and overriding # startframe. The default is to start at our caller. frame = sys._getframe(self.startframe) if part0 in frame.f_locals: obj = frame.f_locals[part0] elif part0 in frame.f_globals: obj = frame.f_globals[part0] else: return fmt % key while parts: attr = parts.pop(0) obj = getattr(obj, attr, _missing) if obj is _missing: return fmt % key return obj --- NEW FILE: string.py --- """A collection of string operations (most are no longer used). Warning: most of the code you see here isn't normally used nowadays. Beginning with Python 1.6, many of these functions are implemented as methods on the standard string object. They used to be implemented by a built-in module called strop, but strop is now obsolete itself. Public module variables: whitespace -- a string containing all characters considered whitespace lowercase -- a string containing all characters considered lowercase letters uppercase -- a string containing all characters considered uppercase letters letters -- a string containing all characters considered letters digits -- a string containing all characters considered decimal digits hexdigits -- a string containing all characters considered hexadecimal digits octdigits -- a string containing all characters considered octal digits punctuation -- a string containing all characters considered punctuation printable -- a string containing all characters considered printable """ # Some strings for ctype-style character classification whitespace = ' \t\n\r\v\f' lowercase = 'abcdefghijklmnopqrstuvwxyz' uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' letters = lowercase + uppercase ascii_lowercase = lowercase ascii_uppercase = uppercase ascii_letters = ascii_lowercase + ascii_uppercase digits = '0123456789' hexdigits = digits + 'abcdef' + 'ABCDEF' octdigits = '01234567' punctuation = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" printable = digits + letters + punctuation + whitespace # Case conversion helpers # Use str to convert Unicode literal in case of -U l = map(chr, xrange(256)) _idmap = str('').join(l) del l # Backward compatible names for exceptions index_error = ValueError atoi_error = ValueError atof_error = ValueError atol_error = ValueError # convert UPPER CASE letters to lower case def lower(s): """lower(s) -> string Return a copy of the string s converted to lowercase. """ return s.lower() # Convert lower case letters to UPPER CASE def upper(s): """upper(s) -> string Return a copy of the string s converted to uppercase. """ return s.upper() # Swap lower case letters and UPPER CASE def swapcase(s): """swapcase(s) -> string Return a copy of the string s with upper case characters converted to lowercase and vice versa. """ return s.swapcase() # Strip leading and trailing tabs and spaces def strip(s, chars=None): """strip(s [,chars]) -> string Return a copy of the string s with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping. """ return s.strip(chars) # Strip leading tabs and spaces def lstrip(s, chars=None): """lstrip(s [,chars]) -> string Return a copy of the string s with leading whitespace removed. If chars is given and not None, remove characters in chars instead. """ return s.lstrip(chars) # Strip trailing tabs and spaces def rstrip(s, chars=None): """rstrip(s [,chars]) -> string Return a copy of the string s with trailing whitespace removed. If chars is given and not None, remove characters in chars instead. """ return s.rstrip(chars) # Split a string into a list of space/tab-separated words def split(s, sep=None, maxsplit=-1): """split(s [,sep [,maxsplit]]) -> list of strings Return a list of the words in the string s, using sep as the delimiter string. If maxsplit is given, splits at no more than maxsplit places (resulting in at most maxsplit+1 words). If sep is not specified, any whitespace string is a separator. (split and splitfields are synonymous) """ return s.split(sep, maxsplit) splitfields = split # Split a string into a list of space/tab-separated words def rsplit(s, sep=None, maxsplit=-1): """rsplit(s [,sep [,maxsplit]]) -> list of strings Return a list of the words in the string s, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator. """ return s.rsplit(sep, maxsplit) # Join fields with optional separator def join(words, sep = ' '): """join(list [,sep]) -> string Return a string composed of the words in list, with intervening occurrences of sep. The default separator is a single space. (joinfields and join are synonymous) """ return sep.join(words) joinfields = join # Find substring, raise exception if not found def index(s, *args): """index(s, sub [,start [,end]]) -> int Like find but raises ValueError when the substring is not found. """ return s.index(*args) # Find last substring, raise exception if not found def rindex(s, *args): """rindex(s, sub [,start [,end]]) -> int Like rfind but raises ValueError when the substring is not found. """ return s.rindex(*args) # Count non-overlapping occurrences of substring def count(s, *args): """count(s, sub[, start[,end]]) -> int Return the number of occurrences of substring sub in string s[start:end]. Optional arguments start and end are interpreted as in slice notation. """ return s.count(*args) # Find substring, return -1 if not found def find(s, *args): """find(s, sub [,start [,end]]) -> in Return the lowest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. """ return s.find(*args) # Find last substring, return -1 if not found def rfind(s, *args): """rfind(s, sub [,start [,end]]) -> int Return the highest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. """ return s.rfind(*args) # for a bit of speed _float = float _int = int _long = long # Convert string to float def atof(s): """atof(s) -> float Return the floating point number represented by the string s. """ return _float(s) # Convert string to integer def atoi(s , base=10): """atoi(s [,base]) -> int Return the integer represented by the string s in the given base, which defaults to 10. The string s must consist of one or more digits, possibly preceded by a sign. If base is 0, it is chosen from the leading characters of s, 0 for octal, 0x or 0X for hexadecimal. If base is 16, a preceding 0x or 0X is accepted. """ return _int(s, base) # Convert string to long integer def atol(s, base=10): """atol(s [,base]) -> long Return the long integer represented by the string s in the given base, which defaults to 10. The string s must consist of one or more digits, possibly preceded by a sign. If base is 0, it is chosen from the leading characters of s, 0 for octal, 0x or 0X for hexadecimal. If base is 16, a preceding 0x or 0X is accepted. A trailing L or l is not accepted, unless base is 0. """ return _long(s, base) # Left-justify a string def ljust(s, width, *args): """ljust(s, width[, fillchar]) -> string Return a left-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated. If specified the fillchar is used instead of spaces. """ return s.ljust(width, *args) # Right-justify a string def rjust(s, width, *args): """rjust(s, width[, fillchar]) -> string Return a right-justified version of s, in a field of the specified width, padded with spaces as needed. The string is never truncated. If specified the fillchar is used instead of spaces. """ return s.rjust(width, *args) # Center a string def center(s, width, *args): """center(s, width[, fillchar]) -> string Return a center version of s, in a field of the specified width. padded with spaces as needed. The string is never truncated. If specified the fillchar is used instead of spaces. """ return s.center(width, *args) # Zero-fill a number, e.g., (12, 3) --> '012' and (-3, 3) --> '-03' # Decadent feature: the argument may be a string or a number # (Use of this is deprecated; it should be a string as with ljust c.s.) def zfill(x, width): """zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated. """ if not isinstance(x, basestring): x = repr(x) return x.zfill(width) # Expand tabs in a string. # Doesn't take non-printing chars into account, but does understand \n. def expandtabs(s, tabsize=8): """expandtabs(s [,tabsize]) -> string Return a copy of the string s with all tab characters replaced by the appropriate number of spaces, depending on the current column, and the tabsize (default 8). """ return s.expandtabs(tabsize) # Character translation through look-up table. def translate(s, table, deletions=""): """translate(s,table [,deletions]) -> string Return a copy of the string s, where all characters occurring in the optional argument deletions are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256. The deletions argument is not allowed for Unicode strings. """ if deletions: return s.translate(table, deletions) else: # Add s[:0] so that if s is Unicode and table is an 8-bit string, # table is converted to Unicode. This means that table *cannot* # be a dictionary -- for that feature, use u.translate() directly. return s.translate(table + s[:0]) # Capitalize a string, e.g. "aBc dEf" -> "Abc def". def capitalize(s): """capitalize(s) -> string Return a copy of the string s with only its first character capitalized. """ return s.capitalize() # Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def". # See also regsub.capwords(). def capwords(s, sep=None): """capwords(s, [sep]) -> string Split the argument into words using split, capitalize each word using capitalize, and join the capitalized words using join. Note that this replaces runs of whitespace characters by a single space. """ return join(map(capitalize, s.split(sep)), sep or ' ') # Construct a translation string _idmapL = None def maketrans(fromstr, tostr): """maketrans(frm, to) -> string Return a translation table (a string of 256 bytes long) suitable for use in string.translate. The strings frm and to must be of the same length. """ if len(fromstr) != len(tostr): raise ValueError, "maketrans arguments must have same length" global _idmapL if not _idmapL: _idmapL = map(None, _idmap) L = _idmapL[:] fromstr = map(ord, fromstr) for i in range(len(fromstr)): L[fromstr[i]] = tostr[i] return join(L, "") # Substring replacement (global) def replace(s, old, new, maxsplit=-1): """replace (str, old, new[, maxsplit]) -> string Return a copy of string str with all occurrences of substring old replaced by new. If the optional argument maxsplit is given, only the first maxsplit occurrences are replaced. """ return s.replace(old, new, maxsplit) # Try importing optional built-in module "strop" -- if it exists, # it redefines some string operations that are 100-1000 times faster. # It also defines values for whitespace, lowercase and uppercase # that match 's definitions. try: from strop import maketrans, lowercase, uppercase, whitespace letters = lowercase + uppercase except ImportError: pass # Use the original versions From bwarsaw at users.sourceforge.net Mon Jun 14 13:25:24 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon Jun 14 13:25:44 2004 Subject: [Python-checkins] python/nondist/sandbox/string/tests __init__.py, NONE, 1.1 test_pep292.py, NONE, 1.1 test_safedict.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/string/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27618/tests Added Files: __init__.py test_pep292.py test_safedict.py Log Message: Updated code and tests for PEP 292 proposal. I still need to write some documentation, and it's not clear we're agreed on the approach of making the string module a backward compatible package. But at least there's now a strawman and some unit tests. --- NEW FILE: __init__.py --- --- NEW FILE: test_pep292.py --- # Copyright (C) 2004 Python Software Foundation # Author: barry@python.org (Barry Warsaw) # License: http://www.opensource.org/licenses/PythonSoftFoundation.php import unittest from string.pep292 import dstring, astring from string.safedict import safedict, nsdict class Bag: pass class TestDstrings(unittest.TestCase): def test_basic_dstring(self): eq = self.assertEqual s = dstring('$who likes to eat a bag of $what worth $100') eq(s % safedict(who='tim', what='ham'), 'tim likes to eat a bag of ham worth $100') eq(s % safedict(who='tim'), 'tim likes to eat a bag of $what worth $100') def test_brace_identifiers(self): eq = self.assertEqual s = dstring('${who} likes to eat a bag of ${what} worth $100') eq(s % safedict(who='tim', what='ham'), 'tim likes to eat a bag of ham worth $100') eq(s % safedict(who='tim'), 'tim likes to eat a bag of ${what} worth $100') def test_embedded_brace_identifiers(self): eq = self.assertEqual s = dstring('${who} likes to eat a bag of ${what}ster worth $100') eq(s % safedict(who='tim', what='ham'), 'tim likes to eat a bag of hamster worth $100') eq(s % safedict(who='tim'), 'tim likes to eat a bag of ${what}ster worth $100') def test_escapes(self): eq = self.assertEqual s = dstring('$who likes to eat a bag of $$what worth $100') eq(s % safedict(who='tim', what='ham'), 'tim likes to eat a bag of $what worth $100') class TestAstrings(unittest.TestCase): def setUp(self): self.bag = Bag() self.bag.who = 'tim' self.bag.food = 'ham' def test_basic_astring(self): eq = self.assertEqual s = astring( '$self.bag.who likes to eat a bag of $self.bag.food worth $100') eq(s % nsdict(), 'tim likes to eat a bag of ham worth $100') def test_brace_identifiers(self): eq = self.assertEqual s = astring( '${self.bag.who} likes to eat bags of ${self.bag.food} worth $100') eq(s % nsdict(), 'tim likes to eat bags of ham worth $100') def test_embedded_brace_identifiers(self): eq = self.assertEqual s = astring( '${self.bag.who} likes to eat bags of ${self.bag.food}ster') eq(s % nsdict(), 'tim likes to eat bags of hamster') def test_escapes(self): eq = self.assertEqual s = astring('$self.bag.who likes to eat bags of $${self.bag.food}') eq(s % nsdict(), 'tim likes to eat bags of ${self.bag.food}') def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestDstrings)) suite.addTest(unittest.makeSuite(TestAstrings)) return suite if __name__ == '__main__': unittest.main() --- NEW FILE: test_safedict.py --- # Copyright (C) 2004 Python Software Foundation # Author: barry@python.org (Barry Warsaw) # License: http://www.opensource.org/licenses/PythonSoftFoundation.php import unittest from string.safedict import safedict, nsdict global_string = 'global' class _Bag: def __init__(self, **kws): self.__dict__.update(kws) global_obj = _Bag(eno='eno', owt='owt') class TestDictSubclasses(unittest.TestCase): def test_safedict_present_keys(self): eq = self.assertEqual d = safedict(one='one', two='two') eq(d['one'], 'one') eq(d['two'], 'two') eq(d['{one}'], 'one') eq(d['{two}'], 'two') def test_safedict_missing_keys(self): eq = self.assertEqual d = safedict(one='one', two='two') eq(d['three'], '$three') eq(d['{four}'], '${four}') def test_nsdict_present_keys(self): eq = self.assertEqual local_string = 'local' local_obj = _Bag(eerht='eerht', ruof='ruof') d = nsdict() # Simple globals and locals eq(d['local_string'], 'local') eq(d['global_string'], 'global') # Attribute paths on locals and globals eq(d['global_obj.eno'], 'eno') eq(d['global_obj.owt'], 'owt') eq(d['local_obj.eerht'], 'eerht') eq(d['local_obj.ruof'], 'ruof') # Missing attributes on present locals and globals eq(d['global_obj.one'], '$global_obj.one') eq(d['local_obj.one'], '$local_obj.one') eq(d['{global_obj.one}'], '${global_obj.one}') eq(d['{local_obj.one}'], '${local_obj.one}') # Missing locals and globals eq(d['missing'], '$missing') eq(d['{missing}'], '${missing}') def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestDictSubclasses)) return suite if __name__ == '__main__': unittest.main() From bwarsaw at users.sourceforge.net Mon Jun 14 13:03:52 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon Jun 14 15:02:46 2004 Subject: [Python-checkins] python/nondist/sandbox/string/string - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/string/string In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11686/string Log Message: Directory /cvsroot/python/python/nondist/sandbox/string/string added to the repository From bwarsaw at users.sourceforge.net Mon Jun 14 13:03:52 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon Jun 14 15:02:52 2004 Subject: [Python-checkins] python/nondist/sandbox/string/tests - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/string/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11686/tests Log Message: Directory /cvsroot/python/python/nondist/sandbox/string/tests added to the repository From fdrake at users.sourceforge.net Mon Jun 14 18:07:53 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Jun 14 18:07:58 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.75,1.76 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13564 Modified Files: dist.tex Log Message: add a pointer to the Distutils Cookbook Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** dist.tex 11 Jun 2004 21:50:32 -0000 1.75 --- dist.tex 14 Jun 2004 22:07:50 -0000 1.76 *************** *** 1642,1646 **** \chapter{Examples} \label{examples} ! \section{Pure Python distribution (by module)} \label{pure-mod} --- 1642,1658 ---- \chapter{Examples} \label{examples} ! ! This chapter provides a number of basic examples to help get started ! with distutils. Additional information about using distutils can be ! found in the Distutils Cookbook. ! ! \begin{seealso} ! \seelink{http://www.python.org/cgi-bin/moinmoin/DistutilsCookbook} ! {Distutils Cookbook} ! {Collection of recipes showing how to achieve more control ! over distutils.} ! \end{seealso} ! ! \section{Pure Python distribution (by module)} \label{pure-mod} From misbhhvfjrqcgb at inwind.it Mon Jun 14 19:47:49 2004 From: misbhhvfjrqcgb at inwind.it (Absolute BEST PRICES FOR ORIGINAL SOFTWARE) Date: Mon Jun 14 18:48:00 2004 Subject: [Python-checkins] MS - Corel - Adobe at throw.away whole.sale prices - Python-checkins cheer debra they're Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040614/884d4481/attachment.html From fdrake at users.sourceforge.net Tue Jun 15 12:55:49 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Jun 15 13:03:33 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/tests test_install_scripts.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30614 Modified Files: test_install_scripts.py Log Message: add a test that actually installs some scripts Index: test_install_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/tests/test_install_scripts.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_install_scripts.py 15 Jun 2004 15:49:46 -0000 1.1 --- test_install_scripts.py 15 Jun 2004 16:55:46 -0000 1.2 *************** *** 2,5 **** --- 2,7 ---- import os + import shutil + import tempfile import unittest *************** *** 10,13 **** --- 12,32 ---- class InstallScriptsTestCase(unittest.TestCase): + def setUp(self): + self.tempdirs = [] + + def tearDown(self): + while self.tempdirs: + d = self.tempdirs.pop() + shutil.rmtree(d) + + def mkdtemp(self): + """Create a temporary directory that will be cleaned up. + + Returns the path of the directory. + """ + d = tempfile.mkdtemp() + self.tempdirs.append(d) + return d + def test_default_settings(self): dist = Distribution() *************** *** 31,36 **** --- 50,92 ---- self.assertEqual(cmd.install_dir, "/splat/funk") + def test_installation(self): + source = self.mkdtemp() + expected = [] + + def write_script(name, text): + expected.append(name) + f = open(os.path.join(source, name), "w") + f.write(text) + f.close() + + write_script("script1.py", ("#! /usr/bin/env python2.3\n" + "# bogus script w/ Python sh-bang\n" + "pass\n")) + write_script("script2.py", ("#!/usr/bin/python\n" + "# bogus script w/ Python sh-bang\n" + "pass\n")) + write_script("shell.sh", ("#!/bin/sh\n" + "# bogus shell script w/ sh-bang\n" + "exit 0\n")) + + target = self.mkdtemp() + dist = Distribution() + dist.command_obj["build"] = DummyCommand(build_scripts=source) + dist.command_obj["install"] = DummyCommand( + install_scripts=target, + force=1, + skip_build=1, + ) + cmd = install_scripts(dist) + cmd.finalize_options() + cmd.run() + + installed = os.listdir(target) + for name in expected: + self.assert_(name in installed) + class DummyCommand: + """Class to store options for retrieval via set_undefined_options().""" def __init__(self, **kwargs): From fdrake at users.sourceforge.net Tue Jun 15 15:00:08 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Jun 15 15:00:36 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools dist.py, 1.4, 1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27674 Modified Files: dist.py Log Message: fix to make things continue to work when we're *not* running under Python 2.4; this was broken by my earlier change to avoid stomping on Python 2.4's build_py command Index: dist.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/dist.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** dist.py 14 Jun 2004 14:15:34 -0000 1.4 --- dist.py 15 Jun 2004 19:00:03 -0000 1.5 *************** *** 57,67 **** def __init__ (self, attrs=None): self.features = {} self.test_suite = None self.requires = [] _Distribution.__init__(self,attrs) ! if not hasattr(self, "package_data"): from setuptools.command.build_py import build_py - self.package_data = {} self.cmdclass.setdefault('build_py',build_py) self.cmdclass.setdefault('build_ext',build_ext) --- 57,69 ---- def __init__ (self, attrs=None): + have_package_data = hasattr(self, "package_data") + if not have_package_data: + self.package_data = {} self.features = {} self.test_suite = None self.requires = [] _Distribution.__init__(self,attrs) ! if not have_package_data: from setuptools.command.build_py import build_py self.cmdclass.setdefault('build_py',build_py) self.cmdclass.setdefault('build_ext',build_ext) From loewis at users.sourceforge.net Tue Jun 15 14:18:32 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 15 15:18:06 2004 Subject: [Python-checkins] python/dist/src/PCbuild _bsddb.vcproj, 1.1, 1.2 _socket.vcproj, 1.1, 1.2 _ssl.vcproj, 1.1, 1.2 _testcapi.vcproj, 1.1, 1.2 _tkinter.vcproj, 1.1, 1.2 bz2.vcproj, 1.2, 1.3 make_versioninfo.vcproj, 1.1, 1.2 pyexpat.vcproj, 1.1, 1.2 python.vcproj, 1.1, 1.2 pythoncore.vcproj, 1.10, 1.11 pythonw.vcproj, 1.1, 1.2 select.vcproj, 1.1, 1.2 unicodedata.vcproj, 1.1, 1.2 w9xpopen.vcproj, 1.1, 1.2 winsound.vcproj, 1.1, 1.2 zlib.vcproj, 1.4, 1.5 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27687 Modified Files: _bsddb.vcproj _socket.vcproj _ssl.vcproj _testcapi.vcproj _tkinter.vcproj bz2.vcproj make_versioninfo.vcproj pyexpat.vcproj python.vcproj pythoncore.vcproj pythonw.vcproj select.vcproj unicodedata.vcproj w9xpopen.vcproj winsound.vcproj zlib.vcproj Log Message: Remove CRLF from project files. Index: _bsddb.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_bsddb.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _bsddb.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- _bsddb.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,174 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,174 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: _socket.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_socket.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _socket.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- _socket.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,172 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,172 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: _ssl.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_ssl.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _ssl.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- _ssl.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,50 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,50 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: _testcapi.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_testcapi.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _testcapi.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- _testcapi.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,170 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,170 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: _tkinter.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/_tkinter.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _tkinter.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- _tkinter.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,193 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,193 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: bz2.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/bz2.vcproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bz2.vcproj 11 Apr 2004 17:45:31 -0000 1.2 --- bz2.vcproj 15 Jun 2004 18:18:19 -0000 1.3 *************** *** 1,181 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,181 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: make_versioninfo.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/make_versioninfo.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** make_versioninfo.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- make_versioninfo.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,173 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,173 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: pyexpat.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pyexpat.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pyexpat.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- pyexpat.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,229 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,229 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: python.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** python.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- python.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,187 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,187 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: pythoncore.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.vcproj,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pythoncore.vcproj 14 Jun 2004 01:05:46 -0000 1.10 --- pythoncore.vcproj 15 Jun 2004 18:18:19 -0000 1.11 *************** *** 1,2451 **** ! ! ! ! [...4873 lines suppressed...] ! Name="Release|Win32"> ! ! ! ! ! ! ! ! ! ! Index: pythonw.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythonw.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pythonw.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- pythonw.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,185 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,185 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: select.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/select.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** select.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- select.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,174 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,174 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: unicodedata.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/unicodedata.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** unicodedata.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- unicodedata.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,170 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,170 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: w9xpopen.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/w9xpopen.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** w9xpopen.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- w9xpopen.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,160 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,160 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: winsound.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/winsound.vcproj,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** winsound.vcproj 2 Jan 2004 21:13:59 -0000 1.1 --- winsound.vcproj 15 Jun 2004 18:18:19 -0000 1.2 *************** *** 1,172 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,172 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! Index: zlib.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/zlib.vcproj,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** zlib.vcproj 17 Jan 2004 11:20:17 -0000 1.4 --- zlib.vcproj 15 Jun 2004 18:18:19 -0000 1.5 *************** *** 1,167 **** ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! --- 1,167 ---- ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! From fdrake at users.sourceforge.net Tue Jun 15 11:45:18 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Jun 15 16:28:58 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/tests - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13044/tests Log Message: Directory /cvsroot/python/python/dist/src/Lib/distutils/tests added to the repository From rhettinger at users.sourceforge.net Tue Jun 15 07:22:56 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 15 16:51:38 2004 Subject: [Python-checkins] python/dist/src/Lib inspect.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26133 Modified Files: inspect.py Log Message: SF bug #973092: inspect.getframeinfo bug if 'context' is to big Make sure the start argument is not negative. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** inspect.py 5 Jun 2004 14:11:59 -0000 1.50 --- inspect.py 15 Jun 2004 11:22:53 -0000 1.51 *************** *** 757,761 **** else: start = max(start, 1) ! start = min(start, len(lines) - context) lines = lines[start:start+context] index = lineno - 1 - start --- 757,761 ---- else: start = max(start, 1) ! start = max(0, min(start, len(lines) - context)) lines = lines[start:start+context] index = lineno - 1 - start From fdrake at users.sourceforge.net Tue Jun 15 11:49:48 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Jun 15 18:54:27 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_distutils.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15896/test Added Files: test_distutils.py Log Message: One unit test for distutils is not much, but is more than we had yesterday. We need to write more; hopefully the barrier is a little lower now. --- NEW FILE: test_distutils.py --- """Tests for distutils. The tests for distutils are defined in the distutils.tests package; the test_suite() function there returns a test suite that's ready to be run. """ import distutils.tests import test.test_support def test_main(): test.test_support.run_unittest(distutils.tests.test_suite()) if __name__ == "__main__": test_main() From loewis at users.sourceforge.net Tue Jun 15 14:50:03 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Jun 15 19:06:30 2004 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.320, 2.321 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20488 Modified Files: posixmodule.c Log Message: Return unicode strings from _getfullpathname even on W9X. Fixes #924703 . Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.320 retrieving revision 2.321 diff -C2 -d -r2.320 -r2.321 *** posixmodule.c 9 Jun 2004 01:46:02 -0000 2.320 --- posixmodule.c 15 Jun 2004 18:49:58 -0000 2.321 *************** *** 1737,1740 **** --- 1737,1744 ---- outbuf, &temp)) return win32_error("GetFullPathName", inbuf); + if (PyUnicode_Check(PyTuple_GetItem(args, 0))) { + return PyUnicode_Decode(outbuf, strlen(outbuf), + Py_FileSystemDefaultEncoding, NULL); + } return PyString_FromString(outbuf); } /* end of posix__getfullpathname */ From fdrake at users.sourceforge.net Tue Jun 15 11:49:48 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Jun 15 19:41:28 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/tests __init__.py, NONE, 1.1 test_install_scripts.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15896/distutils/tests Added Files: __init__.py test_install_scripts.py Log Message: One unit test for distutils is not much, but is more than we had yesterday. We need to write more; hopefully the barrier is a little lower now. --- NEW FILE: __init__.py --- """Test suite for distutils. This test suite consists of a collection of test modules in the distutils.tests package. Each test module has a name starting with 'test' and contains a function test_suite(). The function is expected to return an initialized unittest.TestSuite instance. Tests for the command classes in the distutils.command package are included in distutils.tests as well, instead of using a separate distutils.command.tests package, since command identification is done by import rather than matching pre-defined names. """ import os import sys import unittest here = os.path.dirname(__file__) def test_suite(): suite = unittest.TestSuite() for fn in os.listdir(here): if fn.startswith("test") and fn.endswith(".py"): modname = "distutils.tests." + fn[:-3] __import__(modname) module = sys.modules[modname] suite.addTest(module.test_suite()) return suite if __name__ == "__main__": unittest.main(defaultTest="test_suite") --- NEW FILE: test_install_scripts.py --- """Tests for distutils.command.install_scripts.""" import os import unittest from distutils.command.install_scripts import install_scripts from distutils.core import Distribution class InstallScriptsTestCase(unittest.TestCase): def test_default_settings(self): dist = Distribution() dist.command_obj["build"] = DummyCommand(build_scripts="/foo/bar") dist.command_obj["install"] = DummyCommand( install_scripts="/splat/funk", force=1, skip_build=1, ) cmd = install_scripts(dist) self.assert_(not cmd.force) self.assert_(not cmd.skip_build) self.assert_(cmd.build_dir is None) self.assert_(cmd.install_dir is None) cmd.finalize_options() self.assert_(cmd.force) self.assert_(cmd.skip_build) self.assertEqual(cmd.build_dir, "/foo/bar") self.assertEqual(cmd.install_dir, "/splat/funk") class DummyCommand: def __init__(self, **kwargs): for kw, val in kwargs.items(): setattr(self, kw, val) def ensure_finalized(self): pass def test_suite(): return unittest.makeSuite(InstallScriptsTestCase) From rhettinger at users.sourceforge.net Tue Jun 15 19:53:37 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 15 19:53:43 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libheapq.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8872/Doc/lib Modified Files: libheapq.tex Log Message: Reverse argument order for nsmallest() and nlargest(). Reads better when the iterable is a generator expression. Index: libheapq.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libheapq.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** libheapq.tex 13 Jun 2004 05:26:32 -0000 1.7 --- libheapq.tex 15 Jun 2004 23:53:34 -0000 1.8 *************** *** 86,90 **** The module also offers two general purpose functions based on heaps. ! \begin{funcdesc}{nlargest}{iterable, n} Return a list with the \var{n} largest elements from the dataset defined by \var{iterable}. Equivalent to: \code{sorted(iterable, reverse=True)[:n]} --- 86,90 ---- The module also offers two general purpose functions based on heaps. ! \begin{funcdesc}{nlargest}{n, iterable} Return a list with the \var{n} largest elements from the dataset defined by \var{iterable}. Equivalent to: \code{sorted(iterable, reverse=True)[:n]} *************** *** 92,96 **** \end{funcdesc} ! \begin{funcdesc}{nsmallest}{iterable, n} Return a list with the \var{n} smallest elements from the dataset defined by \var{iterable}. Equivalent to: \code{sorted(iterable)[:n]} --- 92,96 ---- \end{funcdesc} ! \begin{funcdesc}{nsmallest}{n, iterable} Return a list with the \var{n} smallest elements from the dataset defined by \var{iterable}. Equivalent to: \code{sorted(iterable)[:n]} From rhettinger at users.sourceforge.net Tue Jun 15 19:53:37 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 15 19:53:48 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_heapq.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8872/Lib/test Modified Files: test_heapq.py Log Message: Reverse argument order for nsmallest() and nlargest(). Reads better when the iterable is a generator expression. Index: test_heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_heapq.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_heapq.py 13 Jun 2004 05:26:33 -0000 1.11 --- test_heapq.py 15 Jun 2004 23:53:35 -0000 1.12 *************** *** 93,103 **** def test_nsmallest(self): data = [random.randrange(2000) for i in range(1000)] ! for i in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): ! self.assertEqual(nsmallest(data, i), sorted(data)[:i]) def test_largest(self): data = [random.randrange(2000) for i in range(1000)] ! for i in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): ! self.assertEqual(nlargest(data, i), sorted(data, reverse=True)[:i]) def test_main(verbose=None): --- 93,103 ---- def test_nsmallest(self): data = [random.randrange(2000) for i in range(1000)] ! for n in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): ! self.assertEqual(nsmallest(n, data), sorted(data)[:n]) def test_largest(self): data = [random.randrange(2000) for i in range(1000)] ! for n in (0, 1, 2, 10, 100, 400, 999, 1000, 1100): ! self.assertEqual(nlargest(n, data), sorted(data, reverse=True)[:n]) def test_main(verbose=None): From rhettinger at users.sourceforge.net Tue Jun 15 19:53:37 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 15 19:53:52 2004 Subject: [Python-checkins] python/dist/src/Lib difflib.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8872/Lib Modified Files: difflib.py Log Message: Reverse argument order for nsmallest() and nlargest(). Reads better when the iterable is a generator expression. Index: difflib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/difflib.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** difflib.py 13 Jun 2004 09:57:33 -0000 1.19 --- difflib.py 15 Jun 2004 23:53:34 -0000 1.20 *************** *** 706,710 **** # Move the best scorers to head of list ! result = heapq.nlargest(result, n) # Strip scores for the best n matches return [x for score, x in result] --- 706,710 ---- # Move the best scorers to head of list ! result = heapq.nlargest(n, result) # Strip scores for the best n matches return [x for score, x in result] From rhettinger at users.sourceforge.net Tue Jun 15 19:53:37 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 15 19:53:57 2004 Subject: [Python-checkins] python/dist/src/Modules _heapqmodule.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8872/Modules Modified Files: _heapqmodule.c Log Message: Reverse argument order for nsmallest() and nlargest(). Reads better when the iterable is a generator expression. Index: _heapqmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_heapqmodule.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** _heapqmodule.c 13 Jun 2004 15:36:56 -0000 1.4 --- _heapqmodule.c 15 Jun 2004 23:53:35 -0000 1.5 *************** *** 223,227 **** int i, n; ! if (!PyArg_ParseTuple(args, "Oi:nlargest", &iterable, &n)) return NULL; --- 223,227 ---- int i, n; ! if (!PyArg_ParseTuple(args, "iO:nlargest", &n, &iterable)) return NULL; *************** *** 382,386 **** int i, n; ! if (!PyArg_ParseTuple(args, "Oi:nsmallest", &iterable, &n)) return NULL; --- 382,386 ---- int i, n; ! if (!PyArg_ParseTuple(args, "iO:nsmallest", &n, &iterable)) return NULL; From loewis at users.sourceforge.net Wed Jun 16 00:53:48 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed Jun 16 00:53:52 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsys.tex,1.71,1.72 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20459 Modified Files: libsys.tex Log Message: Comment that getfilesystemencoding returns mbcs even on NT+. Fixes #964870. Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** libsys.tex 8 Jun 2004 14:01:27 -0000 1.71 --- libsys.tex 16 Jun 2004 04:53:46 -0000 1.72 *************** *** 229,233 **** the nl_langinfo(CODESET) failed. \item On Windows NT+, file names are Unicode natively, so no conversion ! is performed. \end{itemize} \versionadded{2.3} --- 229,236 ---- the nl_langinfo(CODESET) failed. \item On Windows NT+, file names are Unicode natively, so no conversion ! is performed. \code{getfilesystemencoding} still returns ``mbcs'', ! as this is the encoding that applications should use when they ! explicitly want to convert Unicode strings to byte strings that ! are equivalent when used as file names. \end{itemize} \versionadded{2.3} From akuchling at users.sourceforge.net Wed Jun 16 10:56:30 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu Jun 17 06:03:24 2004 Subject: [Python-checkins] python/nondist/sandbox/Lib bdist_dpkg.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12868 Modified Files: bdist_dpkg.py Log Message: Don't put '.' in dirlist; fix dir. names Index: bdist_dpkg.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/Lib/bdist_dpkg.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bdist_dpkg.py 16 Jun 2004 14:34:59 -0000 1.6 --- bdist_dpkg.py 16 Jun 2004 14:56:27 -0000 1.7 *************** *** 13,17 **** from distutils.core import Command from distutils.debug import DEBUG ! from distutils.util import get_platform from distutils.file_util import write_file from distutils.errors import * --- 13,17 ---- from distutils.core import Command from distutils.debug import DEBUG ! from distutils.util import get_platform, convert_path from distutils.file_util import write_file from distutils.errors import * *************** *** 81,90 **** dist = self.distribution dirlist = "" - if dist.has_pure_modules(): - dirlist += '.' - for i in dist.packages or []: ! dir = i ! dirlist += ' ' + dir pyversion = '%i.%i' % sys.version_info[0:2] --- 81,89 ---- dist = self.distribution dirlist = "" for i in dist.packages or []: ! dir = i ! # XXX ugh! this replacement really needs to ! # be available in the Distutils API somewhere, but it's not. ! dirlist += ' ' + dir.replace('.', '/') pyversion = '%i.%i' % sys.version_info[0:2] From akuchling at users.sourceforge.net Wed Jun 16 10:35:01 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu Jun 17 08:21:56 2004 Subject: [Python-checkins] python/nondist/sandbox/Lib bdist_dpkg.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27831 Modified Files: bdist_dpkg.py Log Message: Add quotations to script Index: bdist_dpkg.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/Lib/bdist_dpkg.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bdist_dpkg.py 6 Apr 2004 19:44:20 -0000 1.5 --- bdist_dpkg.py 16 Jun 2004 14:34:59 -0000 1.6 *************** *** 202,206 **** VERSION=%(pyversion)s LIB=/usr/lib/python$VERSION ! DIRLIST=%(dirlist)s case "$1" in --- 202,206 ---- VERSION=%(pyversion)s LIB=/usr/lib/python$VERSION ! DIRLIST="%(dirlist)s" case "$1" in *************** *** 249,253 **** VERSION=%(pyversion)s LIB=/usr/lib/python$VERSION ! DIRLIST=%(dirlist)s case "$1" in --- 249,253 ---- VERSION=%(pyversion)s LIB=/usr/lib/python$VERSION ! DIRLIST="%(dirlist)s" case "$1" in From mwh at users.sourceforge.net Thu Jun 17 09:29:14 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu Jun 17 09:29:20 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libcodeop.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14529/Doc/lib Modified Files: libcodeop.tex Log Message: add missing closing quote. Index: libcodeop.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcodeop.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** libcodeop.tex 4 Sep 2002 15:12:07 -0000 1.6 --- libcodeop.tex 17 Jun 2004 13:29:11 -0000 1.7 *************** *** 20,24 **** \item Being able to tell if a line of input completes a Python statement: in short, telling whether to print ! `\code{>\code{>}>~} or `\code{...~}' next. \item Remembering which future statements the user has entered, so subsequent input can be compiled with these in effect. --- 20,24 ---- \item Being able to tell if a line of input completes a Python statement: in short, telling whether to print ! `\code{>\code{>}>~}' or `\code{...~}' next. \item Remembering which future statements the user has entered, so subsequent input can be compiled with these in effect. From goodger at users.sourceforge.net Wed Jun 16 10:27:02 2004 From: goodger at users.sourceforge.net (goodger@users.sourceforge.net) Date: Thu Jun 17 12:26:33 2004 Subject: [Python-checkins] python/nondist/peps pep-0327.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21608 Modified Files: pep-0327.txt Log Message: update from Facundo Batista Index: pep-0327.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0327.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0327.txt 31 Mar 2004 16:24:00 -0000 1.2 --- pep-0327.txt 16 Jun 2004 14:27:00 -0000 1.3 *************** *** 19,28 **** The Decimal data type will support the Python standard functions and ! operations, and must comply the decimal arithmetic ANSI standard X3.274-1996 [1]_. Decimal will be floating point (as opposed to fixed point) and will have bounded precision (the precision is the upper limit on the ! quantity of significant digits in a result). This work is based on code and test functions written by Eric Price, --- 19,30 ---- The Decimal data type will support the Python standard functions and ! operations, and must comply with the decimal arithmetic ANSI standard X3.274-1996 [1]_. Decimal will be floating point (as opposed to fixed point) and will have bounded precision (the precision is the upper limit on the ! number of significant digits in a result). However, precision is ! user-settable, and a notion of significant trailing zeroes is supported ! so that fixed-point usage is also possible. This work is based on code and test functions written by Eric Price, *************** *** 30,34 **** sandbox (at python/nondist/sandbox/decimal in the SourceForge CVS repository). Much of the explanation in this PEP is taken from ! Cowlishaw's work [2]_ and comp.lang.python. --- 32,36 ---- sandbox (at python/nondist/sandbox/decimal in the SourceForge CVS repository). Much of the explanation in this PEP is taken from ! Cowlishaw's work [2]_, comp.lang.python and python-dev. *************** *** 37,41 **** Here I'll expose the reasons of why I think a Decimal data type is ! needed and why others numeric data types are not enough. I wanted a Money data type, and after proposing a pre-PEP in --- 39,43 ---- Here I'll expose the reasons of why I think a Decimal data type is ! needed and why other numeric data types are not enough. I wanted a Money data type, and after proposing a pre-PEP in *************** *** 48,52 **** One of the biggest advantages of implementing a standard is that ! someone already thought all the creepy cases for you. And to a standard GvR redirected me: Mike Cowlishaw's General Decimal Arithmetic specification [2]_. This document defines a general --- 50,54 ---- One of the biggest advantages of implementing a standard is that ! someone already thought out all the creepy cases for you. And to a standard GvR redirected me: Mike Cowlishaw's General Decimal Arithmetic specification [2]_. This document defines a general *************** *** 86,90 **** 1234 ==> 1234e0 12345 ==> 12345e0 ! 123456 ==> 12345e1 In contrast, we have the example of a ``long`` integer with infinite --- 88,94 ---- 1234 ==> 1234e0 12345 ==> 12345e0 ! 123456 ==> 12346e1 ! ! (note that in the last line the number got rounded to fit in five digits). In contrast, we have the example of a ``long`` integer with infinite *************** *** 109,118 **** With this exposed maybe you're thinking "Hey! Can we just store the 1 ! and the 3 as numerator and denominator?", which take us to the next point. ! Why not rational ! ---------------- Rational numbers are stored using two integer numbers, the numerator --- 113,122 ---- With this exposed maybe you're thinking "Hey! Can we just store the 1 ! and the 3 as numerator and denominator?", which takes us to the next point. ! Why not rational? ! ----------------- Rational numbers are stored using two integer numbers, the numerator *************** *** 239,253 **** to be used). ! The context gets that name because surrounds the Decimal numbers. ! It's up to the implementation to work with one or several contexts, but definitely the idea is not to get a context per Decimal number. These definitions don't affect the internal storage of the Decimal numbers, just the way that the arithmetic operations are performed. ! The context is defined by the following parameters: - Precision: The maximum number of significant digits that can result ! from an arithmetic operation (integer > 0). - Rounding: The name of the algorithm to be used when rounding is --- 243,263 ---- to be used). ! The context gets that name because it surrounds the Decimal numbers, ! with parts of context acting as input to, and output of, operations. ! It's up to the application to work with one or several contexts, but definitely the idea is not to get a context per Decimal number. + For example, a typical use would be to set the context's precision to + 20 digits at the start of a program, and never explicitly use context + again. These definitions don't affect the internal storage of the Decimal numbers, just the way that the arithmetic operations are performed. ! The context is mainly defined by the following parameters (see ! `Context Attributes`_ for all context attributes): - Precision: The maximum number of significant digits that can result ! from an arithmetic operation (integer > 0). There is no maximum for ! this value. - Rounding: The name of the algorithm to be used when rounding is *************** *** 282,286 **** - flags: all set to 0 - trap-enablers: all set to 0 ! - precision: is set to the designated single precision - rounding: is set to round-half-even --- 292,296 ---- - flags: all set to 0 - trap-enablers: all set to 0 ! - precision: is set to 9 - rounding: is set to round-half-even *************** *** 302,306 **** Division undefined invalid-operation [0,qNaN] Inexact inexact unchanged - Insufficient storage [0,qNaN] Invalid context invalid-operation [0,qNaN] Invalid operation invalid-operation [0,qNaN] (or [s,qNaN] or [s,qNaN,d] --- 312,315 ---- *************** *** 312,315 **** --- 321,371 ---- ==================== ================= =================================== + Note: when the standard talks about "Insufficient storage", as long as + this is implementation-specific behaviour about not having enough + storage to keep the internals of the number, this implementation will + raise MemoryError. + + Regarding Overflow and Underflow, there's been a long discussion in + python-dev about artificial limits. The general consensus is to keep + the artificial limits only if there are important reasons to do that. + Tim Peters gives us three: + + ...eliminating bounds on exponents effectively means overflow + (and underflow) can never happen. But overflow *is* a valuable + safety net in real life fp use, like a canary in a coal mine, + giving danger signs early when a program goes insane. + + Virtually all implementations of 854 use (and as IBM's standard + even suggests) "forbidden" exponent values to encode non-finite + numbers (infinities and NaNs). A bounded exponent can do this at + virtually no extra storage cost. If the exponent is unbounded, + then additional bits have to be used instead. This cost remains + hidden until more time- and space- efficient implementations are + attempted. + + Big as it is, the IBM standard is a tiny start at supplying a + complete numeric facility. Having no bound on exponent size will + enormously complicate the implementations of, e.g., decimal sin() + and cos() (there's then no a priori limit on how many digits of + pi effectively need to be known in order to perform argument + reduction). + + Edward Loper give us an example of when the limits are to be crossed: + probabilities. + + That said, Robert Brewer and Andrew Lentvorski want the limits to be + easily modifiable by the users. Actually, this is quite posible:: + + >>> d1 = Decimal("1e999999999") # at the exponent limit + >>> d1 + Decimal( (0, (1,), 999999999L) ) + >>> d1 * 10 # exceed the limit, got infinity + Decimal( (0, (0,), 'F') ) + >>> getcontext().Emax = 1000000000 # increase the limit + >>> d1 * 10 # does not exceed any more + Decimal( (0, (1, 0), 999999999L) ) + >>> d1 * 100 # exceed again + Decimal( (0, (0,), 'F') ) + Rounding Algorithms *************** *** 346,350 **** ``round-ceiling``: If all of the discarded digits are zero or if the sign is negative the result is unchanged; otherwise, the result is ! incremented by 1:: 1.123 --> 1.13 --- 402,406 ---- ``round-ceiling``: If all of the discarded digits are zero or if the sign is negative the result is unchanged; otherwise, the result is ! incremented by 1 (round toward positive infinity):: 1.123 --> 1.13 *************** *** 355,359 **** ``round-floor``: If all of the discarded digits are zero or if the sign is positive the result is unchanged; otherwise, the absolute ! value of the result is incremented by 1:: 1.123 --> 1.12 --- 411,416 ---- ``round-floor``: If all of the discarded digits are zero or if the sign is positive the result is unchanged; otherwise, the absolute ! value of the result is incremented by 1 (round toward negative ! infinty):: 1.123 --> 1.12 *************** *** 387,391 **** comply with the ANSI standard. All the requirements for this are specified in the Mike Cowlishaw's work [2]_. He also provided a ! **comprehensive** suite of test cases. The second section of requirements (standard Python functions support, --- 444,448 ---- comply with the ANSI standard. All the requirements for this are specified in the Mike Cowlishaw's work [2]_. He also provided a ! **very large** suite of test cases. The second section of requirements (standard Python functions support, *************** *** 399,403 **** The explicit construction does not get affected by the context (there is no rounding, no limits by the precision, etc.), because the context ! affects just operations' results. --- 456,461 ---- The explicit construction does not get affected by the context (there is no rounding, no limits by the precision, etc.), because the context ! affects just operations' results. The only exception to this is when ! you're `Creating from Context`_. *************** *** 414,425 **** ''''''''''' ! Strings with floats in normal and engineering notation will be ! supported. In this transformation there is no loss of information, as ! the string is directly converted to Decimal (there is not an ! intermediate conversion through float):: Decimal("-12") Decimal("23.2e-7") From float --- 472,489 ---- ''''''''''' ! Strings containing Python decimal integer literals and Python float ! literals will be supported. In this transformation there is no loss ! of information, as the string is directly converted to Decimal (there ! is not an intermediate conversion through float):: Decimal("-12") Decimal("23.2e-7") + Also, you can construct in this way all special values (Infinity and + Not a Number):: + + Decimal("Inf") + Decimal("NaN") + From float *************** *** 445,449 **** But If I *really* want my number to be ! ``Decimal('110000000000000008881784197001252...e-51')``, why can not write ``Decimal(1.1)``? Why should I expect Decimal to be "rounding" it? Remember that ``1.1`` *is* binary floating point, so I can --- 509,513 ---- But If I *really* want my number to be ! ``Decimal('110000000000000008881784197001252...e-51')``, why can't I write ``Decimal(1.1)``? Why should I expect Decimal to be "rounding" it? Remember that ``1.1`` *is* binary floating point, so I can *************** *** 451,455 **** way it is. ! Anyway, Paul Moore shown that (1) can't be, because:: (1) says D(1.1) == D('1.1') --- 515,519 ---- way it is. ! Anyway, Paul Moore showed that (1) can't work, because:: (1) says D(1.1) == D('1.1') *************** *** 461,465 **** ``D(1.1000000000000001)``. He also proposed to have an explicit conversion to float. bokr says you need to put the precision in the ! constructor and mwilson has the idea to:: d = Decimal (1.1, 1) # take float value to 1 decimal place --- 525,529 ---- ``D(1.1000000000000001)``. He also proposed to have an explicit conversion to float. bokr says you need to put the precision in the ! constructor and mwilson agreed:: d = Decimal (1.1, 1) # take float value to 1 decimal place *************** *** 476,488 **** syntax:: ! Decimal.from_float(floatNumber, [positions]) ! ! where ``floatNumber`` is the float number origin of the construction and ! ``positions`` is the positions after the decimal point where you apply a ! round-half-up rounding, if any. In this way you can do, for example:: ! Decimal.from_float(1.1, 2): The same that doing Decimal('1.1'). ! Decimal.from_float(1.1, 16): The same that doing Decimal('1.1000000000000001'). ! Decimal.from_float(1.1): The same that doing Decimal('110000000000000008881784197001252...e-51'). --- 540,553 ---- syntax:: ! Decimal.from_float(floatNumber, [decimal_places]) ! where ``floatNumber`` is the float number origin of the construction ! and ``decimal_places`` are the number of digits after the decimal ! point where you apply a round-half-up rounding, if any. In this way ! you can do, for example:: ! ! Decimal.from_float(1.1, 2): The same as doing Decimal('1.1'). ! Decimal.from_float(1.1, 16): The same as doing Decimal('1.1000000000000001'). ! Decimal.from_float(1.1): The same as doing Decimal('1100000000000000088817841970012523233890533447265625e-51'). *************** *** 501,504 **** --- 566,574 ---- Decimal((1, (3, 2, 2, 5), -2)) # for -32.25 + Of course, you can construct in this way all special values:: + + Decimal( (0, (0,), 'F') ) # for Infinity + Decimal( (0, (0,), 'n') ) # for Not a Number + From Decimal *************** *** 514,522 **** Decimal(value1) ! Decimal.from_float(value2, [decimal_digits]) ! where ``value1`` can be int, long, string, tuple or Decimal, ! ``value1`` can be only float, and ``decimal_digits`` is an optional ! int. --- 584,680 ---- Decimal(value1) ! Decimal.from_float(value2, [decimal_places]) ! where ``value1`` can be int, long, string, 3-tuple or Decimal, ! ``value2`` can only be float, and ``decimal_places`` is an optional ! non negative int. ! ! ! Creating from Context ! ''''''''''''''''''''' ! ! This item arose in python-dev from two sources in parallel. Ka-Ping ! Yee proposes to pass the context as an argument at instance creation ! (he wants the context he passes to be used only in creation time: "It ! would not be persistent"). Tony Meyer asks from_string to honor the ! context if it receives a parameter "honour_context" with a True value. ! (I don't like it, because the doc specifies that the context be ! honored and I don't want the method to comply with the specification ! regarding the value of an argument.) ! ! Tim Peters gives us a reason to have a creation that uses context: ! ! In general number-crunching, literals may be given to high ! precision, but that precision isn't free and *usually* isn't ! needed ! ! Casey Duncan wants to use another method, not a bool arg: ! ! I find boolean arguments a general anti-pattern, especially given ! we have class methods. Why not use an alternate constructor like ! Decimal.rounded_to_context("3.14159265"). ! ! In the process of deciding the syntax of that, Tim came up with a ! better idea: he proposes not to have a method in Decimal to create ! with a different context, but having instead a method in Context to ! create a Decimal instance. Basically, instead of:: ! ! D.using_context(number, context) ! ! it will be:: ! ! context.create_decimal(number) ! ! From Tim: ! ! While all operations in the spec except for the two to-string ! operations use context, no operations in the spec support an ! optional local context. That the Decimal() constructor ignores ! context by default is an extension to the spec. We must supply a ! context-honoring from-string operation to meet the spec. I ! recommend against any concept of "local context" in any operation ! -- it complicates the model and isn't necessary. ! ! So, we decided to use a context method to create a Decimal that will ! use (only to be created) that context in particular (for further ! operations it will use the context of the thread). But, a method with ! what name? ! ! Tim Peters proposes three methods to create from diverse sources ! (from_string, from_int, from_float). I proposed to use one method, ! ``create_decimal()``, without caring about the data type. Michael ! Chermside: "The name just fits my brain. The fact that it uses the ! context is obvious from the fact that it's Context method". ! ! The community agreed with that. I think that it's OK because a newbie ! will not be using the creation method from Context (the separate ! method in Decimal to construct from float is just to prevent newbies ! from encountering binary floating point issues). ! ! So, in short, if you want to create a Decimal instance using a ! particular context (that will be used just at creation time and not ! any further), you'll have to use a method of that context:: ! ! # n is any datatype accepted in Decimal(n) plus float ! mycontext.create_decimal(n) ! ! Example:: ! ! >>> # create a standard decimal instance ! >>> Decimal("11.2233445566778899") ! Decimal( (0, (1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9), -16) ) ! >>> ! >>> # create a decimal instance using the thread context ! >>> thread_context = getcontext() ! >>> thread_context.prec ! 9 ! >>> thread_contex.create_decimal("11.2233445566778899") ! Decimal( (0, (1, 1, 2, 2, 3, 3, 4, 4, 6), -7L) ) ! >>> ! >>> # create a decimal instance using other context ! >>> other_context = thread_context.copy() ! >>> other_context.prec = 4 ! >>> other_context.create_decimal("11.2233445566778899") ! Decimal( (0, (1, 1, 2, 2), -2L) ) *************** *** 633,636 **** --- 791,801 ---- - Decimal should support unary operators (``-, +, abs``). + - repr() should round trip, meaning that:: + + m = Decimal(...) + m == eval(repr(m)) + + - Decimal should be immutable. + - Decimal should support the built-in methods: *************** *** 639,651 **** - str, repr - hash - - copy, deepcopy - bool (0 is false, otherwise true) ! - Calling repr() should do round trip, meaning that:: ! m = Decimal(...) ! m == eval(repr(m)) ! - Decimal should be immutable. --- 804,1164 ---- - str, repr - hash - bool (0 is false, otherwise true) ! There's been some discussion in python-dev about the behaviour of ! ``hash()``. The community agrees that if the values are the same, the ! hashes of those values should also be the same. So, while Decimal(25) ! == 25 is True, hash(Decimal(25)) should be equal to hash(25). ! The detail is that you can NOT compare Decimal to floats or strings, ! so we should not worry about them giving the same hashes. In short:: ! hash(n) == hash(Decimal(n)) # Only if n is int, long, or Decimal ! ! Regarding str() and repr() behaviour, Ka-Ping Yee proposes that repr() ! have the same behaviour as str() and Tim Peters proposes that str() ! behave like the to-scientific-string operation from the Spec. ! ! This is posible, because (from Aahz): "The string form already ! contains all the necessary information to reconstruct a Decimal ! object". ! ! And it also complies with the Spec; Tim Peters: ! ! There's no requirement to have a method *named* "to_sci_string", ! the only requirement is that *some* way to spell to-sci-string's ! functionality be supplied. The meaning of to-sci-string is ! precisely specified by the standard, and is a good choice for both ! str(Decimal) and repr(Decimal). ! ! ! Documentation ! ============= ! ! This section explains all the public methods and attributes of Decimal ! and Context. ! ! ! Decimal Attributes ! ------------------ ! ! Decimal has no public attributes. The internal information is stored ! in slots and should not be accessed by end users. ! ! ! Decimal Methods ! --------------- ! ! Following are the conversion and arithmetic operations defined in the ! Spec, and how that functionality can be achieved with the actual ! implementation. ! ! - to-scientific-string: Use builtin function ``str()``:: ! ! >>> d = Decimal('123456789012.345') ! >>> str(d) ! '1.23456789E+11' ! ! - to-engineering-string: Use method ``to_eng_string()``:: ! ! >>> d = Decimal('123456789012.345') ! >>> d.to_eng_string() ! '123.456789E+9' ! ! - to-number: Use Context method ``create_decimal()``. The standard ! constructor or ``from_float()`` constructor cannot be used because ! these do not use the context (as is specified in the Spec for this ! conversion). ! ! - abs: Use builtin function ``abs()``:: ! ! >>> d = Decimal('-15.67') ! >>> abs(d) ! Decimal('15.67') ! ! - add: Use operator ``+``:: ! ! >>> d = Decimal('15.6') ! >>> d + 8 ! Decimal('23.6') ! ! - subtract: Use operator ``-``:: ! ! >>> d = Decimal('15.6') ! >>> d - 8 ! Decimal('7.6') ! ! - compare: Use method ``compare()``. This method (and not the ! built-in function cmp()) should only be used when dealing with ! *special values*:: ! ! >>> d = Decimal('-15.67') ! >>> nan = Decimal('NaN') ! >>> d.compare(23) ! '-1' ! >>> d.compare(nan) ! 'NaN' ! >>> cmp(d, 23) ! -1 ! >>> cmp(d, nan) ! 1 ! ! - divide: Use operator ``/``:: ! ! >>> d = Decimal('-15.67') ! >>> d / 2 ! Decimal('-7.835') ! ! - divide-integer: Use operator ``//``:: ! ! >>> d = Decimal('-15.67') ! >>> d // 2 ! Decimal('-7') ! ! - max: Use method ``max()``. Only use this method (and not the ! built-in function max()) when dealing with *special values*:: ! ! >>> d = Decimal('15') ! >>> nan = Decimal('NaN') ! >>> d.max(8) ! Decimal('15') ! >>> d.max(nan) ! Decimal('NaN') ! ! - min: Use method ``min()``. Only use this method (and not the ! built-in function min()) when dealing with *special values*:: ! ! >>> d = Decimal('15') ! >>> nan = Decimal('NaN') ! >>> d.min(8) ! Decimal('8') ! >>> d.min(nan) ! Decimal('NaN') ! ! - minus: Use unary operator ``-``:: ! ! >>> d = Decimal('-15.67') ! >>> -d ! Decimal('15.67') ! ! - plus: Use unary operator ``+``:: ! ! >>> d = Decimal('-15.67') ! >>> +d ! Decimal('-15.67') ! ! - multiply: Use operator ``*``:: ! ! >>> d = Decimal('5.7') ! >>> d * 3 ! Decimal('17.1') ! ! - normalize: Use method ``normalize()``:: ! ! >>> d = Decimal('123.45000') ! >>> d.normalize() ! Decimal('123.45') ! >>> d = Decimal('120.00') ! >>> d.normalize() ! Decimal('1.2E+2') ! ! - quantize: Use method ``quantize()``:: ! ! >>> d = Decimal('2.17') ! >>> d.quantize(Decimal('0.001')) ! Decimal('2.170') ! >>> d.quantize(Decimal('0.1')) ! Decimal('2.2') ! ! - remainder: Use operator ``%``:: ! ! >>> d = Decimal('10') ! >>> d % 3 ! Decimal('1') ! >>> d % 6 ! Decimal('4') ! ! - remainder-near: Use method ``remainder_near()``:: ! ! >>> d = Decimal('10') ! >>> d.remainder_near(3) ! Decimal('1') ! >>> d.remainder_near(6) ! Decimal('-2') ! ! - round-to-integral-value: Use method ``to_integral()``:: ! ! >>> d = Decimal('-123.456') ! >>> d.to_integral() ! Decimal('-123') ! ! - same-quantum: Use method ``same_quantum()``:: ! ! >>> d = Decimal('123.456') ! >>> d.same_quantum(Decimal('0.001')) ! True ! >>> d.same_quantum(Decimal('0.01')) ! False ! ! - square-root: Use method ``sqrt()``:: ! ! >>> d = Decimal('123.456') ! >>> d.sqrt() ! Decimal('11.1110756') ! ! - power: User operator ``**``:: ! ! >>> d = Decimal('12.56') ! >>> d ** 2 ! Decimal('157.7536') ! ! Following are other methods and why they exist: ! ! - ``adjusted()``: Returns the adjusted exponent. This concept is ! defined in the Spec: the adjusted exponent is the value of the ! exponent of a number when that number is expressed as though in ! scientific notation with one digit before any decimal point:: ! ! >>> d = Decimal('12.56') ! >>> d.adjusted() ! 1 ! ! - ``from_float()``: Class method to create instances from float data ! types:: ! ! >>> d = Decimal.from_float(12.35) ! >>> d ! Decimal('12.3500000') ! ! - ``as_tuple()``: Show the internal structure of the Decimal, the ! triple tuple. This method is not required by the Spec, but Tim ! Peters proposed it and the community agreed to have it (it's useful ! for developing and debugging):: ! ! >>> d = Decimal('123.4') ! >>> d.as_tuple() ! (0, (1, 2, 3, 4), -1) ! >>> d = Decimal('-2.34e5') ! >>> d.as_tuple() ! (1, (2, 3, 4), 3) ! ! ! Context Attributes ! ------------------ ! ! These are the attributes that can be changed to modify the context. ! ! - ``prec`` (int): the precision:: ! ! >>> c.prec ! 9 ! ! - ``rounding`` (str): rounding type (how to round):: ! ! >>> c.rounding ! 'half_even' ! ! - ``trap_enablers`` (dict): if trap_enablers[exception] = 1, then an ! exception is raised when it is caused:: ! ! >>> c.trap_enablers[Underflow] ! 0 ! >>> c.trap_enablers[Clamped] ! 0 ! ! - ``flags`` (dict): when an exception is caused, flags[exception] is ! incremented (whether or not the trap_enabler is set). Should be ! reset by the user of Decimal instance:: ! ! >>> c.flags[Underflow] ! 0 ! >>> c.flags[Clamped] ! 0 ! ! - ``Emin`` (int): minimum exponent:: ! ! >>> c.Emin ! -999999999 ! ! - ``Emax`` (int): maximum exponent:: ! ! >>> c.Emax ! 999999999 ! ! - ``capitals`` (int): boolean flag to use 'E' (True/1) or 'e' ! (False/0) in the string (for example, '1.32e+2' or '1.32E+2'):: ! ! >>> c.capitals ! 1 ! ! ! Context Methods ! --------------- ! ! The following methods comply with Decimal functionality from the Spec. ! Be aware that the operations that are called through a specific ! context use that context and not the thread context. ! ! To use these methods, take note that the syntax changes when the ! operator is binary or unary, for example:: ! ! >>> mycontext.abs(Decimal('-2')) ! '2' ! >>> mycontext.multiply(Decimal('2.3'), 5) ! '11.5' ! ! So, the following are the Spec operations and conversions and how to ! achieve them through a context (where ``d`` is a Decimal instance and ! ``n`` a number that can be used in an `Implicit construction`_): ! ! - to-scientific-string: ``to_sci_string(d)`` ! - to-engineering-string: ``to_eng_string(d)`` ! - to-number: ``create_decimal(number)``, see `Explicit construction`_ ! for ``number``. ! - abs: ``abs(d)`` ! - add: ``add(d, n)`` ! - subtract: ``subtract(d, n)`` ! - compare: ``compare(d, n)`` ! - divide: ``divide(d, n)`` ! - divide-integer: ``divide_int(d, n)`` ! - max: ``max(d, n)`` ! - min: ``min(d, n)`` ! - minus: ``minus(d)`` ! - plus: ``plus(d)`` ! - multiply: ``multiply(d, n)`` ! - normalize: ``normalize(d)`` ! - quantize: ``quantize(d, d)`` ! - remainder: ``remainder(d)`` ! - remainder-near: ``remainder_near(d)`` ! - round-to-integral-value: ``to_integral(d)`` ! - same-quantum: ``same_quantum(d, d)`` ! - square-root: ``sqrt(d)`` ! - power: ``power(d, n)`` ! ! The following methods are to support decimal functionality through ! Context: ! ! - ``divmod(d, n)`` ! - ``eq(d, d)`` ! - ``gt(d, d)`` ! - ``lt(d, d)`` ! ! These are methods that return useful information from the Context: ! ! - ``Etiny()``: Minimum exponent considering precision. ! ! >>> c.Emin ! -999999999 ! >>> c.Etiny() ! -1000000007 ! ! - ``Etop()``: Maximum exponent considering precision. ! ! >>> c.Emax ! 999999999 ! >>> c.Etop() ! 999999991 ! ! - ``copy()``: Returns a copy of the context. *************** *** 657,661 **** - code - test code - - documentation --- 1170,1173 ---- From arigo at users.sourceforge.net Thu Jun 17 06:22:43 2004 From: arigo at users.sourceforge.net (arigo@users.sourceforge.net) Date: Thu Jun 17 13:43:24 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.399,2.400 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10106 Modified Files: ceval.c Log Message: Performance tweak: allow stack_pointer and oparg to be register variables. SF patch #943898 Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.399 retrieving revision 2.400 diff -C2 -d -r2.399 -r2.400 *** ceval.c 8 Jun 2004 08:17:43 -0000 2.399 --- ceval.c 17 Jun 2004 10:22:40 -0000 2.400 *************** *** 465,472 **** int lastopcode = 0; #endif ! PyObject **stack_pointer; /* Next free slot in value stack */ register unsigned char *next_instr; ! register int opcode=0; /* Current opcode */ ! register int oparg=0; /* Current opcode argument, if any */ register enum why_code why; /* Reason for block stack unwind */ register int err; /* Error status -- nonzero if error */ --- 465,472 ---- int lastopcode = 0; #endif ! register PyObject **stack_pointer; /* Next free slot in value stack */ register unsigned char *next_instr; ! register int opcode; /* Current opcode */ ! register int oparg; /* Current opcode argument, if any */ register enum why_code why; /* Reason for block stack unwind */ register int err; /* Error status -- nonzero if error */ *************** *** 808,811 **** --- 808,813 ---- opcode = NEXTOP(); + oparg = 0; /* allows oparg to be stored in a register because + it doesn't have to be remembered across a full loop */ if (HAS_ARG(opcode)) oparg = NEXTARG(); *************** *** 2096,2109 **** case CALL_FUNCTION: PCALL(PCALL_ALL); #ifdef WITH_TSC ! x = call_function(&stack_pointer, oparg, &intr0, &intr1); #else ! x = call_function(&stack_pointer, oparg); #endif PUSH(x); if (x != NULL) continue; break; case CALL_FUNCTION_VAR: --- 2098,2116 ---- case CALL_FUNCTION: + { + PyObject **sp; PCALL(PCALL_ALL); + sp = stack_pointer; #ifdef WITH_TSC ! x = call_function(&sp, oparg, &intr0, &intr1); #else ! x = call_function(&sp, oparg); #endif + stack_pointer = sp; PUSH(x); if (x != NULL) continue; break; + } case CALL_FUNCTION_VAR: *************** *** 2115,2119 **** int flags = (opcode - CALL_FUNCTION) & 3; int n = na + 2 * nk; ! PyObject **pfunc, *func; PCALL(PCALL_ALL); if (flags & CALL_FLAG_VAR) --- 2122,2126 ---- int flags = (opcode - CALL_FUNCTION) & 3; int n = na + 2 * nk; ! PyObject **pfunc, *func, **sp; PCALL(PCALL_ALL); if (flags & CALL_FLAG_VAR) *************** *** 2136,2146 **** } else Py_INCREF(func); #ifdef WITH_TSC rdtscll(intr0); #endif ! x = ext_do_call(func, &stack_pointer, flags, na, nk); #ifdef WITH_TSC rdtscll(intr1); #endif Py_DECREF(func); --- 2143,2155 ---- } else Py_INCREF(func); + sp = stack_pointer; #ifdef WITH_TSC rdtscll(intr0); #endif ! x = ext_do_call(func, &sp, flags, na, nk); #ifdef WITH_TSC rdtscll(intr1); #endif + stack_pointer = sp; Py_DECREF(func); From mondragon at users.sourceforge.net Thu Jun 17 14:27:20 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Thu Jun 17 14:27:29 2004 Subject: [Python-checkins] python/dist/src/Modules collectionsmodule.c, 1.16, 1.17 _sre.c, 2.105, 2.106 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17704/Modules Modified Files: collectionsmodule.c _sre.c Log Message: Fixed end-of-loop code not reached warning when using SunPro C Index: collectionsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/collectionsmodule.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** collectionsmodule.c 30 May 2004 07:26:46 -0000 1.16 --- collectionsmodule.c 17 Jun 2004 18:27:16 -0000 1.17 *************** *** 2,5 **** --- 2,9 ---- #include "structmember.h" + #ifdef __SUNPRO_C + #pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) + #endif + /* collections module implementation of a deque() datatype Written and maintained by Raymond D. Hettinger Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.105 retrieving revision 2.106 diff -C2 -d -r2.105 -r2.106 *** _sre.c 31 May 2004 03:09:24 -0000 2.105 --- _sre.c 17 Jun 2004 18:27:16 -0000 2.106 *************** *** 35,38 **** --- 35,42 ---- */ + #ifdef __SUNPRO_C + #pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) + #endif + #ifndef SRE_RECURSIVE From mondragon at users.sourceforge.net Thu Jun 17 14:27:22 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Thu Jun 17 14:27:35 2004 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c, 2.212, 2.213 setobject.c, 1.27, 1.28 listobject.c, 2.205, 2.206 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17704/Objects Modified Files: unicodeobject.c setobject.c listobject.c Log Message: Fixed end-of-loop code not reached warning when using SunPro C Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.212 retrieving revision 2.213 diff -C2 -d -r2.212 -r2.213 *** unicodeobject.c 2 Jun 2004 16:49:16 -0000 2.212 --- unicodeobject.c 17 Jun 2004 18:27:17 -0000 2.213 *************** *** 42,45 **** --- 42,49 ---- #include "ucnhash.h" + #ifdef __SUNPRO_C + #pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) + #endif + #ifdef MS_WINDOWS #include Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** setobject.c 14 Jun 2004 04:24:41 -0000 1.27 --- setobject.c 17 Jun 2004 18:27:18 -0000 1.28 *************** *** 11,14 **** --- 11,18 ---- */ + #ifdef __SUNPRO_C + #pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) + #endif + static PyObject * set_update(PySetObject *so, PyObject *other) Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.205 retrieving revision 2.206 diff -C2 -d -r2.205 -r2.206 *** listobject.c 5 May 2004 06:28:16 -0000 2.205 --- listobject.c 17 Jun 2004 18:27:18 -0000 2.206 *************** *** 3,6 **** --- 3,10 ---- #include "Python.h" + #ifdef __SUNPRO_C + #pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) + #endif + #ifdef STDC_HEADERS #include From fdrake at users.sourceforge.net Thu Jun 17 13:19:15 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Jun 17 15:31:27 2004 Subject: [Python-checkins] python/dist/src/Doc/tools update-docs.sh, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30209 Modified Files: update-docs.sh Log Message: make the tarball available for download instead of throwing it away Index: update-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/update-docs.sh,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** update-docs.sh 9 Aug 2002 22:56:46 -0000 1.10 --- update-docs.sh 17 Jun 2004 17:19:12 -0000 1.11 *************** *** 29,31 **** rmdir $TMPDIR rm -rf $DOCTYPE-temp || exit $? ! rm "$UPDATES" || exit $? --- 29,31 ---- rmdir $TMPDIR rm -rf $DOCTYPE-temp || exit $? ! mv "$UPDATES" python-docs-$DOCTYPE.tar.bz2 || exit $? From montanaro at users.sourceforge.net Thu Jun 17 22:47:25 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu Jun 17 22:47:40 2004 Subject: [Python-checkins] python/dist/src configure, 1.446, 1.447 configure.in, 1.457, 1.458 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18448 Modified Files: configure configure.in Log Message: allow developers to more easily build a profiling version of the interpreter and modules by configuring with the --enable-profiling flag. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.446 retrieving revision 1.447 diff -C2 -d -r1.446 -r1.447 *** configure 8 Jun 2004 08:17:34 -0000 1.446 --- configure 18 Jun 2004 02:47:15 -0000 1.447 *************** *** 1,9 **** #! /bin/sh ! # From configure.in Revision: 1.456 . # Guess values for system-dependent variables and create Makefiles. ! # Generated by GNU Autoconf 2.57 for python 2.4. # ! # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 ! # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. --- 1,8 ---- [...12639 lines suppressed...] sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } *************** *** 19178,19185 **** as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ ! X"$as_dir" : 'X\(//\)[^/]' \| \ ! X"$as_dir" : 'X\(//\)$' \| \ ! X"$as_dir" : 'X\(/\)' \| \ ! . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } --- 21003,21010 ---- as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ ! X"$as_dir" : 'X\(//\)[^/]' \| \ ! X"$as_dir" : 'X\(//\)$' \| \ ! X"$as_dir" : 'X\(/\)' \| \ ! . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.457 retrieving revision 1.458 diff -C2 -d -r1.457 -r1.458 *** configure.in 8 Jun 2004 08:17:41 -0000 1.457 --- configure.in 18 Jun 2004 02:47:21 -0000 1.458 *************** *** 486,489 **** --- 486,507 ---- AC_MSG_RESULT($enable_shared) + AC_MSG_CHECKING(for --enable-profiling) + AC_ARG_ENABLE(profiling, + AC_HELP_STRING(--enable-profiling, enable C-level code profiling), + [ac_save_cc="$CC" + CC="$CC -pg" + AC_TRY_RUN([int main() { return 0; }], + ac_enable_profiling="yes", + ac_enable_profiling="no", + ac_enable_profiling="no") + CC="$ac_save_cc"]) + AC_MSG_RESULT($ac_enable_profiling) + + case "$ac_enable_profiling" in + "yes") + BASECFLAGS="-pg $BASECFLAGS" + LDFLAGS="-pg $LDFLAGS" + ;; + esac AC_MSG_CHECKING(LDLIBRARY) From montanaro at users.sourceforge.net Thu Jun 17 22:47:26 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu Jun 17 22:47:51 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1002,1.1003 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18448/Misc Modified Files: NEWS Log Message: allow developers to more easily build a profiling version of the interpreter and modules by configuring with the --enable-profiling flag. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1002 retrieving revision 1.1003 diff -C2 -d -r1.1002 -r1.1003 *** NEWS 14 Jun 2004 07:40:08 -0000 1.1002 --- NEWS 18 Jun 2004 02:47:22 -0000 1.1003 *************** *** 516,519 **** --- 516,522 ---- ----- + - Profiling using gprof is now available if Python is configured with + --enable-profiling. + - Profiling the VM using the Pentium TSC is now possible if Python is configured --with-tsc. From theller at users.sourceforge.net Fri Jun 18 13:31:27 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Fri Jun 18 13:33:03 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.77,1.78 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3153 Modified Files: dist.tex Log Message: Fix an obvious typo (It *is* a typo, or not?) Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** dist.tex 18 Jun 2004 06:55:28 -0000 1.77 --- dist.tex 18 Jun 2004 17:31:23 -0000 1.78 *************** *** 694,698 **** packages=['mypkg'], package_dir={'mypkg': 'src/mypkg'}, ! package_data={'pypkg': ['data/*.dat']}, ) \end{verbatim} --- 694,698 ---- packages=['mypkg'], package_dir={'mypkg': 'src/mypkg'}, ! package_data={'mypkg': ['data/*.dat']}, ) \end{verbatim} From mondragon at users.sourceforge.net Fri Jun 18 15:57:16 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Sun Jun 20 23:25:44 2004 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.160,2.161 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6148/Objects Modified Files: dictobject.c Log Message: Disabling end-of-loop code not reached warning on SunPro Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.160 retrieving revision 2.161 diff -C2 -d -r2.160 -r2.161 *** dictobject.c 28 May 2004 20:59:21 -0000 2.160 --- dictobject.c 18 Jun 2004 19:57:13 -0000 2.161 *************** *** 10,13 **** --- 10,17 ---- #include "Python.h" + #ifdef __SUNPRO_C + #pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) + #endif + typedef PyDictEntry dictentry; typedef PyDictObject dictobject; From bcannon at users.sourceforge.net Thu Jun 17 17:34:10 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Jun 20 23:31:48 2004 Subject: [Python-checkins] python/dist/src/Doc/lib xmldom.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26904/Doc/lib Modified Files: xmldom.tex Log Message: Add apparently missing word for InvalidStateError definition. Closes bug #973901. Thanks Brian Gough. Index: xmldom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldom.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** xmldom.tex 18 Apr 2003 22:04:34 -0000 1.23 --- xmldom.tex 17 Jun 2004 21:34:05 -0000 1.24 *************** *** 761,765 **** \begin{excdesc}{InvalidStateErr} ! Raised when an attempt is made to use an object that is not or is no longer usable. \end{excdesc} --- 761,765 ---- \begin{excdesc}{InvalidStateErr} ! Raised when an attempt is made to use an object that is not defined or is no longer usable. \end{excdesc} From bcannon at users.sourceforge.net Thu Jun 17 17:35:24 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Jun 20 23:41:19 2004 Subject: [Python-checkins] python/dist/src/Doc/lib xmldom.tex, 1.23, 1.23.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28344/Doc/lib Modified Files: Tag: release23-maint xmldom.tex Log Message: Add missing word in InvalidStateError definition. Index: xmldom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/xmldom.tex,v retrieving revision 1.23 retrieving revision 1.23.12.1 diff -C2 -d -r1.23 -r1.23.12.1 *** xmldom.tex 18 Apr 2003 22:04:34 -0000 1.23 --- xmldom.tex 17 Jun 2004 21:35:22 -0000 1.23.12.1 *************** *** 761,765 **** \begin{excdesc}{InvalidStateErr} ! Raised when an attempt is made to use an object that is not or is no longer usable. \end{excdesc} --- 761,765 ---- \begin{excdesc}{InvalidStateErr} ! Raised when an attempt is made to use an object that is not defined or is no longer usable. \end{excdesc} From fdrake at users.sourceforge.net Fri Jun 18 17:28:32 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun Jun 20 23:42:00 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils cmd.py,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6653/Lib/distutils Modified Files: cmd.py Log Message: fix typo Index: cmd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/cmd.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** cmd.py 12 Feb 2004 17:35:08 -0000 1.36 --- cmd.py 18 Jun 2004 21:28:28 -0000 1.37 *************** *** 69,73 **** # Per-command versions of the global flags, so that the user can # customize Distutils' behaviour command-by-command and let some ! # commands fallback on the Distribution's behaviour. None means # "not defined, check self.distribution's copy", while 0 or 1 mean # false and true (duh). Note that this means figuring out the real --- 69,73 ---- # Per-command versions of the global flags, so that the user can # customize Distutils' behaviour command-by-command and let some ! # commands fall back on the Distribution's behaviour. None means # "not defined, check self.distribution's copy", while 0 or 1 mean # false and true (duh). Note that this means figuring out the real From theller at users.sourceforge.net Fri Jun 18 14:29:48 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Sun Jun 20 23:44:37 2004 Subject: [Python-checkins] python/dist/src/PC/bdist_wininst wininst.dsp, 1.4, 1.5 Message-ID: Update of /cvsroot/python/python/dist/src/PC/bdist_wininst In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12372 Modified Files: wininst.dsp Log Message: The wininst.exe is no longer compressed with UPX. Index: wininst.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/bdist_wininst/wininst.dsp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wininst.dsp 16 Apr 2004 18:49:35 -0000 1.4 --- wininst.dsp 18 Jun 2004 18:29:46 -0000 1.5 *************** *** 55,63 **** # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 ..\..\..\zlib-1.2.1\zlib.lib imagehlp.lib comdlg32.lib ole32.lib comctl32.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /machine:I386 /nodefaultlib:"LIBC" /out:"..\..\lib\distutils\command/wininst-6.exe" - # Begin Special Build Tool - TargetPath=\sf\python\dist\src\lib\distutils\command\wininst-6.exe - SOURCE="$(InputPath)" - PostBuild_Cmds=upx.exe --best $(TARGETPATH) || echo "wininst.exe not compressed" - # End Special Build Tool !ELSEIF "$(CFG)" == "wininst - Win32 Debug" --- 55,58 ---- *************** *** 75,79 **** # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c ! # ADD CPP /nologo /MD /W3 /Z7 /Od /I "..\..\Include" /I "..\..\..\zlib-1.1.4" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 --- 70,74 ---- # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c ! # ADD CPP /nologo /MD /W3 /Z7 /Od /I "..\..\Include" /I "..\..\..\zlib-1.2.1" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 *************** *** 85,89 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ..\..\..\zlib-1.1.4\zlib.lib imagehlp.lib comdlg32.lib ole32.lib comctl32.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib:"LIBC" /out:"..\..\lib\distutils\command/wininst-6_d.exe" !ENDIF --- 80,84 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ..\..\..\zlib-1.2.1\zlib.lib imagehlp.lib comdlg32.lib ole32.lib comctl32.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib /nologo /subsystem:windows /pdb:none /debug /machine:I386 /nodefaultlib:"LIBC" /out:"..\..\lib\distutils\command/wininst-6_d.exe" !ENDIF From fdrake at users.sourceforge.net Thu Jun 17 18:04:21 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun Jun 20 23:45:34 2004 Subject: [Python-checkins] python/dist/src/Doc/tools push-docs.sh,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15886 Modified Files: push-docs.sh Log Message: Use getopt where possible, so this supports option letters that get jammed together on thos platforms. Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** push-docs.sh 17 Jun 2004 18:36:54 -0000 1.17 --- push-docs.sh 17 Jun 2004 22:04:17 -0000 1.18 *************** *** 30,34 **** ANNOUNCE=true ! # XXX Should use getopt(1) here. while [ "$#" -gt 0 ] ; do case "$1" in --- 30,43 ---- ANNOUNCE=true ! getopt -T >/dev/null ! if [ $? -eq 4 ] ; then ! # We have a sufficiently useful getopt(1) implementation. ! set -- `getopt -ssh m:p:qt:F: "$@"` ! else ! # This version of getopt doesn't support quoting of long options ! # with spaces, so let's not rely on it at all. ! : ! fi ! while [ "$#" -gt 0 ] ; do case "$1" in From dataservices at i-webmail.net Fri Jun 18 20:51:31 2004 From: dataservices at i-webmail.net (Data Services, LLC) Date: Sun Jun 20 23:45:48 2004 Subject: [Python-checkins] VQPI announces a New Reality-TV Production "Iron House" Message-ID: <200406190048.i5J0mLe9003334@mxzilla1.xs4all.nl> An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040618/06ea00f0/attachment.html From bcannon at users.sourceforge.net Fri Jun 18 21:02:55 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Jun 20 23:47:48 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1003, 1.1004 ACKS, 1.264, 1.265 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8289/Misc Modified Files: NEWS ACKS Log Message: pydoc.stripid() is now case-insensitive for its regex to support platforms that have pointer addresses in uppercase. Closes bug #934282. Thanks Robin Becker. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1003 retrieving revision 1.1004 diff -C2 -d -r1.1003 -r1.1004 *** NEWS 18 Jun 2004 02:47:22 -0000 1.1003 --- NEWS 19 Jun 2004 01:02:44 -0000 1.1004 *************** *** 337,342 **** ------- - Bug #823209: cmath.log() now takes an optional base argument so that its ! API matches math.log(). - Bug #957381: distutils bdist_rpm no longer fails on recent RPM versions --- 337,344 ---- ------- + - Bug #934282: pydoc.stripid() is now case-insensitive. Thanks Robin Becker. + - Bug #823209: cmath.log() now takes an optional base argument so that its ! API matches math.log(). - Bug #957381: distutils bdist_rpm no longer fails on recent RPM versions Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.264 retrieving revision 1.265 diff -C2 -d -r1.264 -r1.265 *** ACKS 10 Jun 2004 18:42:15 -0000 1.264 --- ACKS 19 Jun 2004 01:02:51 -0000 1.265 *************** *** 44,47 **** --- 44,48 ---- David Beazley Neal Becker + Robin Becker Bill Bedford Reimer Behrends From bcannon at users.sourceforge.net Fri Jun 18 21:05:43 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Jun 20 23:47:51 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.120, 1.831.4.121 ACKS, 1.243.6.1, 1.243.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9973/Misc Modified Files: Tag: release23-maint NEWS ACKS Log Message: pydoc.stripid() is now case-insensitive. Closes bug #934282. Thanks Robin Becker. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.120 retrieving revision 1.831.4.121 diff -C2 -d -r1.831.4.120 -r1.831.4.121 *** NEWS 11 Jun 2004 15:09:40 -0000 1.831.4.120 --- NEWS 19 Jun 2004 01:05:40 -0000 1.831.4.121 *************** *** 35,38 **** --- 35,43 ---- line numbers + Library + ------- + + - Bug #934282: make pydoc.stripid() be case-insensitive. + What's New in Python 2.3.4 (final)? =================================== Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.243.6.1 retrieving revision 1.243.6.2 diff -C2 -d -r1.243.6.1 -r1.243.6.2 *** ACKS 7 Jun 2004 23:17:48 -0000 1.243.6.1 --- ACKS 19 Jun 2004 01:05:40 -0000 1.243.6.2 *************** *** 43,46 **** --- 43,47 ---- David Beazley Neal Becker + Robin Becker Bill Bedford Reimer Behrends From bcannon at users.sourceforge.net Fri Jun 18 21:05:42 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Jun 20 23:48:13 2004 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.86.8.1,1.86.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9973/Lib Modified Files: Tag: release23-maint pydoc.py Log Message: pydoc.stripid() is now case-insensitive. Closes bug #934282. Thanks Robin Becker. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.86.8.1 retrieving revision 1.86.8.2 diff -C2 -d -r1.86.8.1 -r1.86.8.2 *** pydoc.py 31 Oct 2003 13:05:04 -0000 1.86.8.1 --- pydoc.py 19 Jun 2004 01:05:39 -0000 1.86.8.2 *************** *** 105,114 **** return text def stripid(text): """Remove the hexadecimal id from a Python object representation.""" ! # The behaviour of %p is implementation-dependent; we check two cases. ! for pattern in [' at 0x[0-9a-f]{6,}(>+)$', ' at [0-9A-F]{8,}(>+)$']: ! if re.search(pattern, repr(Exception)): ! return re.sub(pattern, '\\1', text) return text --- 105,114 ---- return text + _re_stripid = re.compile(r' at 0x[0-9a-f]{6,}(>+)$', re.IGNORECASE) def stripid(text): """Remove the hexadecimal id from a Python object representation.""" ! # The behaviour of %p is implementation-dependent in terms of case. ! if _re_stripid.search(repr(Exception)): ! return _re_stripid.sub(r'\1', text) return text From bcannon at users.sourceforge.net Fri Jun 18 21:22:51 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Jun 20 23:52:34 2004 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.93,1.94 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18855/Lib Modified Files: pydoc.py Log Message: Change pydoc.stripid() be able to match against 64-bit addresses by having regex match from 6 to 16 characters. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.93 retrieving revision 1.94 diff -C2 -d -r1.93 -r1.94 *** pydoc.py 19 Jun 2004 01:02:43 -0000 1.93 --- pydoc.py 19 Jun 2004 01:22:48 -0000 1.94 *************** *** 114,118 **** return text ! _re_stripid = re.compile(r' at 0x[0-9a-f]{6,}(>+)$', re.IGNORECASE) def stripid(text): """Remove the hexadecimal id from a Python object representation.""" --- 114,118 ---- return text ! _re_stripid = re.compile(r' at 0x[0-9a-f]{6,16}(>+)$', re.IGNORECASE) def stripid(text): """Remove the hexadecimal id from a Python object representation.""" From fdrake at users.sourceforge.net Thu Jun 17 16:14:52 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun Jun 20 23:53:47 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/tests support.py, NONE, 1.1 test_install_scripts.py, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv466/tests Modified Files: test_install_scripts.py Added Files: support.py Log Message: move support code to a helper module to ease re-use --- NEW FILE: support.py --- """Support code for distutils test cases.""" import shutil import tempfile class TempdirManager(object): """Mix-in class that handles temporary directories for test cases. This is intended to be used with unittest.TestCase. """ def setUp(self): super(TempdirManager, self).setUp() self.tempdirs = [] def tearDown(self): super(TempdirManager, self).tearDown() while self.tempdirs: d = self.tempdirs.pop() shutil.rmtree(d) def mkdtemp(self): """Create a temporary directory that will be cleaned up. Returns the path of the directory. """ d = tempfile.mkdtemp() self.tempdirs.append(d) return d class DummyCommand: """Class to store options for retrieval via set_undefined_options().""" def __init__(self, **kwargs): for kw, val in kwargs.items(): setattr(self, kw, val) def ensure_finalized(self): pass Index: test_install_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/tests/test_install_scripts.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_install_scripts.py 15 Jun 2004 16:55:46 -0000 1.2 --- test_install_scripts.py 17 Jun 2004 20:14:50 -0000 1.3 *************** *** 2,7 **** import os - import shutil - import tempfile import unittest --- 2,5 ---- *************** *** 9,36 **** from distutils.core import Distribution - class InstallScriptsTestCase(unittest.TestCase): - - def setUp(self): - self.tempdirs = [] - - def tearDown(self): - while self.tempdirs: - d = self.tempdirs.pop() - shutil.rmtree(d) - - def mkdtemp(self): - """Create a temporary directory that will be cleaned up. ! Returns the path of the directory. ! """ ! d = tempfile.mkdtemp() ! self.tempdirs.append(d) ! return d def test_default_settings(self): dist = Distribution() ! dist.command_obj["build"] = DummyCommand(build_scripts="/foo/bar") ! dist.command_obj["install"] = DummyCommand( install_scripts="/splat/funk", force=1, --- 7,20 ---- from distutils.core import Distribution + from distutils.tests import support ! class InstallScriptsTestCase(support.TempdirManager, unittest.TestCase): def test_default_settings(self): dist = Distribution() ! dist.command_obj["build"] = support.DummyCommand( ! build_scripts="/foo/bar") ! dist.command_obj["install"] = support.DummyCommand( install_scripts="/splat/funk", force=1, *************** *** 72,77 **** target = self.mkdtemp() dist = Distribution() ! dist.command_obj["build"] = DummyCommand(build_scripts=source) ! dist.command_obj["install"] = DummyCommand( install_scripts=target, force=1, --- 56,61 ---- target = self.mkdtemp() dist = Distribution() ! dist.command_obj["build"] = support.DummyCommand(build_scripts=source) ! dist.command_obj["install"] = support.DummyCommand( install_scripts=target, force=1, *************** *** 87,101 **** - class DummyCommand: - """Class to store options for retrieval via set_undefined_options().""" - - def __init__(self, **kwargs): - for kw, val in kwargs.items(): - setattr(self, kw, val) - - def ensure_finalized(self): - pass - - def test_suite(): --- 71,74 ---- From mwh at users.sourceforge.net Thu Jun 17 11:55:56 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Sun Jun 20 23:53:53 2004 Subject: [Python-checkins] python/dist/src/Modules signalmodule.c,2.74,2.75 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1855 Modified Files: signalmodule.c Log Message: silly typo Index: signalmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/signalmodule.c,v retrieving revision 2.74 retrieving revision 2.75 diff -C2 -d -r2.74 -r2.75 *** signalmodule.c 31 Jul 2003 10:35:29 -0000 2.74 --- signalmodule.c 17 Jun 2004 15:55:53 -0000 2.75 *************** *** 100,104 **** "default_int_handler(...)\n\ \n\ ! The default handler for SIGINT instated by Python.\n\ It raises KeyboardInterrupt."); --- 100,104 ---- "default_int_handler(...)\n\ \n\ ! The default handler for SIGINT installed by Python.\n\ It raises KeyboardInterrupt."); From fdrake at users.sourceforge.net Thu Jun 17 16:16:21 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun Jun 20 23:54:07 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_py.py, 1.43, 1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1914/command Modified Files: build_py.py Log Message: fix bug: list of data files was initialized too soon in build_py Index: build_py.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_py.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** build_py.py 11 Jun 2004 21:50:33 -0000 1.43 --- build_py.py 17 Jun 2004 20:16:19 -0000 1.44 *************** *** 54,62 **** self.py_modules = self.distribution.py_modules self.package_data = self.distribution.package_data - self.data_files = self.get_data_files() self.package_dir = {} if self.distribution.package_dir: for name, path in self.distribution.package_dir.items(): self.package_dir[name] = convert_path(path) # Ick, copied straight from install_lib.py (fancy_getopt needs a --- 54,62 ---- self.py_modules = self.distribution.py_modules self.package_data = self.distribution.package_data self.package_dir = {} if self.distribution.package_dir: for name, path in self.distribution.package_dir.items(): self.package_dir[name] = convert_path(path) + self.data_files = self.get_data_files() # Ick, copied straight from install_lib.py (fancy_getopt needs a From fdrake at users.sourceforge.net Thu Jun 17 16:16:22 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sun Jun 20 23:54:23 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/tests test_build_py.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1914/tests Added Files: test_build_py.py Log Message: fix bug: list of data files was initialized too soon in build_py --- NEW FILE: test_build_py.py --- """Tests for distutils.command.build_py.""" import os import unittest from distutils.command.build_py import build_py from distutils.core import Distribution from distutils.tests import support class BuildPyTestCase(support.TempdirManager, unittest.TestCase): def test_package_data(self): sources = self.mkdtemp() f = open(os.path.join(sources, "__init__.py"), "w") f.write("# Pretend this is a package.") f.close() f = open(os.path.join(sources, "README.txt"), "w") f.write("Info about this package") f.close() destination = self.mkdtemp() dist = Distribution({"packages": ["pkg"], "package_dir": {"pkg": sources}}) # script_name need not exist, it just need to be initialized dist.script_name = os.path.join(sources, "setup.py") dist.command_obj["build"] = support.DummyCommand( force=0, build_lib=destination) dist.packages = ["pkg"] dist.package_data = {"pkg": ["README.txt"]} dist.package_dir = {"pkg": sources} cmd = build_py(dist) cmd.ensure_finalized() self.assertEqual(cmd.package_data, dist.package_data) cmd.run() self.assertEqual(len(cmd.get_outputs()), 2) pkgdest = os.path.join(destination, "pkg") files = os.listdir(pkgdest) self.assert_("__init__.py" in files) self.assert_("README.txt" in files) def test_suite(): return unittest.makeSuite(BuildPyTestCase) From theller at users.sourceforge.net Fri Jun 18 02:55:31 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Sun Jun 20 23:56:39 2004 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.76,1.77 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26148 Modified Files: dist.tex Log Message: Fix typo - the module is named distutils.util. Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** dist.tex 14 Jun 2004 22:07:50 -0000 1.76 --- dist.tex 18 Jun 2004 06:55:28 -0000 1.77 *************** *** 2880,2884 **** \end{funcdesc} ! \section{\module{distutils.utils} --- Miscellaneous other utility functions} \declaremodule{standard}{distutils.util} \modulesynopsis{Miscellaneous other utility functions} --- 2880,2884 ---- \end{funcdesc} ! \section{\module{distutils.util} --- Miscellaneous other utility functions} \declaremodule{standard}{distutils.util} \modulesynopsis{Miscellaneous other utility functions} From bcannon at users.sourceforge.net Fri Jun 18 21:03:21 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Jun 20 23:57:34 2004 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.92,1.93 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8289/Lib Modified Files: pydoc.py Log Message: pydoc.stripid() is now case-insensitive for its regex to support platforms that have pointer addresses in uppercase. Closes bug #934282. Thanks Robin Becker. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.92 retrieving revision 1.93 diff -C2 -d -r1.92 -r1.93 *** pydoc.py 11 Jun 2004 04:46:12 -0000 1.92 --- pydoc.py 19 Jun 2004 01:02:43 -0000 1.93 *************** *** 114,127 **** return text def stripid(text): """Remove the hexadecimal id from a Python object representation.""" ! # The behaviour of %p is implementation-dependent; we check two cases. ! for pattern in [' at 0x[0-9a-f]{6,}(>+)$', ' at [0-9A-F]{8,}(>+)$']: ! if re.search(pattern, repr(Exception)): ! return re.sub(pattern, '\\1', text) return text ! def _is_some_method(object): ! return inspect.ismethod(object) or inspect.ismethoddescriptor(object) def allmethods(cl): --- 114,127 ---- return text + _re_stripid = re.compile(r' at 0x[0-9a-f]{6,}(>+)$', re.IGNORECASE) def stripid(text): """Remove the hexadecimal id from a Python object representation.""" ! # The behaviour of %p is implementation-dependent in terms of case. ! if _re_stripid.search(repr(Exception)): ! return _re_stripid.sub(r'\1', text) return text ! def _is_some_method(obj): ! return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj) def allmethods(cl): From mwh at users.sourceforge.net Fri Jun 18 07:41:11 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Sun Jun 20 23:58:41 2004 Subject: [Python-checkins] python/nondist/peps pep-0310.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20025 Modified Files: pep-0310.txt Log Message: Clarify why we don't do hasattr(var, '__exit__). Index: pep-0310.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0310.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0310.txt 15 Dec 2003 11:04:01 -0000 1.3 --- pep-0310.txt 18 Jun 2004 11:41:03 -0000 1.4 *************** *** 69,74 **** var.__exit__() ! Note that this makes using an object that does not have an ! __exit__() method a fail-fast error. If the variable is omitted, an unnamed object is allocated on the --- 69,75 ---- var.__exit__() ! (The presence of an __exit__ method is *not* checked like that of ! __enter__ to ensure that using inappropriate objects in with: ! statements gives an error). If the variable is omitted, an unnamed object is allocated on the From bwarsaw at users.sourceforge.net Wed Jun 16 15:31:39 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Mon Jun 21 00:14:29 2004 Subject: [Python-checkins] python/nondist/peps pep-0292.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1338 Modified Files: pep-0292.txt Log Message: Describe what happens to $'s that don't fit the rule. Index: pep-0292.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0292.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0292.txt 24 Mar 2004 03:08:02 -0000 1.7 --- pep-0292.txt 16 Jun 2004 19:31:35 -0000 1.8 *************** *** 62,65 **** --- 62,70 ---- not part of the placeholder, e.g. "${noun}ification". + If the $ character appears at the end of the line, or is followed + by any other character than those described above, it is treated + as if it had been escaped, appearing in the resulting string + unchanged. + No other characters have special meaning, however it is possible to derive from the dstring class to define different rules for the From fdrake at users.sourceforge.net Thu Jun 17 16:37:47 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Jun 21 00:16:22 2004 Subject: [Python-checkins] python/nondist/sandbox/setuptools/setuptools __init__.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17214 Modified Files: __init__.py Log Message: remove blank line pollution Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 19 Mar 2004 20:53:14 -0000 1.1 --- __init__.py 17 Jun 2004 20:37:44 -0000 1.2 *************** *** 38,43 **** - - def setup(**attrs): """Do package setup --- 38,41 ---- *************** *** 50,82 **** attrs.setdefault("distclass",Distribution) return distutils.core.setup(**attrs) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --- 48,49 ---- From theller at users.sourceforge.net Fri Jun 18 13:03:41 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Mon Jun 21 00:17:32 2004 Subject: [Python-checkins] python/dist/src/PC/bdist_wininst install.c, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/dist/src/PC/bdist_wininst In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12936 Modified Files: install.c Log Message: When loading the Python dll to run the postinstall script, try to load it from the install directory (as reported by the registry) in case it is not found on the default Loadlibrary search path. Fixes SF 935091: bdist_winist post-install script fails on non-admin Python Already backported. Index: install.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/bdist_wininst/install.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** install.c 15 Apr 2004 18:19:02 -0000 1.3 --- install.c 18 Jun 2004 17:03:38 -0000 1.4 *************** *** 591,594 **** --- 591,610 ---- }; + static HINSTANCE LoadPythonDll(char *fname) + { + char fullpath[_MAX_PATH]; + LONG size = sizeof(fullpath); + HINSTANCE h = LoadLibrary(fname); + if (h) + return h; + if (ERROR_SUCCESS != RegQueryValue(HKEY_CURRENT_USER, + "SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath", + fullpath, &size)) + return NULL; + strcat(fullpath, "\\"); + strcat(fullpath, fname); + return LoadLibrary(fullpath); + } + static int prepare_script_environment(HINSTANCE hPython) { *************** *** 716,720 **** freopen(tempname, "a", stdout); ! hPython = LoadLibrary (pythondll); if (!hPython) { set_failure_reason("Can't load Python for pre-install script"); --- 732,736 ---- freopen(tempname, "a", stdout); ! hPython = LoadPythonDll(pythondll); if (!hPython) { set_failure_reason("Can't load Python for pre-install script"); *************** *** 1746,1750 **** SetDlgItemText(hDialog, IDC_INFO, "Loading python..."); ! hPython = LoadLibrary(pythondll); if (hPython) { errors = compile_filelist(hPython, FALSE); --- 1762,1766 ---- SetDlgItemText(hDialog, IDC_INFO, "Loading python..."); ! hPython = LoadPythonDll(pythondll); if (hPython) { errors = compile_filelist(hPython, FALSE); *************** *** 1765,1769 **** SetDlgItemText(hDialog, IDC_INFO, "Loading python..."); ! hPython = LoadLibrary(pythondll); if (hPython) { errors = compile_filelist(hPython, TRUE); --- 1781,1785 ---- SetDlgItemText(hDialog, IDC_INFO, "Loading python..."); ! hPython = LoadPythonDll(pythondll); if (hPython) { errors = compile_filelist(hPython, TRUE); *************** *** 1841,1845 **** argv[0] = fname; ! hPython = LoadLibrary(pythondll); if (hPython) { int result; --- 1857,1861 ---- argv[0] = fname; ! hPython = LoadPythonDll(pythondll); if (hPython) { int result; From fdrake at users.sourceforge.net Thu Jun 17 14:36:57 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Jun 21 00:19:16 2004 Subject: [Python-checkins] python/dist/src/Doc/tools push-docs.sh,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26350 Modified Files: push-docs.sh Log Message: - add link to the downloadable package in the generated email - misc. changes Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** push-docs.sh 28 Sep 2003 22:14:29 -0000 1.16 --- push-docs.sh 17 Jun 2004 18:36:54 -0000 1.17 *************** *** 7,10 **** --- 7,12 ---- TARGETDIR=/usr/home/fdrake/tmp + PKGTYPE="bzip" # must be one of: bzip, tar, zip ("tar" implies gzip) + TARGET="$TARGETHOST:$TARGETDIR" *************** *** 28,31 **** --- 30,34 ---- ANNOUNCE=true + # XXX Should use getopt(1) here. while [ "$#" -gt 0 ] ; do case "$1" in *************** *** 34,37 **** --- 37,44 ---- shift 2 ;; + -p) + PKGTYPE="$2" + shift 1 + ;; -q) ANNOUNCE=false *************** *** 69,77 **** MYDIR="`pwd`" cd .. # now in .../Doc/ ! make --no-print-directory bziphtml || exit $? ! PACKAGE="html-$VERSION.tar.bz2" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ssh "$TARGETHOST" tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $? --- 76,95 ---- MYDIR="`pwd`" + if [ "$PKGTYPE" = bzip ] ; then + PKGEXT=tar.bz2 + elif [ "$PKGTYPE" = tar ] ; then + PKGEXT=tgz + elif [ "$PKGTYPE" = zip ] ; then + PKGEXT=zip + else + echo 1>&2 "unsupported package type: $PKGTYPE" + exit 2 + fi + cd .. # now in .../Doc/ ! make --no-print-directory ${PKGTYPE}html || exit $? ! PACKAGE="html-$VERSION.$PKGEXT" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ssh "$TARGETHOST" tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $? *************** *** 89,92 **** --- 107,114 ---- $EXPLANATION + + A downloadable package containing the HTML is also available: + + http://$TARGETHOST/dev/doc/python-docs-$DOCTYPE.$PKGEXT EOF exit $? From sjoerd at users.sourceforge.net Fri Jun 18 16:39:14 2004 From: sjoerd at users.sourceforge.net (sjoerd@users.sourceforge.net) Date: Mon Jun 21 00:27:03 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command build_py.py, 1.44, 1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3170 Modified Files: build_py.py Log Message: If self.packages is None (this can happen, I saw it), return immediately (since None is not a sequence you can iterate over). Index: build_py.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_py.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** build_py.py 17 Jun 2004 20:16:19 -0000 1.44 --- build_py.py 18 Jun 2004 20:39:11 -0000 1.45 *************** *** 105,108 **** --- 105,110 ---- """Generate list of '(package,src_dir,build_dir,filenames)' tuples""" data = [] + if not self.packages: + return data for package in self.packages: # Locate package source directory From theller at users.sourceforge.net Fri Jun 18 04:27:38 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Mon Jun 21 00:29:37 2004 Subject: [Python-checkins] python/dist/src/Doc/tools prechm.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30806 Modified Files: prechm.py Log Message: The 'distributing python modules' manual now has an index. Index: prechm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/prechm.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** prechm.py 8 Feb 2004 20:05:40 -0000 1.18 --- prechm.py 18 Jun 2004 08:27:36 -0000 1.19 *************** *** 164,168 **** Book('doc','Documenting Python','doc','contents'), Book('inst','Installing Python Modules', 'inst', 'index'), ! Book('dist','Distributing Python Modules', 'dist', 'index'), ], --- 164,168 ---- Book('doc','Documenting Python','doc','contents'), Book('inst','Installing Python Modules', 'inst', 'index'), ! Book('dist','Distributing Python Modules', 'dist', 'index', 'genindex'), ], From theller at users.sourceforge.net Fri Jun 18 14:28:57 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Mon Jun 21 00:30:50 2004 Subject: [Python-checkins] python/dist/src/PC/bdist_wininst wininst-7.1.vcproj, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/PC/bdist_wininst In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11722 Modified Files: wininst-7.1.vcproj Log Message: The wininst.exe is no longer compressed with UPX. Index: wininst-7.1.vcproj =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/bdist_wininst/wininst-7.1.vcproj,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wininst-7.1.vcproj 16 Apr 2004 18:47:50 -0000 1.2 --- wininst-7.1.vcproj 18 Jun 2004 18:28:54 -0000 1.3 *************** *** 59,64 **** HeaderFileName=""/> --- 59,63 ---- HeaderFileName=""/> From theller at users.sourceforge.net Fri Jun 18 14:30:31 2004 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Mon Jun 21 00:31:07 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command wininst-7.1.exe, 1.1, 1.2 wininst-6.exe, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12857 Modified Files: wininst-7.1.exe wininst-6.exe Log Message: Rebuild the wininst.exe files. Index: wininst-7.1.exe =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/wininst-7.1.exe,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsw0LIBy and /tmp/cvsTPJ2Rq differ Index: wininst-6.exe =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/wininst-6.exe,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvscyRXeg and /tmp/cvsOl2J38 differ From lemburg at users.sourceforge.net Sat Jun 19 13:17:03 2004 From: lemburg at users.sourceforge.net (lemburg@users.sourceforge.net) Date: Mon Jun 21 00:42:06 2004 Subject: [Python-checkins] python/dist/src/Lib platform.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25682 Modified Files: platform.py Log Message: Added normalization for Windows system name. Closesorm.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/platform.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** platform.py 4 May 2004 18:18:59 -0000 1.13 --- platform.py 19 Jun 2004 17:17:00 -0000 1.14 *************** *** 29,35 **** # Andruk, Just van Rossum, Thomas Heller, Mark R. Levinson, Mark # Hammond, Bill Tutt, Hans Nowak, Uwe Zessin (OpenVMS support), ! # Colin Kong, Trent Mick # # History: # 1.0.2 - added more Windows support # 1.0.1 - reformatted to make doc.py happy --- 29,36 ---- # Andruk, Just van Rossum, Thomas Heller, Mark R. Levinson, Mark # Hammond, Bill Tutt, Hans Nowak, Uwe Zessin (OpenVMS support), ! # Colin Kong, Trent Mick, Guido van Rossum # # History: + # 1.0.3 - added normalization of Windows system name # 1.0.2 - added more Windows support # 1.0.1 - reformatted to make doc.py happy *************** *** 958,961 **** --- 959,966 ---- if use_syscmd_ver: system,release,version = _syscmd_ver(system) + # Normalize system to what win32_ver() normally returns + # (_syscmd_ver() tends to return the vendor name as well) + if system == 'Microsoft Windows': + system = 'Windows' # In case we still don't know anything useful, we'll try to From bcannon at users.sourceforge.net Sat Jun 19 16:48:46 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Jun 21 00:45:58 2004 Subject: [Python-checkins] python/dist/src/Modules timemodule.c,2.140,2.141 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18933/Modules Modified Files: timemodule.c Log Message: Raise ValueError when value being stored in a time_t variable will result in more than a second of precision. Primarily affects ctime, localtime, and gmtime. Closes bug #919012 thanks to Tim Peters' code. Tim suggests that the new funciton being introduced, _PyTime_DoubletoTimet(), should be added to the internal C API and then used in datetime where appropriate. Not being done now for lack of time. Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.140 retrieving revision 2.141 diff -C2 -d -r2.140 -r2.141 *** timemodule.c 2 Mar 2004 04:38:10 -0000 2.140 --- timemodule.c 19 Jun 2004 20:48:43 -0000 2.141 *************** *** 85,88 **** --- 85,117 ---- static PyObject *moddict; + /* Cast double x to time_t, but raise ValueError if x is too large + * to fit in a time_t. ValueError is set on return iff the return + * value is (time_t)-1 and PyErr_Occurred(). + */ + static time_t + _PyTime_DoubleToTimet(double x) + { + time_t result; + double diff; + + result = (time_t)x; + /* How much info did we lose? time_t may be an integral or + * floating type, and we don't know which. If it's integral, + * we don't know whether C truncates, rounds, returns the floor, + * etc. If we lost a second or more, the C rounding is + * unreasonable, or the input just doesn't fit in a time_t; + * call it an error regardless. Note that the original cast to + * time_t can cause a C error too, but nothing we can do to + * worm around that. + */ + diff = x - (double)result; + if (diff <= -1.0 || diff >= 1.0) { + PyErr_SetString(PyExc_ValueError, + "timestamp out of range for platform time_t"); + result = (time_t)-1; + } + return result; + } + static PyObject * time_time(PyObject *self, PyObject *args) *************** *** 232,240 **** static PyObject * ! time_convert(time_t when, struct tm * (*function)(const time_t *)) { struct tm *p; errno = 0; ! p = function(&when); if (p == NULL) { #ifdef EINVAL --- 261,273 ---- static PyObject * ! time_convert(double when, struct tm * (*function)(const time_t *)) { struct tm *p; + time_t whent = _PyTime_DoubleToTimet(when); + + if (whent == (time_t)-1 && PyErr_Occurred()) + return NULL; errno = 0; ! p = function(&whent); if (p == NULL) { #ifdef EINVAL *************** *** 255,259 **** if (!PyArg_ParseTuple(args, "|d:gmtime", &when)) return NULL; ! return time_convert((time_t)when, gmtime); } --- 288,292 ---- if (!PyArg_ParseTuple(args, "|d:gmtime", &when)) return NULL; ! return time_convert(when, gmtime); } *************** *** 273,277 **** if (!PyArg_ParseTuple(args, "|d:localtime", &when)) return NULL; ! return time_convert((time_t)when, localtime); } --- 306,310 ---- if (!PyArg_ParseTuple(args, "|d:localtime", &when)) return NULL; ! return time_convert(when, localtime); } *************** *** 481,485 **** if (!PyArg_ParseTuple(args, "|d:ctime", &dt)) return NULL; ! tt = (time_t)dt; } p = ctime(&tt); --- 514,520 ---- if (!PyArg_ParseTuple(args, "|d:ctime", &dt)) return NULL; ! tt = _PyTime_DoubleToTimet(dt); ! if (tt == (time_t)-1 && PyErr_Occurred()) ! return NULL; } p = ctime(&tt); From bcannon at users.sourceforge.net Sat Jun 19 17:11:37 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Jun 21 00:46:32 2004 Subject: [Python-checkins] python/dist/src/Lib shutil.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9607/Lib Modified Files: shutil.py Log Message: shutil.move() will raise an exception when trying to move a directory into itself. Closes bug #919012 . Thanks Johannes Gijsbers. Index: shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shutil.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** shutil.py 23 Feb 2003 21:36:32 -0000 1.28 --- shutil.py 19 Jun 2004 21:11:34 -0000 1.29 *************** *** 9,12 **** --- 9,13 ---- import stat import exceptions + from os.path import abspath __all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2", *************** *** 165,168 **** --- 166,171 ---- except OSError: if os.path.isdir(src): + if destinsrc(src, dst): + raise Error, "Cannot move a directory '%s' into itself '%s'." % (src, dst) copytree(src, dst, symlinks=True) rmtree(src) *************** *** 170,171 **** --- 173,177 ---- copy2(src,dst) os.unlink(src) + + def destinsrc(src, dst): + return abspath(dst).startswith(abspath(src)) From bcannon at users.sourceforge.net Sat Jun 19 17:11:37 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Jun 21 00:46:39 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_shutil.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9607/Lib/test Modified Files: test_shutil.py Log Message: shutil.move() will raise an exception when trying to move a directory into itself. Closes bug #919012 . Thanks Johannes Gijsbers. Index: test_shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shutil.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_shutil.py 1 May 2003 17:45:49 -0000 1.2 --- test_shutil.py 19 Jun 2004 21:11:35 -0000 1.3 *************** *** 4,7 **** --- 4,9 ---- import shutil import tempfile + import os + import os.path from test import test_support *************** *** 13,22 **** self.assertEqual(shutil.rmtree(filename, True), None) - def test_main(): test_support.run_unittest(TestShutil) - if __name__ == '__main__': test_main() --- 15,34 ---- self.assertEqual(shutil.rmtree(filename, True), None) + def test_dont_move_dir_in_itself(self): + src_dir = tempfile.mkdtemp() + try: + dst = os.path.join(src_dir, 'foo') + self.assertRaises(shutil.Error, shutil.move, src_dir, dst) + finally: + try: + os.rmdir(src_dir) + except: + pass + + def test_main(): test_support.run_unittest(TestShutil) if __name__ == '__main__': test_main() From bcannon at users.sourceforge.net Sat Jun 19 17:11:37 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Jun 21 00:46:46 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.1005, 1.1006 ACKS, 1.265, 1.266 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9607/Misc Modified Files: NEWS ACKS Log Message: shutil.move() will raise an exception when trying to move a directory into itself. Closes bug #919012 . Thanks Johannes Gijsbers. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1005 retrieving revision 1.1006 diff -C2 -d -r1.1005 -r1.1006 *** NEWS 19 Jun 2004 20:50:47 -0000 1.1005 --- NEWS 19 Jun 2004 21:11:34 -0000 1.1006 *************** *** 341,344 **** --- 341,347 ---- ------- + - Bug #919012: shutil.move() will not try to move a directory into itself. + Thanks Johannes Gijsbers. + - Bug #934282: pydoc.stripid() is now case-insensitive. Thanks Robin Becker. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.265 retrieving revision 1.266 diff -C2 -d -r1.265 -r1.266 *** ACKS 19 Jun 2004 01:02:51 -0000 1.265 --- ACKS 19 Jun 2004 21:11:34 -0000 1.266 *************** *** 206,209 **** --- 206,210 ---- Dinu Gherman Jonathan Giddy + Johannes Gijsbers Michael Gilfix Chris Gonnerman From bcannon at users.sourceforge.net Sat Jun 19 17:39:25 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Jun 21 00:47:34 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_shutil.py, 1.2, 1.2.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4493/Lib/test Modified Files: Tag: release23-maint test_shutil.py Log Message: Raise an exception when trying to use shutil.move() to move a directory into itself. Closes bug #919012. Index: test_shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shutil.py,v retrieving revision 1.2 retrieving revision 1.2.8.1 diff -C2 -d -r1.2 -r1.2.8.1 *** test_shutil.py 1 May 2003 17:45:49 -0000 1.2 --- test_shutil.py 19 Jun 2004 21:39:23 -0000 1.2.8.1 *************** *** 4,7 **** --- 4,9 ---- import shutil import tempfile + import os + import os.path from test import test_support *************** *** 13,22 **** self.assertEqual(shutil.rmtree(filename, True), None) - def test_main(): test_support.run_unittest(TestShutil) - if __name__ == '__main__': test_main() --- 15,33 ---- self.assertEqual(shutil.rmtree(filename, True), None) + def test_dont_move_dir_in_itself(self): + src_dir = tempfile.mkdtemp() + try: + dst = os.path.join(src_dir, 'foo') + self.assertRaises(shutil.Error, shutil.move, src_dir, dst) + finally: + try: + os.rmdir(src_dir) + except: + pass + def test_main(): test_support.run_unittest(TestShutil) if __name__ == '__main__': test_main() From bcannon at users.sourceforge.net Sat Jun 19 16:50:50 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Jun 21 00:47:38 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1004,1.1005 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24048/Misc Modified Files: NEWS Log Message: Add news item about raising ValueError when timemodule.c code that uses timestamps will lose precision thanks to time_t < double (bug #919012). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1004 retrieving revision 1.1005 diff -C2 -d -r1.1004 -r1.1005 *** NEWS 19 Jun 2004 01:02:44 -0000 1.1004 --- NEWS 19 Jun 2004 20:50:47 -0000 1.1005 *************** *** 229,232 **** --- 229,236 ---- ----------------- + - time module code that deals with time_t timestamps will now raise a + ValueError if more than a second is lost in precision from time_t being less + precise than a double. Closes bug #919012. + - fcntl.ioctl now warns if the mutate flag is not specified. From bcannon at users.sourceforge.net Sat Jun 19 17:39:25 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Jun 21 00:48:43 2004 Subject: [Python-checkins] python/dist/src/Lib shutil.py,1.28,1.28.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4493/Lib Modified Files: Tag: release23-maint shutil.py Log Message: Raise an exception when trying to use shutil.move() to move a directory into itself. Closes bug #919012. Index: shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shutil.py,v retrieving revision 1.28 retrieving revision 1.28.10.1 diff -C2 -d -r1.28 -r1.28.10.1 *** shutil.py 23 Feb 2003 21:36:32 -0000 1.28 --- shutil.py 19 Jun 2004 21:39:22 -0000 1.28.10.1 *************** *** 9,12 **** --- 9,13 ---- import stat import exceptions + from os.path import abspath __all__ = ["copyfileobj","copyfile","copymode","copystat","copy","copy2", *************** *** 165,168 **** --- 166,171 ---- except OSError: if os.path.isdir(src): + if destinsrc(src, dst): + raise Error, "Cannot move a directory '%s' into itself '%s'." % (src, dst) copytree(src, dst, symlinks=True) rmtree(src) *************** *** 170,171 **** --- 173,177 ---- copy2(src,dst) os.unlink(src) + + def destinsrc(src, dst): + return abspath(dst).startswith(abspath(src)) From bcannon at users.sourceforge.net Sat Jun 19 17:39:25 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Jun 21 00:48:47 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.121, 1.831.4.122 ACKS, 1.243.6.2, 1.243.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4493/Misc Modified Files: Tag: release23-maint NEWS ACKS Log Message: Raise an exception when trying to use shutil.move() to move a directory into itself. Closes bug #919012. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.121 retrieving revision 1.831.4.122 diff -C2 -d -r1.831.4.121 -r1.831.4.122 *** NEWS 19 Jun 2004 01:05:40 -0000 1.831.4.121 --- NEWS 19 Jun 2004 21:39:21 -0000 1.831.4.122 *************** *** 38,41 **** --- 38,44 ---- ------- + - Bug #919012: shutil.move() raises an exception when you try to move a + directory into itself. + - Bug #934282: make pydoc.stripid() be case-insensitive. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.243.6.2 retrieving revision 1.243.6.3 diff -C2 -d -r1.243.6.2 -r1.243.6.3 *** ACKS 19 Jun 2004 01:05:40 -0000 1.243.6.2 --- ACKS 19 Jun 2004 21:39:22 -0000 1.243.6.3 *************** *** 200,203 **** --- 200,204 ---- Dinu Gherman Jonathan Giddy + Johannes Gijsbers Michael Gilfix Chris Gonnerman From facundobatista at users.sourceforge.net Sat Jun 19 21:53:11 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Mon Jun 21 00:51:31 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal/tests randoms.decTest, 1.5, 1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4706 Modified Files: randoms.decTest Log Message: Fixed small bug in an exception name. Index: randoms.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/randoms.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** randoms.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- randoms.decTest 20 Jun 2004 01:53:06 -0000 1.6 *************** *** 1,4029 **** ! ------------------------------------------------------------------------ ! -- randoms.decTest -- decimal random testcases -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...8029 lines suppressed...] ! xmul498 multiply -7.27403536 -481469656E-835183700 -> 3.50222730E-835183691 Inexact Rounded ! xpow498 power -7.27403536 -5 -> -0.0000491046885 Inexact Rounded ! xrem498 remainder -7.27403536 -481469656E-835183700 -> NaN Division_impossible ! xsub498 subtract -7.27403536 -481469656E-835183700 -> -7.27403536 Inexact Rounded ! xadd499 add -6157.74292 -94075286.2E+92555877 -> -9.40752862E+92555884 Inexact Rounded ! xcom499 compare -6157.74292 -94075286.2E+92555877 -> 1 ! xdiv499 divide -6157.74292 -94075286.2E+92555877 -> 6.54554790E-92555882 Inexact Rounded ! xdvi499 divideint -6157.74292 -94075286.2E+92555877 -> 0 ! xmul499 multiply -6157.74292 -94075286.2E+92555877 -> 5.79291428E+92555888 Inexact Rounded ! xpow499 power -6157.74292 -9 -> -7.85608218E-35 Inexact Rounded ! xrem499 remainder -6157.74292 -94075286.2E+92555877 -> -6157.74292 ! xsub499 subtract -6157.74292 -94075286.2E+92555877 -> 9.40752862E+92555884 Inexact Rounded ! xadd500 add -525445087.E+231529167 188227460 -> -5.25445087E+231529175 Inexact Rounded ! xcom500 compare -525445087.E+231529167 188227460 -> -1 ! xdiv500 divide -525445087.E+231529167 188227460 -> -2.79154321E+231529167 Inexact Rounded ! xdvi500 divideint -525445087.E+231529167 188227460 -> NaN Division_impossible ! xmul500 multiply -525445087.E+231529167 188227460 -> -9.89031941E+231529183 Inexact Rounded ! xpow500 power -525445087.E+231529167 188227460 -> Infinity Overflow Inexact Rounded ! xrem500 remainder -525445087.E+231529167 188227460 -> NaN Division_impossible ! xsub500 subtract -525445087.E+231529167 188227460 -> -5.25445087E+231529175 Inexact Rounded From facundobatista at users.sourceforge.net Sat Jun 19 21:55:02 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Mon Jun 21 00:51:35 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.19, 1.20 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6411 Modified Files: Decimal.py Log Message: Changes because of the attributes and methods name changes. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Decimal.py 5 Apr 2004 22:07:21 -0000 1.19 --- Decimal.py 20 Jun 2004 01:54:59 -0000 1.20 *************** *** 97,100 **** --- 97,101 ---- # facundobatista: + # 0.1.8 2003.06.19 Lots of name changes. # 0.7.4 2003.04.05 Added rdiv, rdivmod, rmod, rpow, rfloordiv special methods. # Fixed sub. *************** *** 515,519 **** if positions < 0: raise TypeError, "positions must be not negative in Decimal.from_float(value, [positions])" ! # d = d.fix(positions) # we must know what precision to pass to round --- 516,520 ---- if positions < 0: raise TypeError, "positions must be not negative in Decimal.from_float(value, [positions])" ! # d = d._fix(positions) # we must know what precision to pass to round *************** *** 666,670 **** return 1 ! def DecimalCmp(self, other, context=None): """Compares one to another. --- 667,671 ---- return 1 ! def compare(self, other, context=None): """Compares one to another. *************** *** 796,800 **** context = getcontext() if context.rounding_decision in (ALWAYS_ROUND,): ! return str(self.fix(context=context)) return str(self) --- 797,801 ---- context = getcontext() if context.rounding_decision in (ALWAYS_ROUND,): ! return str(self._fix(context=context)) return str(self) *************** *** 818,822 **** sign = 1 if context.rounding_decision in (ALWAYS_ROUND,): ! return Decimal((sign, self._int, self._exp)).fix(context=context) return Decimal( (sign, self._int, self._exp)) --- 819,823 ---- sign = 1 if context.rounding_decision in (ALWAYS_ROUND,): ! return Decimal((sign, self._int, self._exp))._fix(context=context) return Decimal( (sign, self._int, self._exp)) *************** *** 838,842 **** if context.rounding_decision in (ALWAYS_ROUND,): ! ans = self.fix(context=context) else: ans = Decimal(self) --- 839,843 ---- if context.rounding_decision in (ALWAYS_ROUND,): ! ans = self._fix(context=context) else: ans = Decimal(self) *************** *** 905,909 **** ans = other.rescale(exp, watchexp=0, context=context) if shouldround: ! ans = ans.fix(context=context) return ans if not other: --- 906,910 ---- ans = other.rescale(exp, watchexp=0, context=context) if shouldround: ! ans = ans._fix(context=context) return ans if not other: *************** *** 912,916 **** ans = self.rescale(exp, watchexp=0, context=context) if shouldround: ! ans = ans.fix(context=context) return ans --- 913,917 ---- ans = self.rescale(exp, watchexp=0, context=context) if shouldround: ! ans = ans._fix(context=context) return ans *************** *** 969,973 **** ans = Decimal(result) if shouldround: ! ans = ans.fix(context=context) return ans --- 970,974 ---- ans = Decimal(result) if shouldround: ! ans = ans._fix(context=context) return ans *************** *** 1002,1006 **** return other.__add__(tmp, context=context) ! def increment(self, round=1, context=None): """Special case of add, adding 1eExponent --- 1003,1007 ---- return other.__add__(tmp, context=context) ! def _increment(self, round=1, context=None): """Special case of add, adding 1eExponent *************** *** 1009,1013 **** For example: ! Decimal('5.624e10').increment() == Decimal('5.625e10') """ if context is None: --- 1010,1014 ---- For example: ! Decimal('5.624e10')._increment() == Decimal('5.625e10') """ if context is None: *************** *** 1030,1034 **** if round and context.rounding_decision in (ALWAYS_ROUND,): ! ans = ans.fix(context=context) return ans --- 1031,1035 ---- if round and context.rounding_decision in (ALWAYS_ROUND,): ! ans = ans._fix(context=context) return ans *************** *** 1065,1069 **** if shouldround: #Fixing in case the exponent is out of bounds ! ans = ans.fix(context=context) return ans --- 1066,1070 ---- if shouldround: #Fixing in case the exponent is out of bounds ! ans = ans._fix(context=context) return ans *************** *** 1072,1081 **** ans = Decimal((resultsign, other._int, resultexp)) if shouldround: ! ans = ans.fix(context=context) return ans if other._int == (1,): ans = Decimal((resultsign, self._int, resultexp)) if shouldround: ! ans = ans.fix(context=context) return ans --- 1073,1082 ---- ans = Decimal((resultsign, other._int, resultexp)) if shouldround: ! ans = ans._fix(context=context) return ans if other._int == (1,): ans = Decimal((resultsign, self._int, resultexp)) if shouldround: ! ans = ans._fix(context=context) return ans *************** *** 1106,1110 **** ans = Decimal( (resultsign, accumulator, resultexp)) if shouldround: ! ans = ans.fix(context=context) return ans --- 1107,1111 ---- ans = Decimal( (resultsign, accumulator, resultexp)) if shouldround: ! ans = ans._fix(context=context) return ans *************** *** 1205,1209 **** ans2 = self.rescale(exp, context=context, watchexp=0) if shouldround: ! ans2 = ans2.fix(context=context) return (Decimal( (sign, (0,), 0) ), ans2) --- 1206,1210 ---- ans2 = self.rescale(exp, context=context, watchexp=0) if shouldround: ! ans2 = ans2._fix(context=context) return (Decimal( (sign, (0,), 0) ), ans2) *************** *** 1230,1234 **** (len(op2.int) == len(op1.int) and op2.int <= op1.int)): #Meaning, while op2.int < op1.int, when normalized. ! res.increment() op1.subtract(op2.int) if res.exp == 0 and divmod: --- 1231,1235 ---- (len(op2.int) == len(op1.int) and op2.int <= op1.int)): #Meaning, while op2.int < op1.int, when normalized. ! res._increment() op1.subtract(op2.int) if res.exp == 0 and divmod: *************** *** 1243,1247 **** context.regard_flags(*frozen) if shouldround: ! otherside = otherside.fix(context=context) return (Decimal(res), otherside) --- 1244,1248 ---- context.regard_flags(*frozen) if shouldround: ! otherside = otherside._fix(context=context) return (Decimal(res), otherside) *************** *** 1284,1288 **** ans = Decimal(res) if shouldround: ! ans = ans.fix(context=context) return ans --- 1285,1289 ---- ans = Decimal(res) if shouldround: ! ans = ans._fix(context=context) return ans *************** *** 1369,1373 **** #Get flags now self.__divmod__(other, context=context) ! return r.fix(context=context) r._sign, comparison._sign = s1, s2 --- 1370,1374 ---- #Get flags now self.__divmod__(other, context=context) ! return r._fix(context=context) r._sign, comparison._sign = s1, s2 *************** *** 1400,1404 **** r._sign, comparison._sign = s1, s2 ! return r.fix(context=context) def __floordiv__(self, other, context=None): --- 1401,1405 ---- r._sign, comparison._sign = s1, s2 ! return r._fix(context=context) def __floordiv__(self, other, context=None): *************** *** 1445,1449 **** return int(self.__long__()) ! def fix(self, prec=None, rounding=None, folddown=None, context=None): """Round if it is necessary to keep self within prec precision. --- 1446,1450 ---- return int(self.__long__()) ! def _fix(self, prec=None, rounding=None, folddown=None, context=None): """Round if it is necessary to keep self within prec precision. *************** *** 1464,1476 **** prec = context.prec ans = Decimal(self) ! ans = ans.fixexponents(prec, rounding, folddown=folddown, context=context) if len(ans._int) > prec: ans = ans.round(prec, rounding, context=context) ! ans = ans.fixexponents(prec, rounding, folddown=folddown, context=context) return ans ! def fixexponents(self, prec=None, rounding=None, folddown=None, context=None): """Fix the exponents and return a copy with the exponent in bounds.""" --- 1465,1477 ---- prec = context.prec ans = Decimal(self) ! ans = ans._fixexponents(prec, rounding, folddown=folddown, context=context) if len(ans._int) > prec: ans = ans.round(prec, rounding, context=context) ! ans = ans._fixexponents(prec, rounding, folddown=folddown, context=context) return ans ! def _fixexponents(self, prec=None, rounding=None, folddown=None, context=None): """Fix the exponents and return a copy with the exponent in bounds.""" *************** *** 1584,1588 **** # Okay, let's round and lose data ! this_function = getattr(temp, self.pick_rounding_function[rounding]) #Now we've got the rounding function --- 1585,1589 ---- # Okay, let's round and lose data ! this_function = getattr(temp, self._pick_rounding_function[rounding]) #Now we've got the rounding function *************** *** 1596,1600 **** return ans ! pick_rounding_function = {} def _round_down(self, prec, expdiff, context): --- 1597,1601 ---- return ans ! _pick_rounding_function = {} def _round_down(self, prec, expdiff, context): *************** *** 1608,1612 **** tmp = Decimal( (self._sign,self._int[:prec], self._exp - expdiff)) if self._int[prec] >= 5: ! tmp = tmp.increment(round=0, context=context) if len(tmp._int) > prec: return Decimal( (tmp._sign, tmp._int[:-1], tmp._exp + 1)) --- 1609,1613 ---- tmp = Decimal( (self._sign,self._int[:prec], self._exp - expdiff)) if self._int[prec] >= 5: ! tmp = tmp._increment(round=0, context=context) if len(tmp._int) > prec: return Decimal( (tmp._sign, tmp._int[:-1], tmp._exp + 1)) *************** *** 1647,1651 **** for digit in self._int[prec:]: if digit != 0: ! tmp = tmp.increment(round=1, context=context) if len(tmp._int) > prec: return Decimal( (tmp._sign, tmp._int[:-1], tmp._exp + 1)) --- 1648,1652 ---- for digit in self._int[prec:]: if digit != 0: ! tmp = tmp._increment(round=1, context=context) if len(tmp._int) > prec: return Decimal( (tmp._sign, tmp._int[:-1], tmp._exp + 1)) *************** *** 1667,1671 **** return self._round_up(prec, expdiff, context) ! def fixedPoint(self, digits, rounding = None, context=None): """Rounds to a number of digits around the decimal point. --- 1668,1672 ---- return self._round_up(prec, expdiff, context) ! def _fixedPoint(self, digits, rounding = None, context=None): """Rounds to a number of digits around the decimal point. *************** *** 1674,1678 **** rounding before the decimal point. ! >>> str(Decimal("1234.34567").fixedPoint(2)) '1234.35' """ --- 1675,1679 ---- rounding before the decimal point. ! >>> str(Decimal("1234.34567")._fixedPoint(2)) '1234.35' """ *************** *** 1705,1709 **** return tmp ! def eng(self, context=None): """Convert to engineering-type string. --- 1706,1710 ---- return tmp ! def to_eng_string(self, context=None): """Convert to engineering-type string. *************** *** 1718,1722 **** ans = self if shouldround: ! ans = ans.fix(context=context) return ans.__str__(1) --- 1719,1723 ---- ans = self if shouldround: ! ans = ans._fix(context=context) return ans.__str__(1) *************** *** 1738,1742 **** return ans ! if not n._isinfinity() and not n.isinteger(): return context.raise_error(InvalidOperation, 'x ** (non-integer)') --- 1739,1743 ---- return ans ! if not n._isinfinity() and not n._isinteger(): return context.raise_error(InvalidOperation, 'x ** (non-integer)') *************** *** 1808,1812 **** if shouldround: ! return val.fix(context=context) return val --- 1809,1813 ---- if shouldround: ! return val._fix(context=context) return val *************** *** 1825,1829 **** return ans ! copy = self.fix(context=context) if copy._isinfinity(): return copy --- 1826,1830 ---- return ans ! copy = self._fix(context=context) if copy._isinfinity(): return copy *************** *** 1858,1862 **** return self.rescale(exp._exp, rounding, context, watchexp) ! def samequantum(self, other, context=None): """Test whether self and other have the same exponent. --- 1859,1863 ---- return self.rescale(exp._exp, rounding, context, watchexp) ! def same_quantum(self, other, context=None): """Test whether self and other have the same exponent. *************** *** 1934,1938 **** return self.rescale(0, rounding, context=context) ! def tointegral(self, rounding = None, context=None): """Rounds to the nearest integer, without raising inexact, rounded.""" if context is None: --- 1935,1939 ---- return self.rescale(0, rounding, context=context) ! def to_integral(self, rounding = None, context=None): """Rounds to the nearest integer, without raising inexact, rounded.""" if context is None: *************** *** 2048,2052 **** context.prec = firstprec context.rounding = rounding ! ans = ans.fix(context=context) rounding = context.set_rounding_decision(NEVER_ROUND) --- 2049,2053 ---- context.prec = firstprec context.rounding = rounding ! ans = ans._fix(context=context) rounding = context.set_rounding_decision(NEVER_ROUND) *************** *** 2068,2072 **** context.Emax, context.Emin = Emax, Emin ! return ans.fix(context=context) def max(self, other, context=None): --- 2069,2073 ---- context.Emax, context.Emin = Emax, Emin ! return ans._fix(context=context) def max(self, other, context=None): *************** *** 2089,2093 **** shouldround = context.rounding_decision in (ALWAYS_ROUND,) if shouldround: ! ans = ans.fix(context=context) return ans --- 2090,2094 ---- shouldround = context.rounding_decision in (ALWAYS_ROUND,) if shouldround: ! ans = ans._fix(context=context) return ans *************** *** 2112,2116 **** if context.rounding_decision in (ALWAYS_ROUND,): ! ans = ans.fix(context=context) return ans --- 2113,2117 ---- if context.rounding_decision in (ALWAYS_ROUND,): ! ans = ans._fix(context=context) return ans *************** *** 2126,2137 **** # return None ! def isinteger(self): """Returns whether self is an integer""" if self._exp >= 0: ! return Decimal(1) rest = self._int[self._exp:] if rest == (0,)*len(rest): ! return Decimal(1) ! return Decimal(0) def _iseven(self): --- 2127,2138 ---- # return None ! def _isinteger(self): """Returns whether self is an integer""" if self._exp >= 0: ! return True rest = self._int[self._exp:] if rest == (0,)*len(rest): ! return True ! return False def _iseven(self): *************** *** 2156,2160 **** globalname = name[1:].upper() val = globals()[globalname] ! Decimal.pick_rounding_function[val] = name --- 2157,2161 ---- globalname = name[1:].upper() val = globals()[globalname] ! Decimal._pick_rounding_function[val] = name *************** *** 2299,2305 **** return a.__add__(b, context=self) def apply(self, a): ! return str(a.fix(context=self)) def compare(self, a, b): ! return a.DecimalCmp(b, context=self) def lt(self, a, b): return Decimal(int(self.compare(a, b)) == -1) --- 2300,2306 ---- return a.__add__(b, context=self) def apply(self, a): ! return str(a._fix(context=self)) def compare(self, a, b): ! return a.compare(b, context=self) def lt(self, a, b): return Decimal(int(self.compare(a, b)) == -1) *************** *** 2310,2319 **** def divide(self, a, b): return a.__div__(b, context=self) ! def divideint(self, a, b): return a.__floordiv__(b, context=self) def divmod(self, a, b): return a.__divmod__(b, context=self) - def fix(self, a, prec=None): - return a.fix(context=self, prec=prec) def integer(self, a): return a.round_to_integer(context=self) --- 2311,2318 ---- def divide(self, a, b): return a.__div__(b, context=self) ! def divide_int(self, a, b): return a.__floordiv__(b, context=self) def divmod(self, a, b): return a.__divmod__(b, context=self) def integer(self, a): return a.round_to_integer(context=self) *************** *** 2338,2342 **** def remainder(self, a, b): return a.__mod__(b, context=self) ! def remaindernear(self, a, b): return a.remainder_near(b, context=self) def quantize(self, a, b): --- 2337,2341 ---- def remainder(self, a, b): return a.__mod__(b, context=self) ! def remainder_near(self, a, b): return a.remainder_near(b, context=self) def quantize(self, a, b): *************** *** 2344,2359 **** def rescale(self, a, b): return a.rescale(b, context=self) ! def samequantum(self, a, b): ! return a.samequantum(b, context=self) def squareroot(self, a): return a.sqrt(context=self) def subtract(self, a, b): return a.__sub__(b, context=self) ! def toeng(self, a): ! return a.eng(context=self) ! def tosci(self, a): return a.sci(context=self) ! def tointegral(self, a): ! return a.tointegral(context=self) def trim(self, a): return a.trim(context=self) --- 2343,2358 ---- def rescale(self, a, b): return a.rescale(b, context=self) ! def same_quantum(self, a, b): ! return a.same_quantum(b, context=self) def squareroot(self, a): return a.sqrt(context=self) def subtract(self, a, b): return a.__sub__(b, context=self) ! def to_eng_string(self, a): ! return a.to_eng_string(context=self) ! def to_sci_string(self, a): return a.sci(context=self) ! def to_integral(self, a): ! return a.to_integral(context=self) def trim(self, a): return a.trim(context=self) *************** *** 2422,2426 **** return 0 ! def increment(self): curspot = len(self.int) - 1 self.int[curspot]+= 1 --- 2421,2425 ---- return 0 ! def _increment(self): curspot = len(self.int) - 1 self.int[curspot]+= 1 From facundobatista at users.sourceforge.net Sat Jun 19 21:56:07 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Mon Jun 21 00:51:39 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal test_Decimal.py, 1.16, 1.17 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7651 Modified Files: test_Decimal.py Log Message: Changes because of the attributes and methods name changes. Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_Decimal.py 5 Apr 2004 22:08:41 -0000 1.16 --- test_Decimal.py 20 Jun 2004 01:56:04 -0000 1.17 *************** *** 15,18 **** --- 15,21 ---- """ + # 0.1.8 2003.06.19 fb: Adjusted threading test case. Taken out the immutability + # test. Added tearDown method to DecimalTest class. Some fixes + # because of the name changes. # 0.1.7 2003.04.05 fb: Adjusted several test cases. Eliminated interaction # with float in comparations and min/max test cases. *************** *** 87,90 **** --- 90,103 ---- 'up' : ROUND_UP} + # Name adapter to be able to change the Decimal and Context + # interface without changing the test files from Cowlishaw + nameAdapter = {'toeng':'to_eng_string', + 'tosci':'to_sci_string', + 'samequantum':'same_quantum', + 'tointegral':'to_integral', + 'remaindernear':'remainder_near', + 'divideint':'divide_int', + } + class DecimalTest(unittest.TestCase): """Class which tests the Decimal class against the test cases. *************** *** 107,110 **** --- 120,131 ---- 'minexponent' : self.change_min_exponent, 'clamp' : self.change_clamp} + + def tearDown(self): + """Cleaning up enviroment.""" + # leaving context in original state + for key in DefaultContext.trap_enablers.keys(): + DefaultContext.trap_enablers[key] = 0 + return + def eval_file(self, file): global skip_expected *************** *** 177,180 **** --- 198,202 ---- val = val.replace('SingleQuote', "'").replace('DoubleQuote', '"') return val + funct = nameAdapter.get(funct, funct) fname = funct funct = getattr(self.context, funct) *************** *** 200,204 **** conglomerate = '' v = FixQuotes(val) ! if fname in ('tosci', 'toeng'): if EXTENDEDERRORTEST: for error in theirexceptions: --- 222,226 ---- conglomerate = '' v = FixQuotes(val) ! if fname in ('to_sci_string', 'to_eng_string'): if EXTENDEDERRORTEST: for error in theirexceptions: *************** *** 226,230 **** ans = FixQuotes(ans) ! if EXTENDEDERRORTEST and fname not in ('tosci', 'toeng'): for error in theirexceptions: self.context.trap_enablers[error] = 1 --- 248,252 ---- ans = FixQuotes(ans) ! if EXTENDEDERRORTEST and fname not in ('to_sci_string', 'to_eng_string'): for error in theirexceptions: self.context.trap_enablers[error] = 1 *************** *** 241,245 **** try: result = str(funct(*vals)) ! if fname == 'samequantum': result = str(int(eval(result))) # 'True', 'False' -> '1', '0' except ExceptionList, error: --- 263,267 ---- try: result = str(funct(*vals)) ! if fname == 'same_quantum': result = str(int(eval(result))) # 'True', 'False' -> '1', '0' except ExceptionList, error: *************** *** 935,940 **** d3 = Decimal(3) cls.assertEqual(d1/d3, Decimal('0.333333333')) ! cls.event.wait() cls.assertEqual(d1/d3, Decimal('0.333333333')) return --- 957,963 ---- d3 = Decimal(3) cls.assertEqual(d1/d3, Decimal('0.333333333')) ! cls.synchro.wait() cls.assertEqual(d1/d3, Decimal('0.333333333')) + cls.finish1.set() return *************** *** 946,950 **** thiscontext.prec = 18 cls.assertEqual(d1/d3, Decimal('0.333333333333333333')) ! cls.event.set() return --- 969,974 ---- thiscontext.prec = 18 cls.assertEqual(d1/d3, Decimal('0.333333333333333333')) ! cls.synchro.set() ! cls.finish2.set() return *************** *** 960,964 **** '''Test the "threading isolation" of a Context.''' ! self.event = threading.Event() th1 = threading.Thread(target=thfunc1, args=(self,)) --- 984,990 ---- '''Test the "threading isolation" of a Context.''' ! self.synchro = threading.Event() ! self.finish1 = threading.Event() ! self.finish2 = threading.Event() th1 = threading.Thread(target=thfunc1, args=(self,)) *************** *** 967,970 **** --- 993,999 ---- th1.start() th2.start() + + self.finish1.wait() + self.finish1.wait() return *************** *** 1039,1045 **** self.assertEqual(hash(Decimal(23)), hash(23)) - #the same hash that a float - self.assertEqual(hash(Decimal('23.72')), hash(23.72)) - def test_minmax_methods(self): '''Test min and max between Decimal and others.''' --- 1068,1071 ---- *************** *** 1118,1145 **** d = Decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) self.assertEqual(d, eval(repr(d))) ! ! def test_immutability(self): ! '''Try to change internal objects and see if immutable.''' ! ! d = Decimal(42) ! ! #the used attributes ! try: ! d._exp = 20 ! d._int = 3 ! d._sign = 1 ! except TypeError: ! pass ! else: ! self.fail('Did not raised an error!') ! ! #some new attribute ! try: ! d.newone = None ! except TypeError: ! pass ! else: ! self.fail('Did not raised an error!') ! --- 1144,1174 ---- d = Decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) self.assertEqual(d, eval(repr(d))) ! ## ! ## As is impossible to make a real immutable instance in Python, ! ## I'm delaying this feature to some future. Facundo Batista 19-Jun-2004 ! ## ! ## def test_immutability(self): ! ## '''Try to change internal objects and see if immutable.''' ! ## ! ## d = Decimal(42) ! ## ! ## #the used attributes ! ## try: ! ## d._exp = 20 ! ## d._int = 3 ! ## d._sign = 1 ! ## except AttributeError: ! ## pass ! ## else: ! ## self.fail('Did not raised an error!') ! ## ! ## #some new attribute ! ## try: ! ## d.newone = None ! ## except AttributeError: ! ## pass ! ## else: ! ## self.fail('Did not raised an error!') ! ## From tim_one at users.sourceforge.net Sat Jun 19 22:50:17 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 21 00:52:27 2004 Subject: [Python-checkins] python/dist/src/Include timefuncs.h,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14933/Include Added Files: timefuncs.h Log Message: Bug 975996: Add _PyTime_DoubleToTimet to C API New include file timefuncs.h exports private API function _PyTime_DoubleToTimet() from timemodule.c. timemodule should export some other functions too (look for painful bits in datetimemodule.c). Added insane-argument checking to datetime's assorted fromtimestamp() and utcfromtimestamp() methods. Added insane-argument tests of these to test_datetime, and insane-argument tests for ctime(), localtime() and gmtime() to test_time. --- NEW FILE: timefuncs.h --- /* timefuncs.h */ /* Utility function related to timemodule.c. */ #ifndef TIMEFUNCS_H #define TIMEFUNCS_H #ifdef __cplusplus extern "C" { #endif /* Cast double x to time_t, but raise ValueError if x is too large * to fit in a time_t. ValueError is set on return iff the return * value is (time_t)-1 and PyErr_Occurred(). */ PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x); #ifdef __cplusplus } #endif #endif /* TIMEFUNCS_H */ From tim_one at users.sourceforge.net Sat Jun 19 22:50:18 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 21 00:52:30 2004 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c, 1.72, 1.73 timemodule.c, 2.141, 2.142 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14933/Modules Modified Files: datetimemodule.c timemodule.c Log Message: Bug 975996: Add _PyTime_DoubleToTimet to C API New include file timefuncs.h exports private API function _PyTime_DoubleToTimet() from timemodule.c. timemodule should export some other functions too (look for painful bits in datetimemodule.c). Added insane-argument checking to datetime's assorted fromtimestamp() and utcfromtimestamp() methods. Added insane-argument tests of these to test_datetime, and insane-argument tests for ctime(), localtime() and gmtime() to test_time. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** datetimemodule.c 7 Jun 2004 23:04:33 -0000 1.72 --- datetimemodule.c 20 Jun 2004 02:50:16 -0000 1.73 *************** *** 9,12 **** --- 9,13 ---- #include + #include "timefuncs.h" #include "datetime.h" *************** *** 2227,2235 **** /* Return new date from localtime(t). */ static PyObject * ! date_local_from_time_t(PyObject *cls, time_t t) { struct tm *tm; PyObject *result = NULL; tm = localtime(&t); if (tm) --- 2228,2240 ---- /* Return new date from localtime(t). */ static PyObject * ! date_local_from_time_t(PyObject *cls, double ts) { struct tm *tm; + time_t t; PyObject *result = NULL; + t = _PyTime_DoubleToTimet(ts); + if (t == (time_t)-1 && PyErr_Occurred()) + return NULL; tm = localtime(&t); if (tm) *************** *** 2279,2283 **** if (PyArg_ParseTuple(args, "d:fromtimestamp", ×tamp)) ! result = date_local_from_time_t(cls, (time_t)timestamp); return result; } --- 2284,2288 ---- if (PyArg_ParseTuple(args, "d:fromtimestamp", ×tamp)) ! result = date_local_from_time_t(cls, timestamp); return result; } *************** *** 3655,3662 **** PyObject *tzinfo) { ! time_t timet = (time_t)timestamp; ! double fraction = timestamp - (double)timet; ! int us = (int)round_to_long(fraction * 1e6); return datetime_from_timet_and_us(cls, f, timet, us, tzinfo); } --- 3660,3672 ---- PyObject *tzinfo) { ! time_t timet; ! double fraction; ! int us; + timet = _PyTime_DoubleToTimet(timestamp); + if (timet == (time_t)-1 && PyErr_Occurred()) + return NULL; + fraction = timestamp - (double)timet; + us = (int)round_to_long(fraction * 1e6); return datetime_from_timet_and_us(cls, f, timet, us, tzinfo); } Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.141 retrieving revision 2.142 diff -C2 -d -r2.141 -r2.142 *** timemodule.c 19 Jun 2004 20:48:43 -0000 2.141 --- timemodule.c 20 Jun 2004 02:50:16 -0000 2.142 *************** *** 4,7 **** --- 4,8 ---- #include "Python.h" #include "structseq.h" + #include "timefuncs.h" #include *************** *** 85,93 **** static PyObject *moddict; ! /* Cast double x to time_t, but raise ValueError if x is too large ! * to fit in a time_t. ValueError is set on return iff the return ! * value is (time_t)-1 and PyErr_Occurred(). ! */ ! static time_t _PyTime_DoubleToTimet(double x) { --- 86,91 ---- static PyObject *moddict; ! /* Exposed in timefuncs.h. */ ! time_t _PyTime_DoubleToTimet(double x) { *************** *** 383,387 **** indexing blindly into some array for a textual representation by some bad index (fixes bug #897625). ! No check for year since handled in gettmarg(). */ --- 381,385 ---- indexing blindly into some array for a textual representation by some bad index (fixes bug #897625). ! No check for year since handled in gettmarg(). */ *************** *** 584,588 **** inittimezone(m); Py_DECREF(m); ! Py_INCREF(Py_None); return Py_None; --- 582,586 ---- inittimezone(m); Py_DECREF(m); ! Py_INCREF(Py_None); return Py_None; From tim_one at users.sourceforge.net Sat Jun 19 22:50:17 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 21 00:52:33 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_datetime.py, 1.47, 1.48 test_time.py, 1.16, 1.17 Message-ID: ot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14933/Lib/test Modified Files: test_datetime.py test_time.py Log Message: Bug 975996: Add _PyTime_DoubleToTimet to C API New include file timefuncs.h exports private API function _PyTime_DoubleToTimet() from timemodule.c. timemodule should export some other functions too (look for painful bits in datetimemodule.c). Added insane-argument checking to datetime's assorted fromtimestamp() and utcfromtimestamp() methods. Added insane-argument tests of these to test_datetime, and insane-argument tests for ctime(), localtime() and gmtime() to test_time. Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** test_datetime.py 7 Jun 2004 23:04:30 -0000 1.47 --- test_datetime.py 20 Jun 2004 02:50:15 -0000 1.48 *************** *** 731,734 **** --- 731,743 ---- self.assertEqual(d.day, day) + def test_insane_fromtimestamp(self): + # It's possible that some platform maps time_t to double, + # and that this test will fail there. This test should + # exempt such platforms (provided they return reasonable + # results!). + for insane in -1e200, 1e200: + self.assertRaises(ValueError, self.theclass.fromtimestamp, + insane) + def test_today(self): import time *************** *** 1381,1384 **** --- 1390,1411 ---- self.verify_field_equality(expected, got) + def test_insane_fromtimestamp(self): + # It's possible that some platform maps time_t to double, + # and that this test will fail there. This test should + # exempt such platforms (provided they return reasonable + # results!). + for insane in -1e200, 1e200: + self.assertRaises(ValueError, self.theclass.fromtimestamp, + insane) + + def test_insane_utcfromtimestamp(self): + # It's possible that some platform maps time_t to double, + # and that this test will fail there. This test should + # exempt such platforms (provided they return reasonable + # results!). + for insane in -1e200, 1e200: + self.assertRaises(ValueError, self.theclass.utcfromtimestamp, + insane) + def test_utcnow(self): import time Index: test_time.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_time.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_time.py 2 Mar 2004 04:38:10 -0000 1.16 --- test_time.py 20 Jun 2004 02:50:15 -0000 1.17 *************** *** 177,180 **** --- 177,188 ---- time.tzset() + def test_insane_timestamps(self): + # It's possible that some platform maps time_t to double, + # and that this test will fail there. This test should + # exempt such platforms (provided they return reasonable + # results!). + for func in time.ctime, time.gmtime, time.localtime: + for unreasonable in -1e200, 1e200: + self.assertRaises(ValueError, func, unreasonable) def test_main(): From tim_one at users.sourceforge.net Sat Jun 19 22:50:18 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 21 00:52:45 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1006,1.1007 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14933/Misc Modified Files: NEWS Log Message: Bug 975996: Add _PyTime_DoubleToTimet to C API New include file timefuncs.h exports private API function _PyTime_DoubleToTimet() from timemodule.c. timemodule should export some other functions too (look for painful bits in datetimemodule.c). Added insane-argument checking to datetime's assorted fromtimestamp() and utcfromtimestamp() methods. Added insane-argument tests of these to test_datetime, and insane-argument tests for ctime(), localtime() and gmtime() to test_time. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1006 retrieving revision 1.1007 diff -C2 -d -r1.1006 -r1.1007 *** NEWS 19 Jun 2004 21:11:34 -0000 1.1006 --- NEWS 20 Jun 2004 02:50:15 -0000 1.1007 *************** *** 229,235 **** ----------------- ! - time module code that deals with time_t timestamps will now raise a ! ValueError if more than a second is lost in precision from time_t being less ! precise than a double. Closes bug #919012. - fcntl.ioctl now warns if the mutate flag is not specified. --- 229,239 ---- ----------------- ! - time module code that deals with input POSIX timestamps will now raise ! ValueError if more than a second is lost in precision when the ! timestamp is cast to the platform C time_t type. There's no chance ! that the platform will do anything sensible with the result in such ! cases. This includes ctime(), localtime() and gmtime(). Assorted ! fromtimestamp() and utcfromtimestamp() methods in the datetime module ! were also protected. Closes bugs #919012 and 975996. - fcntl.ioctl now warns if the mutate flag is not specified. *************** *** 556,559 **** --- 560,568 ---- ----- + - Private function _PyTime_DoubleToTimet added, to convert a Python + timestamp (C double) to platform time_t with some out-of-bounds + checking. Declared in new header file timefuncs.h. It would be + good to expose some other internal timemodule.c functions there. + - New public functions PyEval_EvaluateFrame and PyGen_New to expose generator objects. From rhettinger at users.sourceforge.net Sun Jun 20 00:23:22 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 21 00:54:03 2004 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30600 Modified Files: _csv.c Log Message: Use PyArg_UnpackTuple() where possible. Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** _csv.c 2 Dec 2003 18:57:47 -0000 1.13 --- _csv.c 20 Jun 2004 04:23:19 -0000 1.14 *************** *** 301,305 **** self->strict = 0; ! if (!PyArg_ParseTuple(args, "|O", &dialect)) return -1; Py_XINCREF(dialect); --- 301,305 ---- self->strict = 0; ! if (!PyArg_UnpackTuple(args, "", 0, 1, &dialect)) return -1; Py_XINCREF(dialect); *************** *** 843,847 **** self->state = START_RECORD; ! if (!PyArg_ParseTuple(args, "O|O", &iterator, &dialect)) { Py_DECREF(self); return NULL; --- 843,847 ---- self->state = START_RECORD; ! if (!PyArg_UnpackTuple(args, "", 1, 2, &iterator, &dialect)) { Py_DECREF(self); return NULL; *************** *** 1288,1292 **** self->num_fields = 0; ! if (!PyArg_ParseTuple(args, "O|O", &output_file, &dialect)) { Py_DECREF(self); return NULL; --- 1288,1292 ---- self->num_fields = 0; ! if (!PyArg_UnpackTuple(args, "", 1, 2, &output_file, &dialect)) { Py_DECREF(self); return NULL; *************** *** 1328,1332 **** PyObject *name_obj, *dialect_obj; ! if (!PyArg_ParseTuple(args, "OO", &name_obj, &dialect_obj)) return NULL; if (!PyString_Check(name_obj) --- 1328,1332 ---- PyObject *name_obj, *dialect_obj; ! if (!PyArg_UnpackTuple(args, "", 2, 2, &name_obj, &dialect_obj)) return NULL; if (!PyString_Check(name_obj) From rhettinger at users.sourceforge.net Sun Jun 20 05:07:56 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 21 00:58:35 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libheapq.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18236/Doc/lib Modified Files: libheapq.tex Log Message: Improve the documented advice on how to best use heapq.heapreplace(). Index: libheapq.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libheapq.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libheapq.tex 15 Jun 2004 23:53:34 -0000 1.8 --- libheapq.tex 20 Jun 2004 09:07:53 -0000 1.9 *************** *** 60,64 **** by \function{heappush()}, and can be more appropriate when using a fixed-size heap. Note that the value returned may be larger ! than \var{item}! That constrains reasonable uses of this routine. \end{funcdesc} --- 60,68 ---- by \function{heappush()}, and can be more appropriate when using a fixed-size heap. Note that the value returned may be larger ! than \var{item}! That constrains reasonable uses of this routine ! unless written as part of a larger expression: ! \begin{verbatim} ! result = item <= heap[0] and item or heapreplace(heap, item) ! \end{verbatim} \end{funcdesc} From rhettinger at users.sourceforge.net Sun Jun 20 05:07:56 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 21 00:59:58 2004 Subject: [Python-checkins] python/dist/src/Modules _heapqmodule.c,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18236/Modules Modified Files: _heapqmodule.c Log Message: Improve the documented advice on how to best use heapq.heapreplace(). Index: _heapqmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_heapqmodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _heapqmodule.c 15 Jun 2004 23:53:35 -0000 1.5 --- _heapqmodule.c 20 Jun 2004 09:07:52 -0000 1.6 *************** *** 187,191 **** more appropriate when using a fixed-size heap. Note that the value\n\ returned may be larger than item! That constrains reasonable uses of\n\ ! this routine.\n"); static PyObject * --- 187,192 ---- more appropriate when using a fixed-size heap. Note that the value\n\ returned may be larger than item! That constrains reasonable uses of\n\ ! this routine unless written as part of a larger expression:\n\n\ ! result = item <= heap[0] and item or heapreplace(heap, item)\n"); static PyObject * From svrlshhv at nomade.fr Sun Jun 20 10:32:09 2004 From: svrlshhv at nomade.fr (You're All The World To Me) Date: Mon Jun 21 01:04:50 2004 Subject: [Python-checkins] I Learn From The Best Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040620/9c8bb7e1/attachment.html From yroooe at china-dalian.net Sun Jun 20 12:25:01 2004 From: yroooe at china-dalian.net (Maude Haywood) Date: Mon Jun 21 01:05:56 2004 Subject: [Python-checkins] python-checkins@python.org: be a ceos-with our degree Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040620/6f63bdd4/attachment.html From rhettinger at users.sourceforge.net Sun Jun 20 05:07:56 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 21 01:06:11 2004 Subject: [Python-checkins] python/dist/src/Lib heapq.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18236/Lib Modified Files: heapq.py Log Message: Improve the documented advice on how to best use heapq.heapreplace(). Index: heapq.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/heapq.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** heapq.py 13 Jun 2004 05:26:32 -0000 1.24 --- heapq.py 20 Jun 2004 09:07:52 -0000 1.25 *************** *** 155,159 **** more appropriate when using a fixed-size heap. Note that the value returned may be larger than item! That constrains reasonable uses of ! this routine. """ returnitem = heap[0] # raises appropriate IndexError if heap is empty --- 155,161 ---- more appropriate when using a fixed-size heap. Note that the value returned may be larger than item! That constrains reasonable uses of ! this routine unless written as part of a larger expression: ! ! result = item <= heap[0] and item or heapreplace(heap, item) """ returnitem = heap[0] # raises appropriate IndexError if heap is empty From loewis at users.sourceforge.net Sun Jun 20 16:59:58 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon Jun 21 01:12:21 2004 Subject: [Python-checkins] python/dist/src/Lib compileall.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7987 Modified Files: compileall.py Log Message: Patch #975885: print file name in err msg in quiet mode Index: compileall.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compileall.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** compileall.py 27 Aug 2003 20:19:35 -0000 1.15 --- compileall.py 20 Jun 2004 20:59:56 -0000 1.16 *************** *** 67,70 **** --- 67,72 ---- raise KeyboardInterrupt except py_compile.PyCompileError,err: + if quiet: + print 'Compiling', fullname, '...' print err.msg success = 0 From loewis at users.sourceforge.net Sun Jun 20 17:03:40 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon Jun 21 01:12:24 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.122, 1.831.4.123 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10753/Misc Modified Files: Tag: release23-maint NEWS Log Message: Patch #975885: print file name in err msg in quiet mode. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.122 retrieving revision 1.831.4.123 diff -C2 -d -r1.831.4.122 -r1.831.4.123 *** NEWS 19 Jun 2004 21:39:21 -0000 1.831.4.122 --- NEWS 20 Jun 2004 21:03:36 -0000 1.831.4.123 *************** *** 38,41 **** --- 38,43 ---- ------- + - Patch #975885: Print file name in err msg in quiet mode of compileall.py. + - Bug #919012: shutil.move() raises an exception when you try to move a directory into itself. From loewis at users.sourceforge.net Sun Jun 20 17:03:38 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon Jun 21 01:12:27 2004 Subject: [Python-checkins] python/dist/src/Lib compileall.py, 1.14.12.1, 1.14.12.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10753/Lib Modified Files: Tag: release23-maint compileall.py Log Message: Patch #975885: print file name in err msg in quiet mode. Index: compileall.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compileall.py,v retrieving revision 1.14.12.1 retrieving revision 1.14.12.2 diff -C2 -d -r1.14.12.1 -r1.14.12.2 *** compileall.py 27 Aug 2003 20:21:06 -0000 1.14.12.1 --- compileall.py 20 Jun 2004 21:03:36 -0000 1.14.12.2 *************** *** 67,70 **** --- 67,72 ---- raise KeyboardInterrupt except py_compile.PyCompileError,err: + if quiet: + print 'Compiling', fullname, '...' print err.msg success = 0 From tim_one at users.sourceforge.net Sun Jun 20 18:41:36 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 21 01:13:59 2004 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c, 1.73, 1.74 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18815/Modules Modified Files: datetimemodule.c Log Message: SF patch 876130: add C API to datetime module, from Anthony Tuininga. The LaTeX is untested (well, so is the new API, for that matter). Note that I also changed NULL to get spelled consistently in concrete.tex. If that was a wrong thing to do, Fred should yell at me. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** datetimemodule.c 20 Jun 2004 02:50:16 -0000 1.73 --- datetimemodule.c 20 Jun 2004 22:41:32 -0000 1.74 *************** *** 10,14 **** --- 10,20 ---- #include "timefuncs.h" + + /* Differentiate between building the core module and building extension + * modules. + */ + #define Py_BUILD_CORE #include "datetime.h" + #undef Py_BUILD_CORE /* We require that C int be at least 32 bits, and use int virtually *************** *** 4521,4524 **** --- 4527,4548 ---- }; + /* C API. Clients get at this via PyDateTime_IMPORT, defined in + * datetime.h. + */ + static PyDateTime_CAPI CAPI = { + &PyDateTime_DateType, + &PyDateTime_DateTimeType, + &PyDateTime_TimeType, + &PyDateTime_DeltaType, + &PyDateTime_TZInfoType, + new_date_ex, + new_datetime_ex, + new_time_ex, + new_delta_ex, + datetime_fromtimestamp, + date_fromtimestamp + }; + + PyMODINIT_FUNC initdatetime(void) *************** *** 4634,4637 **** --- 4658,4667 ---- PyModule_AddObject(m, "tzinfo", (PyObject *) &PyDateTime_TZInfoType); + x = PyCObject_FromVoidPtrAndDesc(&CAPI, (void*) DATETIME_API_MAGIC, + NULL); + if (x == NULL) + return; + PyModule_AddObject(m, "datetime_CAPI", x); + /* A 4-year cycle has an extra leap day over what we'd get from * pasting together 4 single years. From tim_one at users.sourceforge.net Sun Jun 20 18:41:57 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 21 01:14:02 2004 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18815/Doc/api Modified Files: concrete.tex Log Message: SF patch 876130: add C API to datetime module, from Anthony Tuininga. The LaTeX is untested (well, so is the new API, for that matter). Note that I also changed NULL to get spelled consistently in concrete.tex. If that was a wrong thing to do, Fred should yell at me. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** concrete.tex 8 Jun 2004 02:58:50 -0000 1.44 --- concrete.tex 20 Jun 2004 22:41:23 -0000 1.45 *************** *** 138,142 **** Return a new \ctype{PyIntObject} or \ctype{PyLongObject} based on the string value in \var{str}, which is interpreted according to the radix in ! \var{base}. If \var{pend} is non-\NULL, \code{*\var{pend}} will point to the first character in \var{str} which follows the representation of the number. If \var{base} is \code{0}, the radix will be determined based on --- 138,142 ---- Return a new \ctype{PyIntObject} or \ctype{PyLongObject} based on the string value in \var{str}, which is interpreted according to the radix in ! \var{base}. If \var{pend} is non-\NULL{}, \code{*\var{pend}} will point to the first character in \var{str} which follows the representation of the number. If \var{base} is \code{0}, the radix will be determined based on *************** *** 249,253 **** Return a new \ctype{PyLongObject} based on the string value in \var{str}, which is interpreted according to the radix in ! \var{base}. If \var{pend} is non-\NULL, \code{*\var{pend}} will point to the first character in \var{str} which follows the representation of the number. If \var{base} is \code{0}, the radix --- 249,253 ---- Return a new \ctype{PyLongObject} based on the string value in \var{str}, which is interpreted according to the radix in ! \var{base}. If \var{pend} is non-\NULL{}, \code{*\var{pend}} will point to the first character in \var{str} which follows the representation of the number. If \var{base} is \code{0}, the radix *************** *** 539,543 **** \begin{cfuncdesc}{PyObject*}{PyString_FromString}{const char *v} Returns a new string object with the value \var{v} on success, and ! \NULL{} on failure. The parameter \var{v} must not be \NULL; it will not be checked. \end{cfuncdesc} --- 539,543 ---- \begin{cfuncdesc}{PyObject*}{PyString_FromString}{const char *v} Returns a new string object with the value \var{v} on success, and ! \NULL{} on failure. The parameter \var{v} must not be \NULL{}; it will not be checked. \end{cfuncdesc} *************** *** 547,551 **** Returns a new string object with the value \var{v} and length \var{len} on success, and \NULL{} on failure. If \var{v} is ! \NULL, the contents of the string are uninitialized. \end{cfuncdesc} --- 547,551 ---- Returns a new string object with the value \var{v} and length \var{len} on success, and \NULL{} on failure. If \var{v} is ! \NULL{}, the contents of the string are uninitialized. \end{cfuncdesc} *************** *** 616,620 **** The function accepts both string and Unicode objects as input. For Unicode objects it returns the default encoded version of the ! object. If \var{length} is \NULL, the resulting buffer may not contain NUL characters; if it does, the function returns \code{-1} and a \exception{TypeError} is raised. --- 616,620 ---- The function accepts both string and Unicode objects as input. For Unicode objects it returns the default encoded version of the ! object. If \var{length} is \NULL{}, the resulting buffer may not contain NUL characters; if it does, the function returns \code{-1} and a \exception{TypeError} is raised. *************** *** 637,641 **** be stolen. If the new string cannot be created, the old reference to \var{string} will still be discarded and the value of ! \var{*string} will be set to \NULL; the appropriate exception will be set. \end{cfuncdesc} --- 637,641 ---- be stolen. If the new string cannot be created, the old reference to \var{string} will still be discarded and the value of ! \var{*string} will be set to \NULL{}; the appropriate exception will be set. \end{cfuncdesc} *************** *** 899,905 **** undefined. It is the user's responsibility to fill in the needed data. The buffer is copied into the new object. If the buffer is ! not \NULL, the return value might be a shared object. Therefore, modification of the resulting Unicode object is only allowed when ! \var{u} is \NULL. \end{cfuncdesc} --- 899,905 ---- undefined. It is the user's responsibility to fill in the needed data. The buffer is copied into the new object. If the buffer is ! not \NULL{}, the return value might be a shared object. Therefore, modification of the resulting Unicode object is only allowed when ! \var{u} is \NULL{}. \end{cfuncdesc} *************** *** 1071,1077 **** Decodes \var{length} bytes from a UTF-16 encoded buffer string and returns the corresponding Unicode object. \var{errors} (if ! non-\NULL) defines the error handling. It defaults to ``strict''. ! If \var{byteorder} is non-\NULL, the decoder starts decoding using the given byte order: --- 1071,1077 ---- Decodes \var{length} bytes from a UTF-16 encoded buffer string and returns the corresponding Unicode object. \var{errors} (if ! non-\NULL{}) defines the error handling. It defaults to ``strict''. ! If \var{byteorder} is non-\NULL{}, the decoder starts decoding using the given byte order: *************** *** 1087,1091 **** byte order at the end of input data. ! If \var{byteorder} is \NULL, the codec starts in native order mode. Returns \NULL{} if an exception was raised by the codec. --- 1087,1091 ---- byte order at the end of input data. ! If \var{byteorder} is \NULL{}, the codec starts in native order mode. Returns \NULL{} if an exception was raised by the codec. *************** *** 1352,1356 **** PyObject *sep, int maxsplit} ! Split a string giving a list of Unicode strings. If sep is \NULL, splitting will be done at all whitespace substrings. Otherwise, splits occur at the given separator. At most \var{maxsplit} splits --- 1352,1356 ---- PyObject *sep, int maxsplit} ! Split a string giving a list of Unicode strings. If sep is \NULL{}, splitting will be done at all whitespace substrings. Otherwise, splits occur at the given separator. At most \var{maxsplit} splits *************** *** 1606,1610 **** pointing to Python objects. \samp{PyTuple_Pack(2, \var{a}, \var{b})} is equivalent to \samp{Py_BuildValue("(OO)", \var{a}, \var{b})}. ! \versionadded{2.4} \end{cfuncdesc} --- 1606,1610 ---- pointing to Python objects. \samp{PyTuple_Pack(2, \var{a}, \var{b})} is equivalent to \samp{Py_BuildValue("(OO)", \var{a}, \var{b})}. ! \versionadded{2.4} \end{cfuncdesc} *************** *** 1662,1666 **** If the object referenced by \code{*\var{p}} is replaced, the original \code{*\var{p}} is destroyed. On failure, returns ! \code{-1} and sets \code{*\var{p}} to \NULL, and raises \exception{MemoryError} or \exception{SystemError}. --- 1662,1666 ---- If the object referenced by \code{*\var{p}} is replaced, the original \code{*\var{p}} is destroyed. On failure, returns ! \code{-1} and sets \code{*\var{p}} to \NULL{}, and raises \exception{MemoryError} or \exception{SystemError}. *************** *** 1842,1846 **** \code{0}. On error, return \code{-1}. This is equivalent to the Python expression \samp{\var{key} in \var{p}}. ! \versionadded{2.4} \end{cfuncdesc} --- 1842,1846 ---- \code{0}. On error, return \code{-1}. This is equivalent to the Python expression \samp{\var{key} in \var{p}}. ! \versionadded{2.4} \end{cfuncdesc} *************** *** 1924,1928 **** parameters \var{pkey} and \var{pvalue} should either point to \ctype{PyObject*} variables that will be filled in with each key and ! value, respectively, or may be \NULL. Any references returned through them are borrowed. \var{ppos} should not be altered during iteration. Its value represents offsets within the internal dictionary structure, --- 1924,1928 ---- parameters \var{pkey} and \var{pvalue} should either point to \ctype{PyObject*} variables that will be filled in with each key and ! value, respectively, or may be \NULL{}. Any references returned through them are borrowed. \var{ppos} should not be altered during iteration. Its value represents offsets within the internal dictionary structure, *************** *** 2041,2045 **** given by \var{filename}, with a file mode given by \var{mode}, where \var{mode} has the same semantics as the standard C routine ! \cfunction{fopen()}\ttindex{fopen()}. On failure, returns \NULL. \end{cfuncdesc} --- 2041,2045 ---- given by \var{filename}, with a file mode given by \var{mode}, where \var{mode} has the same semantics as the standard C routine ! \cfunction{fopen()}\ttindex{fopen()}. On failure, returns \NULL{}. \end{cfuncdesc} *************** *** 2144,2148 **** constructor. \var{class} is the class of new object. The \var{dict} parameter will be used as the object's \member{__dict__}; ! if \NULL, a new dictionary will be created for the instance. \end{cfuncdesc} --- 2144,2148 ---- constructor. \var{class} is the class of new object. The \var{dict} parameter will be used as the object's \member{__dict__}; ! if \NULL{}, a new dictionary will be created for the instance. \end{cfuncdesc} *************** *** 2162,2166 **** \begin{cfuncdesc}{int}{PyMethod_Check}{PyObject *o} Return true if \var{o} is a method object (has type ! \cdata{PyMethod_Type}). The parameter must not be \NULL. \end{cfuncdesc} --- 2162,2166 ---- \begin{cfuncdesc}{int}{PyMethod_Check}{PyObject *o} Return true if \var{o} is a method object (has type ! \cdata{PyMethod_Type}). The parameter must not be \NULL{}. \end{cfuncdesc} *************** *** 2197,2201 **** \begin{cfuncdesc}{PyObject*}{PyMethod_Self}{PyObject *meth} Return the instance associated with the method \var{meth} if it is ! bound, otherwise return \NULL. \end{cfuncdesc} --- 2197,2201 ---- \begin{cfuncdesc}{PyObject*}{PyMethod_Self}{PyObject *meth} Return the instance associated with the method \var{meth} if it is ! bound, otherwise return \NULL{}. \end{cfuncdesc} *************** *** 2261,2265 **** \var{module}'s \member{__file__} attribute. If this is not defined, or if it is not a string, raise \exception{SystemError} and return ! \NULL. \withsubitem{(module attribute)}{\ttindex{__file__}} \withsubitem{(built-in exception)}{\ttindex{SystemError}} --- 2261,2265 ---- \var{module}'s \member{__file__} attribute. If this is not defined, or if it is not a string, raise \exception{SystemError} and return ! \NULL{}. \withsubitem{(module attribute)}{\ttindex{__file__}} \withsubitem{(built-in exception)}{\ttindex{SystemError}} *************** *** 2402,2406 **** \begin{cfuncdesc}{int}{PySlice_Check}{PyObject *ob} Returns true if \var{ob} is a slice object; \var{ob} must not be ! \NULL. \end{cfuncdesc} --- 2402,2406 ---- \begin{cfuncdesc}{int}{PySlice_Check}{PyObject *ob} Returns true if \var{ob} is a slice object; \var{ob} must not be ! \NULL{}. \end{cfuncdesc} *************** *** 2410,2414 **** \var{stop}, and \var{step} parameters are used as the values of the slice object attributes of the same names. Any of the values may be ! \NULL, in which case the \code{None} will be used for the corresponding attribute. Returns \NULL{} if the new object could not be allocated. --- 2410,2414 ---- \var{stop}, and \var{step} parameters are used as the values of the slice object attributes of the same names. Any of the values may be ! \NULL{}, in which case the \code{None} will be used for the corresponding attribute. Returns \NULL{} if the new object could not be allocated. *************** *** 2432,2436 **** \begin{cfuncdesc}{int}{PySlice_GetIndicesEx}{PySliceObject *slice, int length, ! int *start, int *stop, int *step, int *slicelength} Usable replacement for \cfunction{PySlice_GetIndices}. Retrieve the --- 2432,2436 ---- \begin{cfuncdesc}{int}{PySlice_GetIndicesEx}{PySliceObject *slice, int length, ! int *start, int *stop, int *step, int *slicelength} Usable replacement for \cfunction{PySlice_GetIndices}. Retrieve the *************** *** 2476,2482 **** notification when \var{ob} is garbage collected; it should accept a single parameter, which will be the weak reference object itself. ! \var{callback} may also be \code{None} or \NULL. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not ! callable, \code{None}, or \NULL, this will return \NULL{} and raise \exception{TypeError}. \versionadded{2.2} --- 2476,2482 ---- notification when \var{ob} is garbage collected; it should accept a single parameter, which will be the weak reference object itself. ! \var{callback} may also be \code{None} or \NULL{}. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not ! callable, \code{None}, or \NULL{}, this will return \NULL{} and raise \exception{TypeError}. \versionadded{2.2} *************** *** 2491,2497 **** notification when \var{ob} is garbage collected; it should accept a single parameter, which will be the weak reference object itself. ! \var{callback} may also be \code{None} or \NULL. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not callable, ! \code{None}, or \NULL, this will return \NULL{} and raise \exception{TypeError}. \versionadded{2.2} --- 2491,2497 ---- notification when \var{ob} is garbage collected; it should accept a single parameter, which will be the weak reference object itself. ! \var{callback} may also be \code{None} or \NULL{}. If \var{ob} is not a weakly-referencable object, or if \var{callback} is not callable, ! \code{None}, or \NULL{}, this will return \NULL{} and raise \exception{TypeError}. \versionadded{2.2} *************** *** 2536,2540 **** Create a \ctype{PyCObject} from the \code{void *}\var{cobj}. The \var{destr} function will be called when the object is reclaimed, ! unless it is \NULL. \end{cfuncdesc} --- 2536,2540 ---- Create a \ctype{PyCObject} from the \code{void *}\var{cobj}. The \var{destr} function will be called when the object is reclaimed, ! unless it is \NULL{}. \end{cfuncdesc} *************** *** 2558,2562 **** \begin{cfuncdesc}{int}{PyCObject_SetVoidPtr}{PyObject* self, void* cobj} ! Set the void pointer inside \var{self} to \var{cobj}. The \ctype{PyCObject} must not have an associated destructor. Return true on success, false on failure. --- 2558,2562 ---- \begin{cfuncdesc}{int}{PyCObject_SetVoidPtr}{PyObject* self, void* cobj} ! Set the void pointer inside \var{self} to \var{cobj}. The \ctype{PyCObject} must not have an associated destructor. Return true on success, false on failure. *************** *** 2586,2595 **** \begin{cfuncdesc}{int}{PyCell_Check}{ob} Return true if \var{ob} is a cell object; \var{ob} must not be ! \NULL. \end{cfuncdesc} \begin{cfuncdesc}{PyObject*}{PyCell_New}{PyObject *ob} Create and return a new cell object containing the value \var{ob}. ! The parameter may be \NULL. \end{cfuncdesc} --- 2586,2595 ---- \begin{cfuncdesc}{int}{PyCell_Check}{ob} Return true if \var{ob} is a cell object; \var{ob} must not be ! \NULL{}. \end{cfuncdesc} \begin{cfuncdesc}{PyObject*}{PyCell_New}{PyObject *ob} Create and return a new cell object containing the value \var{ob}. ! The parameter may be \NULL{}. \end{cfuncdesc} *************** *** 2606,2610 **** Set the contents of the cell object \var{cell} to \var{value}. This releases the reference to any current content of the cell. ! \var{value} may be \NULL. \var{cell} must be non-\NULL; if it is not a cell object, \code{-1} will be returned. On success, \code{0} will be returned. --- 2606,2610 ---- Set the contents of the cell object \var{cell} to \var{value}. This releases the reference to any current content of the cell. ! \var{value} may be \NULL{}. \var{cell} must be non-\NULL{}; if it is not a cell object, \code{-1} will be returned. On success, \code{0} will be returned. *************** *** 2634,2638 **** \begin{cfuncdesc}{int}{PyGen_Check}{ob} Return true if \var{ob} is a generator object; \var{ob} must not be ! \NULL. \end{cfuncdesc} --- 2634,2638 ---- \begin{cfuncdesc}{int}{PyGen_Check}{ob} Return true if \var{ob} is a generator object; \var{ob} must not be ! \NULL{}. \end{cfuncdesc} *************** *** 2640,2648 **** Return true if \var{ob}'s type is \var{PyGen_Type} is a generator object; \var{ob} must not be ! \NULL. \end{cfuncdesc} \begin{cfuncdesc}{PyObject*}{PyGen_New}{PyFrameObject *frame} Create and return a new generator object based on the \var{frame} object. ! The parameter must not be \NULL. \end{cfuncdesc} --- 2640,2769 ---- Return true if \var{ob}'s type is \var{PyGen_Type} is a generator object; \var{ob} must not be ! \NULL{}. \end{cfuncdesc} \begin{cfuncdesc}{PyObject*}{PyGen_New}{PyFrameObject *frame} Create and return a new generator object based on the \var{frame} object. ! The parameter must not be \NULL{}. ! \end{cfuncdesc} ! ! ! \subsection{DateTime Objects \label{datetime-objects}} ! ! Various date and time objects are supplied by the \module{datetime} ! module. Before using any of these functions, the header file ! \file{datetime.h} must be included in your source (note that this is ! not include by \file{Python.h}), and macro \cfunction{PyDateTime_IMPORT()} ! must be invoked. The macro arranges to put a pointer to a C structure ! in a static variable \code{PyDateTimeAPI}, which is used by the following ! macros: ! ! \begin{cfuncdesc}{int}{PyDate_Check}{ob} ! Return true if \var{ob} is of type \cdata{PyDateTime_DateType} or ! a subtype of \cdata{PyDateTime_DateType}. \var{ob} must not be ! \NULL{}. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyDate_CheckExact}{ob} ! Return true if \var{ob} is of type \cdata{PyDateTime_DateType}. ! \var{ob} must not be \NULL{}. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyDateTime_Check}{ob} ! Return true if \var{ob} is of type \cdata{PyDateTime_DateTimeType} or ! a subtype of \cdata{PyDateTime_DateTimeType}. \var{ob} must not be ! \NULL{}. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyDateTime_CheckExact}{ob} ! Return true if \var{ob} is of type \cdata{PyDateTime_DateTimeType}. ! \var{ob} must not be \NULL{}. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyTime_Check}{ob} ! Return true if \var{ob} is of type \cdata{PyDateTime_TimeType} or ! a subtype of \cdata{PyDateTime_TimeType}. \var{ob} must not be ! \NULL{}. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyTime_CheckExact}{ob} ! Return true if \var{ob} is of type \cdata{PyDateTime_TimeType}. ! \var{ob} must not be \NULL{}. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyDelta_Check}{ob} ! Return true if \var{ob} is of type \cdata{PyDateTime_DeltaType} or ! a subtype of \cdata{PyDateTime_DeltaType}. \var{ob} must not be ! \NULL{}. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyDelta_CheckExact}{ob} ! Return true if \var{ob} is of type \cdata{PyDateTime_DeltaType}. ! \var{ob} must not be \NULL{}. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyTZInfo_Check}{ob} ! Return true if \var{ob} is of type \cdata{PyDateTime_TZInfoType} or ! a subtype of \cdata{PyDateTime_TZInfoType}. \var{ob} must not be ! \NULL{}. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyTZInfo_CheckExact}{ob} ! Return true if \var{ob} is of type \cdata{PyDateTime_TZInfoType}. ! \var{ob} must not be \NULL{}. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{PyObject*}{PyDate_FromDate}{int year, int month, int day} ! Return a \code{datetime.date} object with the specified year, month ! and day. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{PyObject*}{PyDate_FromDateAndTime}{int year, int month, ! int day, int hour, int minute, int second, int usecond} ! Return a \code{datetime.datetime} object with the specified year, month, ! day, hour, minute, second and microsecond. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{PyObject*}{PyTime_FromTime}{int hour, int minute, ! int second, int usecond} ! Return a \code{datetime.time} object with the specified hour, minute, ! second and microsecond. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{PyObject*}{PyDelta_FromDSU}{int days, int seconds, ! int useconds} ! Return a \code{datetime.timedelta} object representing the given number ! of days, seconds and microseconds. Normalization is performed so that ! the resulting number of microseconds and seconds lie in the ranges ! documented for \code{datetime.timedelta} objects. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{PyObject*}{PyDateTime_FromTimestamp}{PyObject *args} ! Create and return a new \code{datetime.datetime} object given an argument ! tuple suitable for passing to \code{datetime.datetime.fromtimestamp()}. ! This macro is included for the convenience of modules implementing the ! DB API. ! \versionadded{2.4} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{PyObject*}{PyDate_FromTimestamp}{PyObject *args} ! Create and return a new \code{datetime.date} object given an argument ! tuple suitable for passing to \code{datetime.date.fromtimestamp()}. ! This macro is included for the convenience of modules implementing the ! DB API. ! \versionadded{2.4} \end{cfuncdesc} From tim_one at users.sourceforge.net Sun Jun 20 18:41:35 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 21 01:14:12 2004 Subject: [Python-checkins] python/dist/src/Misc ACKS, 1.266, 1.267 NEWS, 1.1007, 1.1008 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18815/Misc Modified Files: ACKS NEWS Log Message: SF patch 876130: add C API to datetime module, from Anthony Tuininga. The LaTeX is untested (well, so is the new API, for that matter). Note that I also changed NULL to get spelled consistently in concrete.tex. If that was a wrong thing to do, Fred should yell at me. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.266 retrieving revision 1.267 diff -C2 -d -r1.266 -r1.267 *** ACKS 19 Jun 2004 21:11:34 -0000 1.266 --- ACKS 20 Jun 2004 22:41:32 -0000 1.267 *************** *** 570,573 **** --- 570,574 ---- John Tromp Jason Trowbridge + Anthony Tuininga Stephen Turner Bill Tutt Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1007 retrieving revision 1.1008 diff -C2 -d -r1.1007 -r1.1008 *** NEWS 20 Jun 2004 02:50:15 -0000 1.1007 --- NEWS 20 Jun 2004 22:41:32 -0000 1.1008 *************** *** 560,563 **** --- 560,567 ---- ----- + - Thanks to Anthony Tuininga, the datetime module now supplies a C API + containing type-check macros and constructors. See new docs in the + Python/C API Reference Manual for details. + - Private function _PyTime_DoubleToTimet added, to convert a Python timestamp (C double) to platform time_t with some out-of-bounds From tim_one at users.sourceforge.net Sun Jun 20 18:41:34 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Jun 21 01:14:16 2004 Subject: [Python-checkins] python/dist/src/Include datetime.h,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18815/Include Modified Files: datetime.h Log Message: SF patch 876130: add C API to datetime module, from Anthony Tuininga. The LaTeX is untested (well, so is the new API, for that matter). Note that I also changed NULL to get spelled consistently in concrete.tex. If that was a wrong thing to do, Fred should yell at me. Index: datetime.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/datetime.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** datetime.h 11 Jan 2003 03:39:11 -0000 1.4 --- datetime.h 20 Jun 2004 22:41:24 -0000 1.5 *************** *** 4,7 **** --- 4,10 ---- #ifndef DATETIME_H #define DATETIME_H + #ifdef __cplusplus + extern "C" { + #endif /* Fields are packed into successive bytes, each viewed as unsigned and *************** *** 133,136 **** --- 136,169 ---- ((PyDateTime_Time*)o)->data[5]) + + /* Define structure for C API. */ + typedef struct { + /* type objects */ + PyTypeObject *DateType; + PyTypeObject *DateTimeType; + PyTypeObject *TimeType; + PyTypeObject *DeltaType; + PyTypeObject *TZInfoType; + + /* constructors */ + PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*); + PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int, + PyObject*, PyTypeObject*); + PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*); + PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*); + + /* constructors for the DB API */ + PyObject *(*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*); + PyObject *(*Date_FromTimestamp)(PyObject*, PyObject*); + + } PyDateTime_CAPI; + + + /* "magic" constant used to partially protect against developer mistakes. */ + #define DATETIME_API_MAGIC 0x414548d5 + + #ifdef Py_BUILD_CORE + + /* Macros for type checking when building the Python core. */ #define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType) #define PyDate_CheckExact(op) ((op)->ob_type == &PyDateTime_DateType) *************** *** 148,150 **** --- 181,245 ---- #define PyTZInfo_CheckExact(op) ((op)->ob_type == &PyDateTime_TZInfoType) + #else + + /* Define global variable for the C API and a macro for setting it. */ + static PyDateTime_CAPI *PyDateTimeAPI; + + #define PyDateTime_IMPORT \ + PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import("datetime", \ + "datetime_CAPI") + + /* This macro would be used if PyCObject_ImportEx() was created. + #define PyDateTime_IMPORT \ + PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_ImportEx("datetime", \ + "datetime_CAPI", \ + DATETIME_API_MAGIC) + */ + + /* Macros for type checking when not building the Python core. */ + #define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType) + #define PyDate_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->DateType) + + #define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType) + #define PyDateTime_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->DateTimeType) + + #define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType) + #define PyTime_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->TimeType) + + #define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType) + #define PyDelta_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->DeltaType) + + #define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType) + #define PyTZInfo_CheckExact(op) ((op)->ob_type == PyDateTimeAPI->TZInfoType) + + /* Macros for accessing constructors in a simplified fashion. */ + #define PyDate_FromDate(year, month, day) \ + PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType) + + #define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \ + PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \ + min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType) + + #define PyTime_FromTime(hour, minute, second, usecond) \ + PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \ + Py_None, PyDateTimeAPI->TimeType) + + #define PyDelta_FromDSU(days, seconds, useconds) \ + PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, + PyDateTimeAPI->DeltaType) + + /* Macros supporting the DB API. */ + #define PyDateTime_FromTimestamp(args) \ + PyDateTimeAPI->DateTime_FromTimestamp( \ + (PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL) + + #define PyDate_FromTimestamp(args) \ + PyDateTimeAPI->Date_FromTimestamp( \ + (PyObject*) (PyDateTimeAPI->DateType), args) + + #endif /* Py_BUILD_CORE */ + + #ifdef __cplusplus + } + #endif #endif From fdrake at users.sourceforge.net Mon Jun 21 12:15:25 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Jun 21 12:16:15 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/tests test_build_scripts.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16468 Added Files: test_build_scripts.py Log Message: add a couple of tests for the build_scripts command --- NEW FILE: test_build_scripts.py --- """Tests for distutils.command.build_scripts.""" import os import unittest from distutils.command.build_scripts import build_scripts from distutils.core import Distribution from distutils.tests import support class BuildScriptsTestCase(support.TempdirManager, unittest.TestCase): def test_default_settings(self): cmd = self.get_build_scripts_cmd("/foo/bar", []) self.assert_(not cmd.force) self.assert_(cmd.build_dir is None) cmd.finalize_options() self.assert_(cmd.force) self.assertEqual(cmd.build_dir, "/foo/bar") def test_build(self): source = self.mkdtemp() target = self.mkdtemp() expected = self.write_sample_scripts(source) cmd = self.get_build_scripts_cmd(target, [os.path.join(source, fn) for fn in expected]) cmd.finalize_options() cmd.run() built = os.listdir(target) for name in expected: self.assert_(name in built) def get_build_scripts_cmd(self, target, scripts): dist = Distribution() dist.scripts = scripts dist.command_obj["build"] = support.DummyCommand( build_scripts=target, force=1 ) return build_scripts(dist) def write_sample_scripts(self, dir): expected = [] expected.append("script1.py") self.write_script(dir, "script1.py", ("#! /usr/bin/env python2.3\n" "# bogus script w/ Python sh-bang\n" "pass\n")) expected.append("script2.py") self.write_script(dir, "script2.py", ("#!/usr/bin/python\n" "# bogus script w/ Python sh-bang\n" "pass\n")) expected.append("shell.sh") self.write_script(dir, "shell.sh", ("#!/bin/sh\n" "# bogus shell script w/ sh-bang\n" "exit 0\n")) return expected def write_script(self, dir, name, text): f = open(os.path.join(dir, name), "w") f.write(text) f.close() def test_suite(): return unittest.makeSuite(BuildScriptsTestCase) From rhettinger at users.sourceforge.net Mon Jun 21 12:31:46 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 21 13:41:19 2004 Subject: [Python-checkins] python/dist/src/Lib opcode.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26471/Lib Modified Files: opcode.py Log Message: Install two code generation optimizations that depend on NOP. Reduces the cost of "not" to almost zero. Index: opcode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/opcode.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** opcode.py 7 Mar 2004 07:31:05 -0000 1.5 --- opcode.py 21 Jun 2004 16:31:13 -0000 1.6 *************** *** 50,53 **** --- 50,54 ---- def_op('ROT_FOUR', 5) + def_op('NOP', 9) def_op('UNARY_POSITIVE', 10) def_op('UNARY_NEGATIVE', 11) From rhettinger at users.sourceforge.net Mon Jun 21 12:31:19 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 21 14:47:00 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c, 2.400, 2.401 compile.c, 2.303, 2.304 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26471/Python Modified Files: ceval.c compile.c Log Message: Install two code generation optimizations that depend on NOP. Reduces the cost of "not" to almost zero. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.400 retrieving revision 2.401 diff -C2 -d -r2.400 -r2.401 *** ceval.c 17 Jun 2004 10:22:40 -0000 2.400 --- ceval.c 21 Jun 2004 16:31:14 -0000 2.401 *************** *** 850,853 **** --- 850,856 ---- /* case STOP_CODE: this is an error! */ + case NOP: + goto fast_next_opcode; + case LOAD_FAST: x = GETLOCAL(oparg); Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.303 retrieving revision 2.304 diff -C2 -d -r2.303 -r2.304 *** compile.c 8 Jun 2004 18:52:54 -0000 2.303 --- compile.c 21 Jun 2004 16:31:15 -0000 2.304 *************** *** 393,396 **** --- 393,423 ---- switch (opcode) { + /* Replace UNARY_NOT JUMP_IF_FALSE with NOP JUMP_IF_TRUE */ + case UNARY_NOT: + if (codestr[i+1] != JUMP_IF_FALSE || + codestr[i+4] != POP_TOP || + !ISBASICBLOCK(blocks,i,5)) + continue; + tgt = GETJUMPTGT(codestr, (i+1)); + if (codestr[tgt] != POP_TOP) + continue; + codestr[i] = NOP; + codestr[i+1] = JUMP_IF_TRUE; + break; + + /* not a is b --> a is not b + not a in b --> a not in b + not a is not b --> a is b + not a not in b --> a in b */ + case COMPARE_OP: + j = GETARG(codestr, i); + if (j < 6 || j > 9 || + codestr[i+3] != UNARY_NOT || + !ISBASICBLOCK(blocks,i,4)) + continue; + SETARG(codestr, i, (j^1)); + codestr[i+3] = NOP; + break; + /* Skip over LOAD_CONST trueconst JUMP_IF_FALSE xx POP_TOP. Note, only the first opcode is changed, the others still *************** *** 419,424 **** codestr[i+1] = JUMP_FORWARD; SETARG(codestr, i+1, 2); ! codestr[i+4] = DUP_TOP; /* Filler codes used as NOPs */ ! codestr[i+5] = POP_TOP; continue; } --- 446,451 ---- codestr[i+1] = JUMP_FORWARD; SETARG(codestr, i+1, 2); ! codestr[i+4] = NOP; ! codestr[i+5] = NOP; continue; } *************** *** 429,433 **** codestr[i+2] = JUMP_FORWARD; SETARG(codestr, i+2, 1); ! codestr[i+5] = DUP_TOP; } break; --- 456,460 ---- codestr[i+2] = JUMP_FORWARD; SETARG(codestr, i+2, 1); ! codestr[i+5] = NOP; } break; From rhettinger at users.sourceforge.net Mon Jun 21 12:31:19 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 21 15:09:37 2004 Subject: [Python-checkins] python/dist/src/Include opcode.h,2.44,2.45 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26471/Include Modified Files: opcode.h Log Message: Install two code generation optimizations that depend on NOP. Reduces the cost of "not" to almost zero. Index: opcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/opcode.h,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -d -r2.44 -r2.45 *** opcode.h 7 Mar 2004 07:31:05 -0000 2.44 --- opcode.h 21 Jun 2004 16:31:15 -0000 2.45 *************** *** 14,17 **** --- 14,18 ---- #define DUP_TOP 4 #define ROT_FOUR 5 + #define NOP 9 #define UNARY_POSITIVE 10 From facundobatista at users.sourceforge.net Mon Jun 21 17:50:53 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Mon Jun 21 17:51:15 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.20, 1.21 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30989 Modified Files: Decimal.py Log Message: Lots of name changes. New methods. Several fixes. Complies with updated Cowlishaw test cases. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Decimal.py 20 Jun 2004 01:54:59 -0000 1.20 --- Decimal.py 21 Jun 2004 21:50:51 -0000 1.21 *************** *** 22,40 **** >>> from Decimal import * >>> Decimal(0) ! Decimal( (0, (0,), 0L) ) >>> Decimal("1") ! Decimal( (0, (1,), 0L) ) >>> Decimal("-.0123") ! Decimal( (1, (1, 2, 3), -4L) ) ! >>> Decimal("1.20") ! Decimal( (0, (1, 2, 0), -2L) ) ! >>> str(Decimal(123456789012345678901234567890L)) [...1812 lines suppressed...] #Used in SetDefaultContext --- 2499,2503 ---- DEFAULT_FLAGS.copy(), DEFAULT_ROUNDING_DECISION, DEFAULT_MIN_EXPONENT, DEFAULT_MAX_EXPONENT, ! CAPITALS, CLAMP, IGNORED_FLAGS) #Used in SetDefaultContext *************** *** 2574,2578 **** 'DEFAULT_FLAGS' : 'flags', 'DEFAULT_ROUNDING' : 'rounding', ! 'DEFAULT_ROUNDING_DECISION' : 'rounding_decision', 'DEFAULT_MIN_EXPONENT' : 'Emin', 'DEFAULT_MAX_EXPONENT' : 'Emax'} --- 2506,2510 ---- 'DEFAULT_FLAGS' : 'flags', 'DEFAULT_ROUNDING' : 'rounding', ! 'DEFAULT_ROUNDING_DECISION' : '_rounding_decision', 'DEFAULT_MIN_EXPONENT' : 'Emin', 'DEFAULT_MAX_EXPONENT' : 'Emax'} From facundobatista at users.sourceforge.net Mon Jun 21 17:52:54 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Mon Jun 21 18:28:44 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal test_Decimal.py, 1.17, 1.18 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv685 Modified Files: test_Decimal.py Log Message: New test cases. Several fixes. Using updated Cowlishaw test cases. Deprecated test cases for deprecated functionality. Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_Decimal.py 20 Jun 2004 01:56:04 -0000 1.17 --- test_Decimal.py 21 Jun 2004 21:52:52 -0000 1.18 *************** *** 15,49 **** """ ! # 0.1.8 2003.06.19 fb: Adjusted threading test case. Taken out the immutability # test. Added tearDown method to DecimalTest class. Some fixes # because of the name changes. ! # 0.1.7 2003.04.05 fb: Adjusted several test cases. Eliminated interaction # with float in comparations and min/max test cases. ! # 0.1.6 2003.04.04 fb: Extended explicit construction test case from tuples. ! # 0.1.5 2003.04.02 fb: Adjusted explicit construction test cases. ! # 0.1.4 2003.03.28 fb: Added Use of Context and Decimal Usability test cases. # Corrected tests using try/except/else. ! # 0.1.3 2003.03.23 fb: Added arithmetic operators test and corrected minor # method case issues. ! # 0.1.2 2003.03.20 fb: Added from_float to explicit construction test cases # and all implicit construction test cases. Also upgraded # method names to new GvR definiton. ! # 0.1.1 2003.03.11 fb: Added Explicit Construction tests ! # 0.1.0 2003.03.11 fb: Placed the structure to run separate test groups # # fb = facundobatista - # ToDo: - # - # Add the behaviour tests according to the PEP - from __future__ import division import unittest import glob - from Decimal import * - import os, sys from test.test_support import TestSkipped, run_unittest --- 15,49 ---- """ ! # 0.2.0 2004.06.21 fb: Using the new test cases from Cowlishaw. Deprecated trim ! # test case and use of result in inexact test case. Added ! # as_tuple() test case. ! # 0.1.9 2004.06.20 fb: More fixes because of the name changes. Added test case for ! # context.create_decimal(). ! # 0.1.8 2004.06.19 fb: Adjusted threading test case. Taken out the immutability # test. Added tearDown method to DecimalTest class. Some fixes # because of the name changes. ! # 0.1.7 2004.04.05 fb: Adjusted several test cases. Eliminated interaction # with float in comparations and min/max test cases. ! # 0.1.6 2004.04.04 fb: Extended explicit construction test case from tuples. ! # 0.1.5 2004.04.02 fb: Adjusted explicit construction test cases. ! # 0.1.4 2004.03.28 fb: Added Use of Context and Decimal Usability test cases. # Corrected tests using try/except/else. ! # 0.1.3 2004.03.23 fb: Added arithmetic operators test and corrected minor # method case issues. ! # 0.1.2 2004.03.20 fb: Added from_float to explicit construction test cases # and all implicit construction test cases. Also upgraded # method names to new GvR definiton. ! # 0.1.1 2004.03.11 fb: Added Explicit Construction tests ! # 0.1.0 2004.03.11 fb: Placed the structure to run separate test groups # # fb = facundobatista from __future__ import division import unittest import glob import os, sys + from Decimal import * from test.test_support import TestSkipped, run_unittest *************** *** 67,71 **** 'division_undefined' : DivisionUndefined, 'inexact' : Inexact, - 'insufficient_storage' : InsufficientStorage, 'invalid_context' : InvalidContext, 'invalid_operation' : InvalidOperation, --- 67,70 ---- *************** *** 77,81 **** - def Nonfunction(*args): """Doesn't do anything.""" --- 76,79 ---- *************** *** 98,101 **** --- 96,101 ---- 'remaindernear':'remainder_near', 'divideint':'divide_int', + 'squareroot':'sqrt', + 'apply':'_apply', } *************** *** 108,112 **** global dir self.context = Context() - #self.filelist = glob.glob(dir+'*.decTest') for key in DefaultContext.trap_enablers.keys(): DefaultContext.trap_enablers[key] = 1 --- 108,111 ---- *************** *** 198,206 **** val = val.replace('SingleQuote', "'").replace('DoubleQuote', '"') return val ! funct = nameAdapter.get(funct, funct) ! fname = funct ! funct = getattr(self.context, funct) if fname == 'rescale': return vals = [] conglomerate = '' --- 197,204 ---- val = val.replace('SingleQuote', "'").replace('DoubleQuote', '"') return val ! fname = nameAdapter.get(funct, funct) if fname == 'rescale': return + funct = getattr(self.context, fname) vals = [] conglomerate = '' *************** *** 227,231 **** self.context.trap_enablers[error] = 1 try: ! funct(self.context.new(v)) except error: pass --- 225,229 ---- self.context.trap_enablers[error] = 1 try: ! funct(self.context.create_decimal(v)) except error: pass *************** *** 236,245 **** self.fail("Did not raise %s in %s" % (error, s)) self.context.trap_enablers[error] = 0 ! v = self.context.new(v) ! #elif fname == 'rescale' and i == 1: ! # try: ! # v = int(Decimal(v)) ! # except ValueError: ! # v = float(v) else: v = Decimal(v) --- 234,238 ---- self.fail("Did not raise %s in %s" % (error, s)) self.context.trap_enablers[error] = 0 ! v = self.context.create_decimal(v) else: v = Decimal(v) *************** *** 285,289 **** def getexceptions(self): - return self.context.all_flags() L = [] for exception in ExceptionList: --- 278,281 ---- *************** *** 305,309 **** self.context.Emax = exp def change_clamp(self, clamp): ! self.context.clamp = clamp def test_abs(self): --- 297,301 ---- self.context.Emax = exp def change_clamp(self, clamp): ! self.context._clamp = clamp def test_abs(self): *************** *** 482,492 **** self.eval_file(dir + 'tointegral' + '.decTest') - def test_trim(self): - """Tests the Decimal class on Cowlishaw's trim tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ - self.eval_file(dir + 'trim' + '.decTest') - # # The following classes test the behaviour of Decimal according to PEP 327 --- 474,477 ---- *************** *** 647,650 **** --- 632,676 ---- self.assertNotEqual(id(d), id(e)) + def test_context_create_decimal(self): + '''Explicit construction through context.create_decimal().''' + nc = copy.copy(getcontext()) + nc.prec = 3 + + # empty + self.assertRaises(TypeError, nc.create_decimal) + + # from None + self.assertRaises(TypeError, nc.create_decimal, None) + + # from int + d = nc.create_decimal(456) + self.failUnless(isinstance(d, Decimal)) + self.assertRaises(ValueError, nc.create_decimal, 45678) + + # from string + d = Decimal('456789') + self.assertEqual(str(d), '456789') + d = nc.create_decimal('456789') + self.assertEqual(str(d), '4.57E+5') + + # from float + d = Decimal.from_float(1.1) + self.assertEqual(str(d), '1.100000000000000088817841970012523233890533447265625') + d = nc.create_decimal(1.1) + self.assertEqual(str(d), '1.10') + + # from tuples + d = Decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) + self.assertEqual(str(d), '-4.34913534E-17') + d = nc.create_decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) + self.assertEqual(str(d), '-4.35E-17') + + # from Decimal + prevdec = Decimal(500000123) + d = Decimal(prevdec) + self.assertEqual(str(d), '500000123') + d = nc.create_decimal(prevdec) + self.assertEqual(str(d), '5.00E+8') + class DecimalImplicitConstructionTest(unittest.TestCase): *************** *** 1106,1110 **** #repr ! self.assertEqual(repr(d), 'Decimal( (0, (1, 5, 3, 2), -2) )') def test_tonum_methods(self): --- 1132,1136 ---- #repr ! self.assertEqual(repr(d), 'Decimal("15.32")') def test_tonum_methods(self): *************** *** 1144,1147 **** --- 1170,1193 ---- d = Decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) self.assertEqual(d, eval(repr(d))) + + def test_as_tuple(self): + '''Test as_tuple to show the internals.''' + + #with zero + d = Decimal(0) + self.assertEqual(d.as_tuple(), (0, (0,), 0) ) + + #int + d = Decimal(-45) + self.assertEqual(d.as_tuple(), (1, (4, 5), 0) ) + + #complicated string + d = Decimal("-4.34913534E-17") + self.assertEqual(d.as_tuple(), (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) + + #inf + d = Decimal("Infinity") + self.assertEqual(d.as_tuple(), (0, (0,), 'F') ) + ## ## As is impossible to make a real immutable instance in Python, From facundobatista at users.sourceforge.net Mon Jun 21 17:48:34 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Mon Jun 21 22:58:52 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal/tests abs.decTest, 1.5, 1.6 add.decTest, 1.5, 1.6 base.decTest, 1.5, 1.6 clamp.decTest, 1.5, 1.6 compare.decTest, 1.5, 1.6 divide.decTest, 1.5, 1.6 divideint.decTest, 1.5, 1.6 inexact.decTest, 1.5, 1.6 max.decTest, 1.5, 1.6 min.decTest, 1.5, 1.6 minus.decTest, 1.5, 1.6 multiply.decTest, 1.5, 1.6 normalize.decTest, 1.5, 1.6 plus.decTest, 1.5, 1.6 power.decTest, 1.5, 1.6 quantize.decTest, 1.3, 1.4 randomBound32.decTest, 1.5, 1.6 randoms.decTest, 1.6, 1.7 remainder.decTest, 1.5, 1.6 remainderNear.decTest, 1.5, 1.6 rounding.decTest, 1.5, 1.6 samequantum.decTest, 1.1, 1.2 squareroot.decTest, 1.5, 1.6 subtract.decTest, 1.5, 1.6 tointegral.decTest, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24685 Modified Files: abs.decTest add.decTest base.decTest clamp.decTest compare.decTest divide.decTest divideint.decTest inexact.decTest max.decTest min.decTest minus.decTest multiply.decTest normalize.decTest plus.decTest power.decTest quantize.decTest randomBound32.decTest randoms.decTest remainder.decTest remainderNear.decTest rounding.decTest samequantum.decTest squareroot.decTest subtract.decTest tointegral.decTest Log Message: Updated test cases from Cowlishaw. Index: abs.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/abs.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** abs.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- abs.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,161 **** ! ------------------------------------------------------------------------ ! -- abs.decTest -- decimal absolute value -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.35 ! ! -- This set of tests primarily tests the existence of the operator. ! -- Additon, subtraction, rounding, and more overflows are tested ! -- elsewhere. ! ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! extended: 1 ! ! absx001 abs '1' -> '1' ! absx002 abs '-1' -> '1' ! absx003 abs '1.00' -> '1.00' ! absx004 abs '-1.00' -> '1.00' ! absx005 abs '0' -> '0' ! absx006 abs '0.00' -> '0.00' ! absx007 abs '00.0' -> '0.0' ! absx008 abs '00.00' -> '0.00' ! absx009 abs '00' -> '0' ! ! absx010 abs '-2' -> '2' ! absx011 abs '2' -> '2' ! absx012 abs '-2.00' -> '2.00' ! absx013 abs '2.00' -> '2.00' ! absx014 abs '-0' -> '0' ! absx015 abs '-0.00' -> '0.00' ! absx016 abs '-00.0' -> '0.0' ! absx017 abs '-00.00' -> '0.00' ! absx018 abs '-00' -> '0' ! ! absx020 abs '-2000000' -> '2000000' ! absx021 abs '2000000' -> '2000000' ! precision: 7 ! absx022 abs '-2000000' -> '2000000' ! absx023 abs '2000000' -> '2000000' ! precision: 6 ! absx024 abs '-2000000' -> '2.00000E+6' Rounded ! absx025 abs '2000000' -> '2.00000E+6' Rounded ! precision: 3 ! absx026 abs '-2000000' -> '2.00E+6' Rounded ! absx027 abs '2000000' -> '2.00E+6' Rounded ! ! absx030 abs '+0.1' -> '0.1' ! absx031 abs '-0.1' -> '0.1' ! absx032 abs '+0.01' -> '0.01' ! absx033 abs '-0.01' -> '0.01' ! absx034 abs '+0.001' -> '0.001' ! absx035 abs '-0.001' -> '0.001' ! absx036 abs '+0.000001' -> '0.000001' ! absx037 abs '-0.000001' -> '0.000001' ! absx038 abs '+0.000000000001' -> '1E-12' ! absx039 abs '-0.000000000001' -> '1E-12' ! ! -- examples from decArith ! precision: 9 ! absx040 abs '2.1' -> '2.1' ! absx041 abs '-100' -> '100' ! absx042 abs '101.5' -> '101.5' ! absx043 abs '-101.5' -> '101.5' ! ! -- more fixed, potential LHS swaps/overlays if done by subtract 0 ! precision: 9 ! absx060 abs '-56267E-10' -> '0.0000056267' ! absx061 abs '-56267E-5' -> '0.56267' ! absx062 abs '-56267E-2' -> '562.67' ! absx063 abs '-56267E-1' -> '5626.7' ! absx065 abs '-56267E-0' -> '56267' ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! absx120 abs 9.999E+999999999 -> Infinity Inexact Overflow Rounded ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! absx210 abs 1.00E-999 -> 1.00E-999 ! absx211 abs 0.1E-999 -> 1E-1000 Subnormal ! absx212 abs 0.10E-999 -> 1.0E-1000 Subnormal ! absx213 abs 0.100E-999 -> 1.0E-1000 Subnormal Rounded ! absx214 abs 0.01E-999 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! absx215 abs 0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow ! absx216 abs 0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow ! absx217 abs 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow ! absx218 abs 0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! absx219 abs 0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! absx220 abs 0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! ! absx230 abs -1.00E-999 -> 1.00E-999 ! absx231 abs -0.1E-999 -> 1E-1000 Subnormal ! absx232 abs -0.10E-999 -> 1.0E-1000 Subnormal ! absx233 abs -0.100E-999 -> 1.0E-1000 Subnormal Rounded ! absx234 abs -0.01E-999 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! absx235 abs -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow ! absx236 abs -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow ! absx237 abs -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow ! absx238 abs -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! absx239 abs -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! absx240 abs -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! ! -- long operand tests ! maxexponent: 999 ! minexponent: -999 ! precision: 9 ! absx301 abs 12345678000 -> 1.23456780E+10 Rounded ! absx302 abs 1234567800 -> 1.23456780E+9 Rounded ! absx303 abs 1234567890 -> 1.23456789E+9 Rounded ! absx304 abs 1234567891 -> 1.23456789E+9 Inexact Rounded ! absx305 abs 12345678901 -> 1.23456789E+10 Inexact Rounded ! absx306 abs 1234567896 -> 1.23456790E+9 Inexact Rounded ! ! precision: 15 ! absx321 abs 12345678000 -> 12345678000 ! absx322 abs 1234567800 -> 1234567800 ! absx323 abs 1234567890 -> 1234567890 ! absx324 abs 1234567891 -> 1234567891 ! absx325 abs 12345678901 -> 12345678901 ! absx326 abs 1234567896 -> 1234567896 ! ! ! -- Specials ! precision: 9 ! ! -- specials ! absx520 abs 'Inf' -> 'Infinity' ! absx521 abs '-Inf' -> 'Infinity' ! absx522 abs NaN -> NaN ! absx523 abs sNaN -> NaN Invalid_operation ! absx524 abs NaN22 -> NaN22 ! absx525 abs sNaN33 -> NaN33 Invalid_operation ! absx526 abs -NaN22 -> -NaN22 ! absx527 abs -sNaN33 -> -NaN33 Invalid_operation ! ! -- Null tests ! absx900 abs # -> NaN Invalid_operation ! --- 1,161 ---- ! ------------------------------------------------------------------------ ! -- abs.decTest -- decimal absolute value -- ! -- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.38 ! ! -- This set of tests primarily tests the existence of the operator. ! -- Additon, subtraction, rounding, and more overflows are tested ! -- elsewhere. ! ! precision: 9 ! rounding: half_up ! maxExponent: 384 ! minexponent: -383 ! extended: 1 ! ! absx001 abs '1' -> '1' ! absx002 abs '-1' -> '1' ! absx003 abs '1.00' -> '1.00' ! absx004 abs '-1.00' -> '1.00' ! absx005 abs '0' -> '0' ! absx006 abs '0.00' -> '0.00' ! absx007 abs '00.0' -> '0.0' ! absx008 abs '00.00' -> '0.00' ! absx009 abs '00' -> '0' ! ! absx010 abs '-2' -> '2' ! absx011 abs '2' -> '2' ! absx012 abs '-2.00' -> '2.00' ! absx013 abs '2.00' -> '2.00' ! absx014 abs '-0' -> '0' ! absx015 abs '-0.00' -> '0.00' ! absx016 abs '-00.0' -> '0.0' ! absx017 abs '-00.00' -> '0.00' ! absx018 abs '-00' -> '0' ! ! absx020 abs '-2000000' -> '2000000' ! absx021 abs '2000000' -> '2000000' ! precision: 7 ! absx022 abs '-2000000' -> '2000000' ! absx023 abs '2000000' -> '2000000' ! precision: 6 ! absx024 abs '-2000000' -> '2.00000E+6' Rounded ! absx025 abs '2000000' -> '2.00000E+6' Rounded ! precision: 3 ! absx026 abs '-2000000' -> '2.00E+6' Rounded ! absx027 abs '2000000' -> '2.00E+6' Rounded ! ! absx030 abs '+0.1' -> '0.1' ! absx031 abs '-0.1' -> '0.1' ! absx032 abs '+0.01' -> '0.01' ! absx033 abs '-0.01' -> '0.01' ! absx034 abs '+0.001' -> '0.001' ! absx035 abs '-0.001' -> '0.001' ! absx036 abs '+0.000001' -> '0.000001' ! absx037 abs '-0.000001' -> '0.000001' ! absx038 abs '+0.000000000001' -> '1E-12' ! absx039 abs '-0.000000000001' -> '1E-12' ! ! -- examples from decArith ! precision: 9 ! absx040 abs '2.1' -> '2.1' ! absx041 abs '-100' -> '100' ! absx042 abs '101.5' -> '101.5' ! absx043 abs '-101.5' -> '101.5' ! ! -- more fixed, potential LHS swaps/overlays if done by subtract 0 ! precision: 9 ! absx060 abs '-56267E-10' -> '0.0000056267' ! absx061 abs '-56267E-5' -> '0.56267' ! absx062 abs '-56267E-2' -> '562.67' ! absx063 abs '-56267E-1' -> '5626.7' ! absx065 abs '-56267E-0' -> '56267' ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! absx120 abs 9.999E+999999999 -> Infinity Inexact Overflow Rounded ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! absx210 abs 1.00E-999 -> 1.00E-999 ! absx211 abs 0.1E-999 -> 1E-1000 Subnormal ! absx212 abs 0.10E-999 -> 1.0E-1000 Subnormal ! absx213 abs 0.100E-999 -> 1.0E-1000 Subnormal Rounded ! absx214 abs 0.01E-999 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! absx215 abs 0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow ! absx216 abs 0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow ! absx217 abs 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow ! absx218 abs 0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! absx219 abs 0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! absx220 abs 0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! ! absx230 abs -1.00E-999 -> 1.00E-999 ! absx231 abs -0.1E-999 -> 1E-1000 Subnormal ! absx232 abs -0.10E-999 -> 1.0E-1000 Subnormal ! absx233 abs -0.100E-999 -> 1.0E-1000 Subnormal Rounded ! absx234 abs -0.01E-999 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! absx235 abs -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow ! absx236 abs -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow ! absx237 abs -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow ! absx238 abs -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! absx239 abs -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! absx240 abs -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! ! -- long operand tests ! maxexponent: 999 ! minexponent: -999 ! precision: 9 ! absx301 abs 12345678000 -> 1.23456780E+10 Rounded ! absx302 abs 1234567800 -> 1.23456780E+9 Rounded ! absx303 abs 1234567890 -> 1.23456789E+9 Rounded ! absx304 abs 1234567891 -> 1.23456789E+9 Inexact Rounded ! absx305 abs 12345678901 -> 1.23456789E+10 Inexact Rounded ! absx306 abs 1234567896 -> 1.23456790E+9 Inexact Rounded ! ! precision: 15 ! absx321 abs 12345678000 -> 12345678000 ! absx322 abs 1234567800 -> 1234567800 ! absx323 abs 1234567890 -> 1234567890 ! absx324 abs 1234567891 -> 1234567891 ! absx325 abs 12345678901 -> 12345678901 ! absx326 abs 1234567896 -> 1234567896 ! ! ! -- Specials ! precision: 9 ! ! -- specials ! absx520 abs 'Inf' -> 'Infinity' ! absx521 abs '-Inf' -> 'Infinity' ! absx522 abs NaN -> NaN ! absx523 abs sNaN -> NaN Invalid_operation ! absx524 abs NaN22 -> NaN22 ! absx525 abs sNaN33 -> NaN33 Invalid_operation ! absx526 abs -NaN22 -> -NaN22 ! absx527 abs -sNaN33 -> -NaN33 Invalid_operation ! ! -- Null tests ! absx900 abs # -> NaN Invalid_operation ! Index: add.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/add.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** add.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- add.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,1120 **** ! ------------------------------------------------------------------------ ! -- add.decTest -- decimal addition -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...2218 lines suppressed...] ! addx1141 add 10E-101 -1e-200 -> 9E-101 Subnormal Inexact Rounded Underflow ! addx1142 add 1E-101 -1e-200 -> 0E-101 Subnormal Inexact Rounded Underflow ! addx1143 add 0E-101 -1e-200 -> -0E-101 Subnormal Inexact Rounded Underflow ! addx1144 add 1E-102 -1e-200 -> 0E-101 Subnormal Inexact Rounded Underflow ! ! addx1151 add 10000E-102 -1e-200 -> 9.99E-99 Subnormal Inexact Rounded Underflow ! addx1152 add 1000E-102 -1e-200 -> 9.9E-100 Subnormal Inexact Rounded Underflow ! addx1153 add 100E-102 -1e-200 -> 9E-101 Subnormal Inexact Rounded Underflow ! addx1154 add 10E-102 -1e-200 -> 0E-101 Subnormal Inexact Rounded Underflow ! addx1155 add 1E-102 -1e-200 -> 0E-101 Subnormal Inexact Rounded Underflow ! addx1156 add 0E-102 -1e-200 -> -0E-101 Subnormal Inexact Rounded Underflow ! addx1157 add 1E-103 -1e-200 -> 0E-101 Subnormal Inexact Rounded Underflow ! ! addx1160 add 100E-105 -1e-101 -> -0E-101 Subnormal Inexact Rounded Underflow ! addx1161 add 100E-105 -1e-201 -> 0E-101 Subnormal Inexact Rounded Underflow ! ! ! -- Null tests ! addx9990 add 10 # -> NaN Invalid_operation ! addx9991 add # 10 -> NaN Invalid_operation Index: base.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/base.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** base.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- base.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,1266 **** ! ------------------------------------------------------------------------ ! -- base.decTest -- base decimal <--> string conversions -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...2503 lines suppressed...] ! basx1026 tosci 1e-2147483649 -> 0E-1000000014 Underflow Subnormal Inexact Rounded ! -- same unbalanced ! precision: 7 ! maxExponent: 96 ! minexponent: -95 ! basx1031 tosci 1e+2147483649 -> Infinity Overflow Inexact Rounded ! basx1032 tosci 1e+2147483648 -> Infinity Overflow Inexact Rounded ! basx1033 tosci 1e+2147483647 -> Infinity Overflow Inexact Rounded ! basx1034 tosci 1e-2147483647 -> 0E-101 Underflow Subnormal Inexact Rounded ! basx1035 tosci 1e-2147483648 -> 0E-101 Underflow Subnormal Inexact Rounded ! basx1036 tosci 1e-2147483649 -> 0E-101 Underflow Subnormal Inexact Rounded ! ! -- check for double-rounded subnormals ! precision: 5 ! maxexponent: 79 ! minexponent: -79 ! basx1041 toSci 1.52444E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow ! basx1042 toSci 1.52445E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow ! basx1043 toSci 1.52446E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow ! Index: clamp.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/clamp.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** clamp.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- clamp.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,197 **** ! ------------------------------------------------------------------------ ! -- clamp.decTest -- clamped exponent tests (format-independent) -- ! -- Copyright (c) IBM Corporation, 2000, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.35 ! ! -- This set of tests uses the same limits as the 8-byte concrete ! -- representation, but applies clamping without using format-specific ! -- conversions. ! ! extended: 1 ! precision: 16 ! rounding: half_even ! maxExponent: 384 ! minExponent: -383 ! clamp: 1 ! ! -- General testcases ! ! -- Normality ! clam010 apply 1234567890123456 -> 1234567890123456 ! clam011 apply 1234567890123456.0 -> 1234567890123456 Rounded ! clam012 apply 1234567890123456.1 -> 1234567890123456 Rounded Inexact ! clam013 apply -1234567890123456 -> -1234567890123456 ! clam014 apply -1234567890123456.0 -> -1234567890123456 Rounded ! clam015 apply -1234567890123456.1 -> -1234567890123456 Rounded Inexact ! ! ! -- Nmax and similar ! clam022 apply 9.999999999999999E+384 -> 9.999999999999999E+384 ! clam024 apply 1.234567890123456E+384 -> 1.234567890123456E+384 ! -- fold-downs (more below) ! clam030 apply 1.23E+384 -> 1.230000000000000E+384 Clamped ! clam032 apply 1E+384 -> 1.000000000000000E+384 Clamped ! ! clam051 apply 12345 -> 12345 ! clam053 apply 1234 -> 1234 ! clam055 apply 123 -> 123 ! clam057 apply 12 -> 12 ! clam059 apply 1 -> 1 ! clam061 apply 1.23 -> 1.23 ! clam063 apply 123.45 -> 123.45 ! ! -- Nmin and below ! clam071 apply 1E-383 -> 1E-383 ! clam073 apply 1.000000000000000E-383 -> 1.000000000000000E-383 ! clam075 apply 1.000000000000001E-383 -> 1.000000000000001E-383 ! ! clam077 apply 0.100000000000000E-383 -> 1.00000000000000E-384 Subnormal ! clam079 apply 0.000000000000010E-383 -> 1.0E-397 Subnormal ! clam081 apply 0.00000000000001E-383 -> 1E-397 Subnormal ! clam083 apply 0.000000000000001E-383 -> 1E-398 Subnormal ! ! -- underflows ! clam090 apply 1e-398 -> #0000000000000001 Subnormal ! clam091 apply 1.9e-398 -> #0000000000000002 Subnormal Underflow Inexact Rounded ! clam092 apply 1.1e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded ! clam093 apply 1.00000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded ! clam094 apply 1.00000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded ! clam095 apply 1.000000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded ! clam096 apply 0.1e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded ! clam097 apply 0.00000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded ! clam098 apply 0.00000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded ! clam099 apply 0.000000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded ! ! -- Same again, negatives ! -- Nmax and similar ! clam122 apply -9.999999999999999E+384 -> -9.999999999999999E+384 ! clam124 apply -1.234567890123456E+384 -> -1.234567890123456E+384 ! -- fold-downs (more below) ! clam130 apply -1.23E+384 -> -1.230000000000000E+384 Clamped ! clam132 apply -1E+384 -> -1.000000000000000E+384 Clamped ! ! clam151 apply -12345 -> -12345 ! clam153 apply -1234 -> -1234 ! clam155 apply -123 -> -123 ! clam157 apply -12 -> -12 ! clam159 apply -1 -> -1 ! clam161 apply -1.23 -> -1.23 ! clam163 apply -123.45 -> -123.45 ! ! -- Nmin and below ! clam171 apply -1E-383 -> -1E-383 ! clam173 apply -1.000000000000000E-383 -> -1.000000000000000E-383 ! clam175 apply -1.000000000000001E-383 -> -1.000000000000001E-383 ! ! clam177 apply -0.100000000000000E-383 -> -1.00000000000000E-384 Subnormal ! clam179 apply -0.000000000000010E-383 -> -1.0E-397 Subnormal ! clam181 apply -0.00000000000001E-383 -> -1E-397 Subnormal ! clam183 apply -0.000000000000001E-383 -> -1E-398 Subnormal ! ! -- underflows ! clam189 apply -1e-398 -> #8000000000000001 Subnormal ! clam190 apply -1.0e-398 -> #8000000000000001 Subnormal Rounded ! clam191 apply -1.9e-398 -> #8000000000000002 Subnormal Underflow Inexact Rounded ! clam192 apply -1.1e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded ! clam193 apply -1.00000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded ! clam194 apply -1.00000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded ! clam195 apply -1.000000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded ! clam196 apply -0.1e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded ! clam197 apply -0.00000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded ! clam198 apply -0.00000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded ! clam199 apply -0.000000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded ! ! -- zeros ! clam401 apply 0E-500 -> 0E-398 Clamped ! clam402 apply 0E-400 -> 0E-398 Clamped ! clam403 apply 0E-398 -> 0E-398 ! clam404 apply 0.000000000000000E-383 -> 0E-398 ! clam405 apply 0E-2 -> 0.00 ! clam406 apply 0 -> 0 ! clam407 apply 0E+3 -> 0E+3 ! clam408 apply 0E+369 -> 0E+369 ! -- clamped zeros... ! clam410 apply 0E+370 -> 0E+369 Clamped ! clam411 apply 0E+384 -> 0E+369 Clamped ! clam412 apply 0E+400 -> 0E+369 Clamped ! clam413 apply 0E+500 -> 0E+369 Clamped ! ! -- negative zeros ! clam420 apply -0E-500 -> -0E-398 Clamped ! clam421 apply -0E-400 -> -0E-398 Clamped ! clam422 apply -0E-398 -> -0E-398 ! clam423 apply -0.000000000000000E-383 -> -0E-398 ! clam424 apply -0E-2 -> -0.00 ! clam425 apply -0 -> -0 ! clam426 apply -0E+3 -> -0E+3 ! clam427 apply -0E+369 -> -0E+369 ! -- clamped zeros... ! clam431 apply -0E+370 -> -0E+369 Clamped ! clam432 apply -0E+384 -> -0E+369 Clamped ! clam433 apply -0E+400 -> -0E+369 Clamped ! clam434 apply -0E+500 -> -0E+369 Clamped ! ! -- fold-down full sequence ! clam601 apply 1E+384 -> 1.000000000000000E+384 Clamped ! clam603 apply 1E+383 -> 1.00000000000000E+383 Clamped ! clam605 apply 1E+382 -> 1.0000000000000E+382 Clamped ! clam607 apply 1E+381 -> 1.000000000000E+381 Clamped ! clam609 apply 1E+380 -> 1.00000000000E+380 Clamped ! clam611 apply 1E+379 -> 1.0000000000E+379 Clamped ! clam613 apply 1E+378 -> 1.000000000E+378 Clamped ! clam615 apply 1E+377 -> 1.00000000E+377 Clamped ! clam617 apply 1E+376 -> 1.0000000E+376 Clamped ! clam619 apply 1E+375 -> 1.000000E+375 Clamped ! clam621 apply 1E+374 -> 1.00000E+374 Clamped ! clam623 apply 1E+373 -> 1.0000E+373 Clamped ! clam625 apply 1E+372 -> 1.000E+372 Clamped ! clam627 apply 1E+371 -> 1.00E+371 Clamped ! clam629 apply 1E+370 -> 1.0E+370 Clamped ! clam631 apply 1E+369 -> 1E+369 ! clam633 apply 1E+368 -> 1E+368 ! -- same with 9s ! clam641 apply 9E+384 -> 9.000000000000000E+384 Clamped ! clam643 apply 9E+383 -> 9.00000000000000E+383 Clamped ! clam645 apply 9E+382 -> 9.0000000000000E+382 Clamped ! clam647 apply 9E+381 -> 9.000000000000E+381 Clamped ! clam649 apply 9E+380 -> 9.00000000000E+380 Clamped ! clam651 apply 9E+379 -> 9.0000000000E+379 Clamped ! clam653 apply 9E+378 -> 9.000000000E+378 Clamped ! clam655 apply 9E+377 -> 9.00000000E+377 Clamped ! clam657 apply 9E+376 -> 9.0000000E+376 Clamped ! clam659 apply 9E+375 -> 9.000000E+375 Clamped ! clam661 apply 9E+374 -> 9.00000E+374 Clamped ! clam663 apply 9E+373 -> 9.0000E+373 Clamped ! clam665 apply 9E+372 -> 9.000E+372 Clamped ! clam667 apply 9E+371 -> 9.00E+371 Clamped ! clam669 apply 9E+370 -> 9.0E+370 Clamped ! clam671 apply 9E+369 -> 9E+369 ! clam673 apply 9E+368 -> 9E+368 ! ! -- example from documentation ! precision: 7 ! rounding: half_even ! maxExponent: +96 ! minExponent: -95 ! ! clamp: 0 ! clam700 apply 1.23E+96 -> 1.23E+96 ! ! clamp: 1 ! clam701 apply 1.23E+96 -> 1.230000E+96 Clamped --- 1,197 ---- ! ------------------------------------------------------------------------ ! -- clamp.decTest -- clamped exponent tests (format-independent) -- ! -- Copyright (c) IBM Corporation, 2000, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.38 ! ! -- This set of tests uses the same limits as the 8-byte concrete ! -- representation, but applies clamping without using format-specific ! -- conversions. ! ! extended: 1 ! precision: 16 ! rounding: half_even ! maxExponent: 384 ! minExponent: -383 ! clamp: 1 ! ! -- General testcases ! ! -- Normality ! clam010 apply 1234567890123456 -> 1234567890123456 ! clam011 apply 1234567890123456.0 -> 1234567890123456 Rounded ! clam012 apply 1234567890123456.1 -> 1234567890123456 Rounded Inexact ! clam013 apply -1234567890123456 -> -1234567890123456 ! clam014 apply -1234567890123456.0 -> -1234567890123456 Rounded ! clam015 apply -1234567890123456.1 -> -1234567890123456 Rounded Inexact ! ! ! -- Nmax and similar ! clam022 apply 9.999999999999999E+384 -> 9.999999999999999E+384 ! clam024 apply 1.234567890123456E+384 -> 1.234567890123456E+384 ! -- fold-downs (more below) ! clam030 apply 1.23E+384 -> 1.230000000000000E+384 Clamped ! clam032 apply 1E+384 -> 1.000000000000000E+384 Clamped ! ! clam051 apply 12345 -> 12345 ! clam053 apply 1234 -> 1234 ! clam055 apply 123 -> 123 ! clam057 apply 12 -> 12 ! clam059 apply 1 -> 1 ! clam061 apply 1.23 -> 1.23 ! clam063 apply 123.45 -> 123.45 ! ! -- Nmin and below ! clam071 apply 1E-383 -> 1E-383 ! clam073 apply 1.000000000000000E-383 -> 1.000000000000000E-383 ! clam075 apply 1.000000000000001E-383 -> 1.000000000000001E-383 ! ! clam077 apply 0.100000000000000E-383 -> 1.00000000000000E-384 Subnormal ! clam079 apply 0.000000000000010E-383 -> 1.0E-397 Subnormal ! clam081 apply 0.00000000000001E-383 -> 1E-397 Subnormal ! clam083 apply 0.000000000000001E-383 -> 1E-398 Subnormal ! ! -- underflows ! clam090 apply 1e-398 -> #0000000000000001 Subnormal ! clam091 apply 1.9e-398 -> #0000000000000002 Subnormal Underflow Inexact Rounded ! clam092 apply 1.1e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded ! clam093 apply 1.00000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded ! clam094 apply 1.00000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded ! clam095 apply 1.000000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded ! clam096 apply 0.1e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded ! clam097 apply 0.00000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded ! clam098 apply 0.00000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded ! clam099 apply 0.000000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded ! ! -- Same again, negatives ! -- Nmax and similar ! clam122 apply -9.999999999999999E+384 -> -9.999999999999999E+384 ! clam124 apply -1.234567890123456E+384 -> -1.234567890123456E+384 ! -- fold-downs (more below) ! clam130 apply -1.23E+384 -> -1.230000000000000E+384 Clamped ! clam132 apply -1E+384 -> -1.000000000000000E+384 Clamped ! ! clam151 apply -12345 -> -12345 ! clam153 apply -1234 -> -1234 ! clam155 apply -123 -> -123 ! clam157 apply -12 -> -12 ! clam159 apply -1 -> -1 ! clam161 apply -1.23 -> -1.23 ! clam163 apply -123.45 -> -123.45 ! ! -- Nmin and below ! clam171 apply -1E-383 -> -1E-383 ! clam173 apply -1.000000000000000E-383 -> -1.000000000000000E-383 ! clam175 apply -1.000000000000001E-383 -> -1.000000000000001E-383 ! ! clam177 apply -0.100000000000000E-383 -> -1.00000000000000E-384 Subnormal ! clam179 apply -0.000000000000010E-383 -> -1.0E-397 Subnormal ! clam181 apply -0.00000000000001E-383 -> -1E-397 Subnormal ! clam183 apply -0.000000000000001E-383 -> -1E-398 Subnormal ! ! -- underflows ! clam189 apply -1e-398 -> #8000000000000001 Subnormal ! clam190 apply -1.0e-398 -> #8000000000000001 Subnormal Rounded ! clam191 apply -1.9e-398 -> #8000000000000002 Subnormal Underflow Inexact Rounded ! clam192 apply -1.1e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded ! clam193 apply -1.00000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded ! clam194 apply -1.00000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded ! clam195 apply -1.000000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded ! clam196 apply -0.1e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded ! clam197 apply -0.00000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded ! clam198 apply -0.00000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded ! clam199 apply -0.000000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded ! ! -- zeros ! clam401 apply 0E-500 -> 0E-398 Clamped ! clam402 apply 0E-400 -> 0E-398 Clamped ! clam403 apply 0E-398 -> 0E-398 ! clam404 apply 0.000000000000000E-383 -> 0E-398 ! clam405 apply 0E-2 -> 0.00 ! clam406 apply 0 -> 0 ! clam407 apply 0E+3 -> 0E+3 ! clam408 apply 0E+369 -> 0E+369 ! -- clamped zeros... ! clam410 apply 0E+370 -> 0E+369 Clamped ! clam411 apply 0E+384 -> 0E+369 Clamped ! clam412 apply 0E+400 -> 0E+369 Clamped ! clam413 apply 0E+500 -> 0E+369 Clamped ! ! -- negative zeros ! clam420 apply -0E-500 -> -0E-398 Clamped ! clam421 apply -0E-400 -> -0E-398 Clamped ! clam422 apply -0E-398 -> -0E-398 ! clam423 apply -0.000000000000000E-383 -> -0E-398 ! clam424 apply -0E-2 -> -0.00 ! clam425 apply -0 -> -0 ! clam426 apply -0E+3 -> -0E+3 ! clam427 apply -0E+369 -> -0E+369 ! -- clamped zeros... ! clam431 apply -0E+370 -> -0E+369 Clamped ! clam432 apply -0E+384 -> -0E+369 Clamped ! clam433 apply -0E+400 -> -0E+369 Clamped ! clam434 apply -0E+500 -> -0E+369 Clamped ! ! -- fold-down full sequence ! clam601 apply 1E+384 -> 1.000000000000000E+384 Clamped ! clam603 apply 1E+383 -> 1.00000000000000E+383 Clamped ! clam605 apply 1E+382 -> 1.0000000000000E+382 Clamped ! clam607 apply 1E+381 -> 1.000000000000E+381 Clamped ! clam609 apply 1E+380 -> 1.00000000000E+380 Clamped ! clam611 apply 1E+379 -> 1.0000000000E+379 Clamped ! clam613 apply 1E+378 -> 1.000000000E+378 Clamped ! clam615 apply 1E+377 -> 1.00000000E+377 Clamped ! clam617 apply 1E+376 -> 1.0000000E+376 Clamped ! clam619 apply 1E+375 -> 1.000000E+375 Clamped ! clam621 apply 1E+374 -> 1.00000E+374 Clamped ! clam623 apply 1E+373 -> 1.0000E+373 Clamped ! clam625 apply 1E+372 -> 1.000E+372 Clamped ! clam627 apply 1E+371 -> 1.00E+371 Clamped ! clam629 apply 1E+370 -> 1.0E+370 Clamped ! clam631 apply 1E+369 -> 1E+369 ! clam633 apply 1E+368 -> 1E+368 ! -- same with 9s ! clam641 apply 9E+384 -> 9.000000000000000E+384 Clamped ! clam643 apply 9E+383 -> 9.00000000000000E+383 Clamped ! clam645 apply 9E+382 -> 9.0000000000000E+382 Clamped ! clam647 apply 9E+381 -> 9.000000000000E+381 Clamped ! clam649 apply 9E+380 -> 9.00000000000E+380 Clamped ! clam651 apply 9E+379 -> 9.0000000000E+379 Clamped ! clam653 apply 9E+378 -> 9.000000000E+378 Clamped ! clam655 apply 9E+377 -> 9.00000000E+377 Clamped ! clam657 apply 9E+376 -> 9.0000000E+376 Clamped ! clam659 apply 9E+375 -> 9.000000E+375 Clamped ! clam661 apply 9E+374 -> 9.00000E+374 Clamped ! clam663 apply 9E+373 -> 9.0000E+373 Clamped ! clam665 apply 9E+372 -> 9.000E+372 Clamped ! clam667 apply 9E+371 -> 9.00E+371 Clamped ! clam669 apply 9E+370 -> 9.0E+370 Clamped ! clam671 apply 9E+369 -> 9E+369 ! clam673 apply 9E+368 -> 9E+368 ! ! -- example from documentation ! precision: 7 ! rounding: half_even ! maxExponent: +96 ! minExponent: -95 ! ! clamp: 0 ! clam700 apply 1.23E+96 -> 1.23E+96 ! ! clamp: 1 ! clam701 apply 1.23E+96 -> 1.230000E+96 Clamped Index: compare.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/compare.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** compare.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- compare.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,717 **** ! ------------------------------------------------------------------------ ! -- compare.decTest -- decimal comparison -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...1405 lines suppressed...] ! comx894 compare 0.01 9e-999999998 -> 1 ! comx895 compare 1e599999999 1e400000001 -> 1 ! comx896 compare 1e599999999 1e400000000 -> 1 ! comx897 compare 1e600000000 1e400000000 -> 1 ! comx898 compare 9e999999998 100 -> 1 ! comx899 compare 9e999999998 10 -> 1 ! comx900 compare 100 9e999999998 -> -1 ! -- signs ! comx901 compare 1e+777777777 1e+411111111 -> 1 ! comx902 compare 1e+777777777 -1e+411111111 -> 1 ! comx903 compare -1e+777777777 1e+411111111 -> -1 ! comx904 compare -1e+777777777 -1e+411111111 -> -1 ! comx905 compare 1e-777777777 1e-411111111 -> -1 ! comx906 compare 1e-777777777 -1e-411111111 -> 1 ! comx907 compare -1e-777777777 1e-411111111 -> -1 ! comx908 compare -1e-777777777 -1e-411111111 -> 1 ! ! -- Null tests ! comx990 compare 10 # -> NaN Invalid_operation ! comx991 compare # 10 -> NaN Invalid_operation Index: divide.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/divide.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** divide.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- divide.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,818 **** ! ------------------------------------------------------------------------ ! -- divide.decTest -- decimal division -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...1607 lines suppressed...] ! precision: 5 ! maxexponent: 79 ! minexponent: -79 ! divx1001 divide 1.52444E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow ! divx1002 divide 1.52445E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow ! divx1003 divide 1.52446E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow ! ! -- a rounding problem in one implementation ! precision: 34 ! rounding: half_up ! maxExponent: 6144 ! minExponent: -6143 ! -- Unbounded answer to 40 digits: ! -- 1.465811965811965811965811965811965811966E+7000 ! divx1010 divide 343E6000 234E-1000 -> Infinity Overflow Inexact Rounded ! ! -- Null tests ! divx9998 divide 10 # -> NaN Invalid_operation ! divx9999 divide # 10 -> NaN Invalid_operation ! Index: divideint.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/divideint.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** divideint.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- divideint.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,470 **** ! ------------------------------------------------------------------------ ! -- divideint.decTest -- decimal integer division -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.35 ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! ! dvix001 divideint 1 1 -> 1 ! dvix002 divideint 2 1 -> 2 ! dvix003 divideint 1 2 -> 0 ! dvix004 divideint 2 2 -> 1 ! dvix005 divideint 0 1 -> 0 ! dvix006 divideint 0 2 -> 0 ! dvix007 divideint 1 3 -> 0 ! dvix008 divideint 2 3 -> 0 ! dvix009 divideint 3 3 -> 1 ! ! dvix010 divideint 2.4 1 -> 2 ! dvix011 divideint 2.4 -1 -> -2 ! dvix012 divideint -2.4 1 -> -2 ! dvix013 divideint -2.4 -1 -> 2 ! dvix014 divideint 2.40 1 -> 2 ! dvix015 divideint 2.400 1 -> 2 ! dvix016 divideint 2.4 2 -> 1 ! dvix017 divideint 2.400 2 -> 1 ! dvix018 divideint 2. 2 -> 1 ! dvix019 divideint 20 20 -> 1 ! ! dvix020 divideint 187 187 -> 1 ! dvix021 divideint 5 2 -> 2 ! dvix022 divideint 5 2.0 -> 2 ! dvix023 divideint 5 2.000 -> 2 ! dvix024 divideint 5 0.200 -> 25 ! dvix025 divideint 5 0.200 -> 25 ! ! dvix030 divideint 1 2 -> 0 ! dvix031 divideint 1 4 -> 0 ! dvix032 divideint 1 8 -> 0 ! dvix033 divideint 1 16 -> 0 ! dvix034 divideint 1 32 -> 0 ! dvix035 divideint 1 64 -> 0 ! dvix040 divideint 1 -2 -> -0 ! dvix041 divideint 1 -4 -> -0 ! dvix042 divideint 1 -8 -> -0 ! dvix043 divideint 1 -16 -> -0 ! dvix044 divideint 1 -32 -> -0 ! dvix045 divideint 1 -64 -> -0 ! dvix050 divideint -1 2 -> -0 ! dvix051 divideint -1 4 -> -0 ! dvix052 divideint -1 8 -> -0 ! dvix053 divideint -1 16 -> -0 ! dvix054 divideint -1 32 -> -0 ! dvix055 divideint -1 64 -> -0 ! dvix060 divideint -1 -2 -> 0 ! dvix061 divideint -1 -4 -> 0 ! dvix062 divideint -1 -8 -> 0 ! dvix063 divideint -1 -16 -> 0 ! dvix064 divideint -1 -32 -> 0 ! dvix065 divideint -1 -64 -> 0 ! ! -- similar with powers of ten ! dvix160 divideint 1 1 -> 1 ! dvix161 divideint 1 10 -> 0 ! dvix162 divideint 1 100 -> 0 ! dvix163 divideint 1 1000 -> 0 ! dvix164 divideint 1 10000 -> 0 ! dvix165 divideint 1 100000 -> 0 ! dvix166 divideint 1 1000000 -> 0 ! dvix167 divideint 1 10000000 -> 0 ! dvix168 divideint 1 100000000 -> 0 ! dvix170 divideint 1 -1 -> -1 ! dvix171 divideint 1 -10 -> -0 ! dvix172 divideint 1 -100 -> -0 ! dvix173 divideint 1 -1000 -> -0 ! dvix174 divideint 1 -10000 -> -0 ! dvix175 divideint 1 -100000 -> -0 ! dvix176 divideint 1 -1000000 -> -0 ! dvix177 divideint 1 -10000000 -> -0 ! dvix178 divideint 1 -100000000 -> -0 ! dvix180 divideint -1 1 -> -1 ! dvix181 divideint -1 10 -> -0 ! dvix182 divideint -1 100 -> -0 ! dvix183 divideint -1 1000 -> -0 ! dvix184 divideint -1 10000 -> -0 ! dvix185 divideint -1 100000 -> -0 ! dvix186 divideint -1 1000000 -> -0 ! dvix187 divideint -1 10000000 -> -0 ! dvix188 divideint -1 100000000 -> -0 ! dvix190 divideint -1 -1 -> 1 ! dvix191 divideint -1 -10 -> 0 ! dvix192 divideint -1 -100 -> 0 ! dvix193 divideint -1 -1000 -> 0 ! dvix194 divideint -1 -10000 -> 0 ! dvix195 divideint -1 -100000 -> 0 ! dvix196 divideint -1 -1000000 -> 0 ! dvix197 divideint -1 -10000000 -> 0 ! dvix198 divideint -1 -100000000 -> 0 ! ! -- some long operand cases here ! dvix070 divideint 999999999 1 -> 999999999 ! dvix071 divideint 999999999.4 1 -> 999999999 ! dvix072 divideint 999999999.5 1 -> 999999999 ! dvix073 divideint 999999999.9 1 -> 999999999 ! dvix074 divideint 999999999.999 1 -> 999999999 ! precision: 6 ! dvix080 divideint 999999999 1 -> NaN Division_impossible ! dvix081 divideint 99999999 1 -> NaN Division_impossible ! dvix082 divideint 9999999 1 -> NaN Division_impossible ! dvix083 divideint 999999 1 -> 999999 ! dvix084 divideint 99999 1 -> 99999 ! dvix085 divideint 9999 1 -> 9999 ! dvix086 divideint 999 1 -> 999 ! dvix087 divideint 99 1 -> 99 ! dvix088 divideint 9 1 -> 9 ! ! precision: 9 ! dvix090 divideint 0. 1 -> 0 ! dvix091 divideint .0 1 -> 0 ! dvix092 divideint 0.00 1 -> 0 ! dvix093 divideint 0.00E+9 1 -> 0 ! dvix094 divideint 0.0000E-50 1 -> 0 ! ! dvix100 divideint 1 1 -> 1 ! dvix101 divideint 1 2 -> 0 ! dvix102 divideint 1 3 -> 0 ! dvix103 divideint 1 4 -> 0 ! dvix104 divideint 1 5 -> 0 ! dvix105 divideint 1 6 -> 0 ! dvix106 divideint 1 7 -> 0 ! dvix107 divideint 1 8 -> 0 ! dvix108 divideint 1 9 -> 0 ! dvix109 divideint 1 10 -> 0 ! dvix110 divideint 1 1 -> 1 ! dvix111 divideint 2 1 -> 2 ! dvix112 divideint 3 1 -> 3 ! dvix113 divideint 4 1 -> 4 ! dvix114 divideint 5 1 -> 5 ! dvix115 divideint 6 1 -> 6 ! dvix116 divideint 7 1 -> 7 ! dvix117 divideint 8 1 -> 8 ! dvix118 divideint 9 1 -> 9 ! dvix119 divideint 10 1 -> 10 ! ! -- from DiagBigDecimal ! dvix131 divideint 101.3 1 -> 101 ! dvix132 divideint 101.0 1 -> 101 ! dvix133 divideint 101.3 3 -> 33 ! dvix134 divideint 101.0 3 -> 33 ! dvix135 divideint 2.4 1 -> 2 ! dvix136 divideint 2.400 1 -> 2 ! dvix137 divideint 18 18 -> 1 ! dvix138 divideint 1120 1000 -> 1 ! dvix139 divideint 2.4 2 -> 1 ! dvix140 divideint 2.400 2 -> 1 ! dvix141 divideint 0.5 2.000 -> 0 ! dvix142 divideint 8.005 7 -> 1 ! dvix143 divideint 5 2 -> 2 ! dvix144 divideint 0 2 -> 0 ! dvix145 divideint 0.00 2 -> 0 ! ! -- Others ! dvix150 divideint 12345 4.999 -> 2469 ! dvix151 divideint 12345 4.99 -> 2473 ! dvix152 divideint 12345 4.9 -> 2519 ! dvix153 divideint 12345 5 -> 2469 ! dvix154 divideint 12345 5.1 -> 2420 ! dvix155 divideint 12345 5.01 -> 2464 ! dvix156 divideint 12345 5.001 -> 2468 ! dvix157 divideint 101 7.6 -> 13 ! ! -- Various flavours of divideint by 0 ! maxexponent: 999999999 ! minexponent: -999999999 ! dvix201 divideint 0 0 -> NaN Division_undefined ! dvix202 divideint 0.0E5 0 -> NaN Division_undefined ! dvix203 divideint 0.000 0 -> NaN Division_undefined ! dvix204 divideint 0.0001 0 -> Infinity Division_by_zero ! dvix205 divideint 0.01 0 -> Infinity Division_by_zero ! dvix206 divideint 0.1 0 -> Infinity Division_by_zero ! dvix207 divideint 1 0 -> Infinity Division_by_zero ! dvix208 divideint 1 0.0 -> Infinity Division_by_zero ! dvix209 divideint 10 0.0 -> Infinity Division_by_zero ! dvix210 divideint 1E+100 0.0 -> Infinity Division_by_zero ! dvix211 divideint 1E+1000 0 -> Infinity Division_by_zero ! dvix214 divideint -0.0001 0 -> -Infinity Division_by_zero ! dvix215 divideint -0.01 0 -> -Infinity Division_by_zero ! dvix216 divideint -0.1 0 -> -Infinity Division_by_zero ! dvix217 divideint -1 0 -> -Infinity Division_by_zero ! dvix218 divideint -1 0.0 -> -Infinity Division_by_zero ! dvix219 divideint -10 0.0 -> -Infinity Division_by_zero ! dvix220 divideint -1E+100 0.0 -> -Infinity Division_by_zero ! dvix221 divideint -1E+1000 0 -> -Infinity Division_by_zero ! ! -- test some cases that are close to exponent overflow ! maxexponent: 999999999 ! minexponent: -999999999 ! dvix270 divideint 1 1e999999999 -> 0 ! dvix271 divideint 1 0.9e999999999 -> 0 ! dvix272 divideint 1 0.99e999999999 -> 0 ! dvix273 divideint 1 0.999999999e999999999 -> 0 ! dvix274 divideint 9e999999999 1 -> NaN Division_impossible ! dvix275 divideint 9.9e999999999 1 -> NaN Division_impossible ! dvix276 divideint 9.99e999999999 1 -> NaN Division_impossible ! dvix277 divideint 9.99999999e999999999 1 -> NaN Division_impossible ! ! dvix280 divideint 0.1 9e-999999999 -> NaN Division_impossible ! dvix281 divideint 0.1 99e-999999999 -> NaN Division_impossible ! dvix282 divideint 0.1 999e-999999999 -> NaN Division_impossible ! ! dvix283 divideint 0.1 9e-999999998 -> NaN Division_impossible ! dvix284 divideint 0.1 99e-999999998 -> NaN Division_impossible ! dvix285 divideint 0.1 999e-999999998 -> NaN Division_impossible ! dvix286 divideint 0.1 999e-999999997 -> NaN Division_impossible ! dvix287 divideint 0.1 9999e-999999997 -> NaN Division_impossible ! dvix288 divideint 0.1 99999e-999999997 -> NaN Division_impossible ! ! ! -- overflow and underflow tests [from divide] ! maxexponent: 999999999 ! minexponent: -999999999 ! dvix330 divideint +1.23456789012345E-0 9E+999999999 -> 0 ! dvix331 divideint 9E+999999999 +0.23456789012345E-0 -> NaN Division_impossible ! dvix332 divideint +0.100 9E+999999999 -> 0 ! dvix333 divideint 9E-999999999 +9.100 -> 0 ! dvix335 divideint -1.23456789012345E-0 9E+999999999 -> -0 ! dvix336 divideint 9E+999999999 -0.83456789012345E-0 -> NaN Division_impossible ! dvix337 divideint -0.100 9E+999999999 -> -0 ! dvix338 divideint 9E-999999999 -9.100 -> -0 ! ! -- long operand checks ! maxexponent: 999 ! minexponent: -999 ! precision: 9 ! dvix401 divideint 12345678000 100 -> 123456780 ! dvix402 divideint 1 12345678000 -> 0 ! dvix403 divideint 1234567800 10 -> 123456780 ! dvix404 divideint 1 1234567800 -> 0 ! dvix405 divideint 1234567890 10 -> 123456789 ! dvix406 divideint 1 1234567890 -> 0 ! dvix407 divideint 1234567891 10 -> 123456789 ! dvix408 divideint 1 1234567891 -> 0 ! dvix409 divideint 12345678901 100 -> 123456789 ! dvix410 divideint 1 12345678901 -> 0 ! dvix411 divideint 1234567896 10 -> 123456789 ! dvix412 divideint 1 1234567896 -> 0 ! dvix413 divideint 12345678948 100 -> 123456789 ! dvix414 divideint 12345678949 100 -> 123456789 ! dvix415 divideint 12345678950 100 -> 123456789 ! dvix416 divideint 12345678951 100 -> 123456789 ! dvix417 divideint 12345678999 100 -> 123456789 ! ! precision: 15 ! dvix441 divideint 12345678000 1 -> 12345678000 ! dvix442 divideint 1 12345678000 -> 0 ! dvix443 divideint 1234567800 1 -> 1234567800 ! dvix444 divideint 1 1234567800 -> 0 ! dvix445 divideint 1234567890 1 -> 1234567890 ! dvix446 divideint 1 1234567890 -> 0 ! dvix447 divideint 1234567891 1 -> 1234567891 ! dvix448 divideint 1 1234567891 -> 0 ! dvix449 divideint 12345678901 1 -> 12345678901 ! dvix450 divideint 1 12345678901 -> 0 ! dvix451 divideint 1234567896 1 -> 1234567896 ! dvix452 divideint 1 1234567896 -> 0 ! ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! ! -- more zeros, etc. ! dvix531 divideint 5.00 1E-3 -> 5000 ! dvix532 divideint 00.00 0.000 -> NaN Division_undefined ! dvix533 divideint 00.00 0E-3 -> NaN Division_undefined ! dvix534 divideint 0 -0 -> NaN Division_undefined ! dvix535 divideint -0 0 -> NaN Division_undefined ! dvix536 divideint -0 -0 -> NaN Division_undefined ! ! dvix541 divideint 0 -1 -> -0 ! dvix542 divideint -0 -1 -> 0 ! dvix543 divideint 0 1 -> 0 ! dvix544 divideint -0 1 -> -0 ! dvix545 divideint -1 0 -> -Infinity Division_by_zero ! dvix546 divideint -1 -0 -> Infinity Division_by_zero ! dvix547 divideint 1 0 -> Infinity Division_by_zero ! dvix548 divideint 1 -0 -> -Infinity Division_by_zero ! ! dvix551 divideint 0.0 -1 -> -0 ! dvix552 divideint -0.0 -1 -> 0 ! dvix553 divideint 0.0 1 -> 0 ! dvix554 divideint -0.0 1 -> -0 ! dvix555 divideint -1.0 0 -> -Infinity Division_by_zero ! dvix556 divideint -1.0 -0 -> Infinity Division_by_zero ! dvix557 divideint 1.0 0 -> Infinity Division_by_zero ! dvix558 divideint 1.0 -0 -> -Infinity Division_by_zero ! ! dvix561 divideint 0 -1.0 -> -0 ! dvix562 divideint -0 -1.0 -> 0 ! dvix563 divideint 0 1.0 -> 0 ! dvix564 divideint -0 1.0 -> -0 ! dvix565 divideint -1 0.0 -> -Infinity Division_by_zero ! dvix566 divideint -1 -0.0 -> Infinity Division_by_zero ! dvix567 divideint 1 0.0 -> Infinity Division_by_zero ! dvix568 divideint 1 -0.0 -> -Infinity Division_by_zero ! ! dvix571 divideint 0.0 -1.0 -> -0 ! dvix572 divideint -0.0 -1.0 -> 0 ! dvix573 divideint 0.0 1.0 -> 0 ! dvix574 divideint -0.0 1.0 -> -0 ! dvix575 divideint -1.0 0.0 -> -Infinity Division_by_zero ! dvix576 divideint -1.0 -0.0 -> Infinity Division_by_zero ! dvix577 divideint 1.0 0.0 -> Infinity Division_by_zero ! dvix578 divideint 1.0 -0.0 -> -Infinity Division_by_zero ! ! -- Specials ! dvix580 divideint Inf -Inf -> NaN Invalid_operation ! dvix581 divideint Inf -1000 -> -Infinity ! dvix582 divideint Inf -1 -> -Infinity ! dvix583 divideint Inf -0 -> -Infinity ! dvix584 divideint Inf 0 -> Infinity ! dvix585 divideint Inf 1 -> Infinity ! dvix586 divideint Inf 1000 -> Infinity ! dvix587 divideint Inf Inf -> NaN Invalid_operation ! dvix588 divideint -1000 Inf -> -0 ! dvix589 divideint -Inf Inf -> NaN Invalid_operation ! dvix590 divideint -1 Inf -> -0 ! dvix591 divideint -0 Inf -> -0 ! dvix592 divideint 0 Inf -> 0 ! dvix593 divideint 1 Inf -> 0 ! dvix594 divideint 1000 Inf -> 0 ! dvix595 divideint Inf Inf -> NaN Invalid_operation ! ! dvix600 divideint -Inf -Inf -> NaN Invalid_operation ! dvix601 divideint -Inf -1000 -> Infinity ! dvix602 divideint -Inf -1 -> Infinity ! dvix603 divideint -Inf -0 -> Infinity ! dvix604 divideint -Inf 0 -> -Infinity ! dvix605 divideint -Inf 1 -> -Infinity ! dvix606 divideint -Inf 1000 -> -Infinity ! dvix607 divideint -Inf Inf -> NaN Invalid_operation ! dvix608 divideint -1000 Inf -> -0 ! dvix609 divideint -Inf -Inf -> NaN Invalid_operation ! dvix610 divideint -1 -Inf -> 0 ! dvix611 divideint -0 -Inf -> 0 ! dvix612 divideint 0 -Inf -> -0 ! dvix613 divideint 1 -Inf -> -0 ! dvix614 divideint 1000 -Inf -> -0 ! dvix615 divideint Inf -Inf -> NaN Invalid_operation ! ! dvix621 divideint NaN -Inf -> NaN ! dvix622 divideint NaN -1000 -> NaN ! dvix623 divideint NaN -1 -> NaN ! dvix624 divideint NaN -0 -> NaN ! dvix625 divideint NaN 0 -> NaN ! dvix626 divideint NaN 1 -> NaN ! dvix627 divideint NaN 1000 -> NaN ! dvix628 divideint NaN Inf -> NaN ! dvix629 divideint NaN NaN -> NaN ! dvix630 divideint -Inf NaN -> NaN ! dvix631 divideint -1000 NaN -> NaN ! dvix632 divideint -1 NaN -> NaN ! dvix633 divideint -0 NaN -> NaN ! dvix634 divideint 0 NaN -> NaN ! dvix635 divideint 1 NaN -> NaN ! dvix636 divideint 1000 NaN -> NaN ! dvix637 divideint Inf NaN -> NaN ! ! dvix641 divideint sNaN -Inf -> NaN Invalid_operation ! dvix642 divideint sNaN -1000 -> NaN Invalid_operation ! dvix643 divideint sNaN -1 -> NaN Invalid_operation ! dvix644 divideint sNaN -0 -> NaN Invalid_operation ! dvix645 divideint sNaN 0 -> NaN Invalid_operation ! dvix646 divideint sNaN 1 -> NaN Invalid_operation ! dvix647 divideint sNaN 1000 -> NaN Invalid_operation ! dvix648 divideint sNaN NaN -> NaN Invalid_operation ! dvix649 divideint sNaN sNaN -> NaN Invalid_operation ! dvix650 divideint NaN sNaN -> NaN Invalid_operation ! dvix651 divideint -Inf sNaN -> NaN Invalid_operation ! dvix652 divideint -1000 sNaN -> NaN Invalid_operation ! dvix653 divideint -1 sNaN -> NaN Invalid_operation ! dvix654 divideint -0 sNaN -> NaN Invalid_operation ! dvix655 divideint 0 sNaN -> NaN Invalid_operation ! dvix656 divideint 1 sNaN -> NaN Invalid_operation ! dvix657 divideint 1000 sNaN -> NaN Invalid_operation ! dvix658 divideint Inf sNaN -> NaN Invalid_operation ! dvix659 divideint NaN sNaN -> NaN Invalid_operation ! ! -- propagating NaNs ! dvix661 divideint NaN9 -Inf -> NaN9 ! dvix662 divideint NaN8 1000 -> NaN8 ! dvix663 divideint NaN7 Inf -> NaN7 ! dvix664 divideint -NaN6 NaN5 -> -NaN6 ! dvix665 divideint -Inf NaN4 -> NaN4 ! dvix666 divideint -1000 NaN3 -> NaN3 ! dvix667 divideint Inf -NaN2 -> -NaN2 ! ! dvix671 divideint -sNaN99 -Inf -> -NaN99 Invalid_operation ! dvix672 divideint sNaN98 -1 -> NaN98 Invalid_operation ! dvix673 divideint sNaN97 NaN -> NaN97 Invalid_operation ! dvix674 divideint sNaN96 sNaN94 -> NaN96 Invalid_operation ! dvix675 divideint NaN95 sNaN93 -> NaN93 Invalid_operation ! dvix676 divideint -Inf sNaN92 -> NaN92 Invalid_operation ! dvix677 divideint 0 sNaN91 -> NaN91 Invalid_operation ! dvix678 divideint Inf -sNaN90 -> -NaN90 Invalid_operation ! dvix679 divideint NaN sNaN89 -> NaN89 Invalid_operation ! ! -- some long operand cases again ! precision: 8 ! dvix710 divideint 100000001 1 -> NaN Division_impossible ! dvix711 divideint 100000000.4 1 -> NaN Division_impossible ! dvix712 divideint 100000000.5 1 -> NaN Division_impossible ! dvix713 divideint 100000000.9 1 -> NaN Division_impossible ! dvix714 divideint 100000000.999 1 -> NaN Division_impossible ! precision: 6 ! dvix720 divideint 100000000 1 -> NaN Division_impossible ! dvix721 divideint 10000000 1 -> NaN Division_impossible ! dvix722 divideint 1000000 1 -> NaN Division_impossible ! dvix723 divideint 100000 1 -> 100000 ! dvix724 divideint 10000 1 -> 10000 ! dvix725 divideint 1000 1 -> 1000 ! dvix726 divideint 100 1 -> 100 ! dvix727 divideint 10 1 -> 10 ! dvix728 divideint 1 1 -> 1 ! dvix729 divideint 1 10 -> 0 ! ! precision: 9 ! maxexponent: 999999999 ! minexponent: -999999999 ! dvix732 divideint 1 0.99e999999999 -> 0 ! dvix733 divideint 1 0.999999999e999999999 -> 0 ! dvix734 divideint 9e999999999 1 -> NaN Division_impossible ! dvix735 divideint 9.9e999999999 1 -> NaN Division_impossible ! dvix736 divideint 9.99e999999999 1 -> NaN Division_impossible ! dvix737 divideint 9.99999999e999999999 1 -> NaN Division_impossible ! ! dvix740 divideint 0.1 9e-999999999 -> NaN Division_impossible ! dvix741 divideint 0.1 99e-999999999 -> NaN Division_impossible ! dvix742 divideint 0.1 999e-999999999 -> NaN Division_impossible ! ! dvix743 divideint 0.1 9e-999999998 -> NaN Division_impossible ! dvix744 divideint 0.1 99e-999999998 -> NaN Division_impossible ! dvix745 divideint 0.1 999e-999999998 -> NaN Division_impossible ! dvix746 divideint 0.1 999e-999999997 -> NaN Division_impossible ! dvix747 divideint 0.1 9999e-999999997 -> NaN Division_impossible ! dvix748 divideint 0.1 99999e-999999997 -> NaN Division_impossible ! ! ! -- Null tests ! dvix900 divideint 10 # -> NaN Invalid_operation ! dvix901 divideint # 10 -> NaN Invalid_operation --- 1,470 ---- ! ------------------------------------------------------------------------ ! -- divideint.decTest -- decimal integer division -- ! -- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.38 ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 384 ! minexponent: -383 ! ! dvix001 divideint 1 1 -> 1 ! dvix002 divideint 2 1 -> 2 ! dvix003 divideint 1 2 -> 0 ! dvix004 divideint 2 2 -> 1 ! dvix005 divideint 0 1 -> 0 ! dvix006 divideint 0 2 -> 0 ! dvix007 divideint 1 3 -> 0 ! dvix008 divideint 2 3 -> 0 ! dvix009 divideint 3 3 -> 1 ! ! dvix010 divideint 2.4 1 -> 2 ! dvix011 divideint 2.4 -1 -> -2 ! dvix012 divideint -2.4 1 -> -2 ! dvix013 divideint -2.4 -1 -> 2 ! dvix014 divideint 2.40 1 -> 2 ! dvix015 divideint 2.400 1 -> 2 ! dvix016 divideint 2.4 2 -> 1 ! dvix017 divideint 2.400 2 -> 1 ! dvix018 divideint 2. 2 -> 1 ! dvix019 divideint 20 20 -> 1 ! ! dvix020 divideint 187 187 -> 1 ! dvix021 divideint 5 2 -> 2 ! dvix022 divideint 5 2.0 -> 2 ! dvix023 divideint 5 2.000 -> 2 ! dvix024 divideint 5 0.200 -> 25 ! dvix025 divideint 5 0.200 -> 25 ! ! dvix030 divideint 1 2 -> 0 ! dvix031 divideint 1 4 -> 0 ! dvix032 divideint 1 8 -> 0 ! dvix033 divideint 1 16 -> 0 ! dvix034 divideint 1 32 -> 0 ! dvix035 divideint 1 64 -> 0 ! dvix040 divideint 1 -2 -> -0 ! dvix041 divideint 1 -4 -> -0 ! dvix042 divideint 1 -8 -> -0 ! dvix043 divideint 1 -16 -> -0 ! dvix044 divideint 1 -32 -> -0 ! dvix045 divideint 1 -64 -> -0 ! dvix050 divideint -1 2 -> -0 ! dvix051 divideint -1 4 -> -0 ! dvix052 divideint -1 8 -> -0 ! dvix053 divideint -1 16 -> -0 ! dvix054 divideint -1 32 -> -0 ! dvix055 divideint -1 64 -> -0 ! dvix060 divideint -1 -2 -> 0 ! dvix061 divideint -1 -4 -> 0 ! dvix062 divideint -1 -8 -> 0 ! dvix063 divideint -1 -16 -> 0 ! dvix064 divideint -1 -32 -> 0 ! dvix065 divideint -1 -64 -> 0 ! ! -- similar with powers of ten ! dvix160 divideint 1 1 -> 1 ! dvix161 divideint 1 10 -> 0 ! dvix162 divideint 1 100 -> 0 ! dvix163 divideint 1 1000 -> 0 ! dvix164 divideint 1 10000 -> 0 ! dvix165 divideint 1 100000 -> 0 ! dvix166 divideint 1 1000000 -> 0 ! dvix167 divideint 1 10000000 -> 0 ! dvix168 divideint 1 100000000 -> 0 ! dvix170 divideint 1 -1 -> -1 ! dvix171 divideint 1 -10 -> -0 ! dvix172 divideint 1 -100 -> -0 ! dvix173 divideint 1 -1000 -> -0 ! dvix174 divideint 1 -10000 -> -0 ! dvix175 divideint 1 -100000 -> -0 ! dvix176 divideint 1 -1000000 -> -0 ! dvix177 divideint 1 -10000000 -> -0 ! dvix178 divideint 1 -100000000 -> -0 ! dvix180 divideint -1 1 -> -1 ! dvix181 divideint -1 10 -> -0 ! dvix182 divideint -1 100 -> -0 ! dvix183 divideint -1 1000 -> -0 ! dvix184 divideint -1 10000 -> -0 ! dvix185 divideint -1 100000 -> -0 ! dvix186 divideint -1 1000000 -> -0 ! dvix187 divideint -1 10000000 -> -0 ! dvix188 divideint -1 100000000 -> -0 ! dvix190 divideint -1 -1 -> 1 ! dvix191 divideint -1 -10 -> 0 ! dvix192 divideint -1 -100 -> 0 ! dvix193 divideint -1 -1000 -> 0 ! dvix194 divideint -1 -10000 -> 0 ! dvix195 divideint -1 -100000 -> 0 ! dvix196 divideint -1 -1000000 -> 0 ! dvix197 divideint -1 -10000000 -> 0 ! dvix198 divideint -1 -100000000 -> 0 ! ! -- some long operand cases here ! dvix070 divideint 999999999 1 -> 999999999 ! dvix071 divideint 999999999.4 1 -> 999999999 ! dvix072 divideint 999999999.5 1 -> 999999999 ! dvix073 divideint 999999999.9 1 -> 999999999 ! dvix074 divideint 999999999.999 1 -> 999999999 ! precision: 6 ! dvix080 divideint 999999999 1 -> NaN Division_impossible ! dvix081 divideint 99999999 1 -> NaN Division_impossible ! dvix082 divideint 9999999 1 -> NaN Division_impossible ! dvix083 divideint 999999 1 -> 999999 ! dvix084 divideint 99999 1 -> 99999 ! dvix085 divideint 9999 1 -> 9999 ! dvix086 divideint 999 1 -> 999 ! dvix087 divideint 99 1 -> 99 ! dvix088 divideint 9 1 -> 9 ! ! precision: 9 ! dvix090 divideint 0. 1 -> 0 ! dvix091 divideint .0 1 -> 0 ! dvix092 divideint 0.00 1 -> 0 ! dvix093 divideint 0.00E+9 1 -> 0 ! dvix094 divideint 0.0000E-50 1 -> 0 ! ! dvix100 divideint 1 1 -> 1 ! dvix101 divideint 1 2 -> 0 ! dvix102 divideint 1 3 -> 0 ! dvix103 divideint 1 4 -> 0 ! dvix104 divideint 1 5 -> 0 ! dvix105 divideint 1 6 -> 0 ! dvix106 divideint 1 7 -> 0 ! dvix107 divideint 1 8 -> 0 ! dvix108 divideint 1 9 -> 0 ! dvix109 divideint 1 10 -> 0 ! dvix110 divideint 1 1 -> 1 ! dvix111 divideint 2 1 -> 2 ! dvix112 divideint 3 1 -> 3 ! dvix113 divideint 4 1 -> 4 ! dvix114 divideint 5 1 -> 5 ! dvix115 divideint 6 1 -> 6 ! dvix116 divideint 7 1 -> 7 ! dvix117 divideint 8 1 -> 8 ! dvix118 divideint 9 1 -> 9 ! dvix119 divideint 10 1 -> 10 ! ! -- from DiagBigDecimal ! dvix131 divideint 101.3 1 -> 101 ! dvix132 divideint 101.0 1 -> 101 ! dvix133 divideint 101.3 3 -> 33 ! dvix134 divideint 101.0 3 -> 33 ! dvix135 divideint 2.4 1 -> 2 ! dvix136 divideint 2.400 1 -> 2 ! dvix137 divideint 18 18 -> 1 ! dvix138 divideint 1120 1000 -> 1 ! dvix139 divideint 2.4 2 -> 1 ! dvix140 divideint 2.400 2 -> 1 ! dvix141 divideint 0.5 2.000 -> 0 ! dvix142 divideint 8.005 7 -> 1 ! dvix143 divideint 5 2 -> 2 ! dvix144 divideint 0 2 -> 0 ! dvix145 divideint 0.00 2 -> 0 ! ! -- Others ! dvix150 divideint 12345 4.999 -> 2469 ! dvix151 divideint 12345 4.99 -> 2473 ! dvix152 divideint 12345 4.9 -> 2519 ! dvix153 divideint 12345 5 -> 2469 ! dvix154 divideint 12345 5.1 -> 2420 ! dvix155 divideint 12345 5.01 -> 2464 ! dvix156 divideint 12345 5.001 -> 2468 ! dvix157 divideint 101 7.6 -> 13 ! ! -- Various flavours of divideint by 0 ! maxexponent: 999999999 ! minexponent: -999999999 ! dvix201 divideint 0 0 -> NaN Division_undefined ! dvix202 divideint 0.0E5 0 -> NaN Division_undefined ! dvix203 divideint 0.000 0 -> NaN Division_undefined ! dvix204 divideint 0.0001 0 -> Infinity Division_by_zero ! dvix205 divideint 0.01 0 -> Infinity Division_by_zero ! dvix206 divideint 0.1 0 -> Infinity Division_by_zero ! dvix207 divideint 1 0 -> Infinity Division_by_zero ! dvix208 divideint 1 0.0 -> Infinity Division_by_zero ! dvix209 divideint 10 0.0 -> Infinity Division_by_zero ! dvix210 divideint 1E+100 0.0 -> Infinity Division_by_zero ! dvix211 divideint 1E+1000 0 -> Infinity Division_by_zero ! dvix214 divideint -0.0001 0 -> -Infinity Division_by_zero ! dvix215 divideint -0.01 0 -> -Infinity Division_by_zero ! dvix216 divideint -0.1 0 -> -Infinity Division_by_zero ! dvix217 divideint -1 0 -> -Infinity Division_by_zero ! dvix218 divideint -1 0.0 -> -Infinity Division_by_zero ! dvix219 divideint -10 0.0 -> -Infinity Division_by_zero ! dvix220 divideint -1E+100 0.0 -> -Infinity Division_by_zero ! dvix221 divideint -1E+1000 0 -> -Infinity Division_by_zero ! ! -- test some cases that are close to exponent overflow ! maxexponent: 999999999 ! minexponent: -999999999 ! dvix270 divideint 1 1e999999999 -> 0 ! dvix271 divideint 1 0.9e999999999 -> 0 ! dvix272 divideint 1 0.99e999999999 -> 0 ! dvix273 divideint 1 0.999999999e999999999 -> 0 ! dvix274 divideint 9e999999999 1 -> NaN Division_impossible ! dvix275 divideint 9.9e999999999 1 -> NaN Division_impossible ! dvix276 divideint 9.99e999999999 1 -> NaN Division_impossible ! dvix277 divideint 9.99999999e999999999 1 -> NaN Division_impossible ! ! dvix280 divideint 0.1 9e-999999999 -> NaN Division_impossible ! dvix281 divideint 0.1 99e-999999999 -> NaN Division_impossible ! dvix282 divideint 0.1 999e-999999999 -> NaN Division_impossible ! ! dvix283 divideint 0.1 9e-999999998 -> NaN Division_impossible ! dvix284 divideint 0.1 99e-999999998 -> NaN Division_impossible ! dvix285 divideint 0.1 999e-999999998 -> NaN Division_impossible ! dvix286 divideint 0.1 999e-999999997 -> NaN Division_impossible ! dvix287 divideint 0.1 9999e-999999997 -> NaN Division_impossible ! dvix288 divideint 0.1 99999e-999999997 -> NaN Division_impossible ! ! ! -- overflow and underflow tests [from divide] ! maxexponent: 999999999 ! minexponent: -999999999 ! dvix330 divideint +1.23456789012345E-0 9E+999999999 -> 0 ! dvix331 divideint 9E+999999999 +0.23456789012345E-0 -> NaN Division_impossible ! dvix332 divideint +0.100 9E+999999999 -> 0 ! dvix333 divideint 9E-999999999 +9.100 -> 0 ! dvix335 divideint -1.23456789012345E-0 9E+999999999 -> -0 ! dvix336 divideint 9E+999999999 -0.83456789012345E-0 -> NaN Division_impossible ! dvix337 divideint -0.100 9E+999999999 -> -0 ! dvix338 divideint 9E-999999999 -9.100 -> -0 ! ! -- long operand checks ! maxexponent: 999 ! minexponent: -999 ! precision: 9 ! dvix401 divideint 12345678000 100 -> 123456780 ! dvix402 divideint 1 12345678000 -> 0 ! dvix403 divideint 1234567800 10 -> 123456780 ! dvix404 divideint 1 1234567800 -> 0 ! dvix405 divideint 1234567890 10 -> 123456789 ! dvix406 divideint 1 1234567890 -> 0 ! dvix407 divideint 1234567891 10 -> 123456789 ! dvix408 divideint 1 1234567891 -> 0 ! dvix409 divideint 12345678901 100 -> 123456789 ! dvix410 divideint 1 12345678901 -> 0 ! dvix411 divideint 1234567896 10 -> 123456789 ! dvix412 divideint 1 1234567896 -> 0 ! dvix413 divideint 12345678948 100 -> 123456789 ! dvix414 divideint 12345678949 100 -> 123456789 ! dvix415 divideint 12345678950 100 -> 123456789 ! dvix416 divideint 12345678951 100 -> 123456789 ! dvix417 divideint 12345678999 100 -> 123456789 ! ! precision: 15 ! dvix441 divideint 12345678000 1 -> 12345678000 ! dvix442 divideint 1 12345678000 -> 0 ! dvix443 divideint 1234567800 1 -> 1234567800 ! dvix444 divideint 1 1234567800 -> 0 ! dvix445 divideint 1234567890 1 -> 1234567890 ! dvix446 divideint 1 1234567890 -> 0 ! dvix447 divideint 1234567891 1 -> 1234567891 ! dvix448 divideint 1 1234567891 -> 0 ! dvix449 divideint 12345678901 1 -> 12345678901 ! dvix450 divideint 1 12345678901 -> 0 ! dvix451 divideint 1234567896 1 -> 1234567896 ! dvix452 divideint 1 1234567896 -> 0 ! ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! ! -- more zeros, etc. ! dvix531 divideint 5.00 1E-3 -> 5000 ! dvix532 divideint 00.00 0.000 -> NaN Division_undefined ! dvix533 divideint 00.00 0E-3 -> NaN Division_undefined ! dvix534 divideint 0 -0 -> NaN Division_undefined ! dvix535 divideint -0 0 -> NaN Division_undefined ! dvix536 divideint -0 -0 -> NaN Division_undefined ! ! dvix541 divideint 0 -1 -> -0 ! dvix542 divideint -0 -1 -> 0 ! dvix543 divideint 0 1 -> 0 ! dvix544 divideint -0 1 -> -0 ! dvix545 divideint -1 0 -> -Infinity Division_by_zero ! dvix546 divideint -1 -0 -> Infinity Division_by_zero ! dvix547 divideint 1 0 -> Infinity Division_by_zero ! dvix548 divideint 1 -0 -> -Infinity Division_by_zero ! ! dvix551 divideint 0.0 -1 -> -0 ! dvix552 divideint -0.0 -1 -> 0 ! dvix553 divideint 0.0 1 -> 0 ! dvix554 divideint -0.0 1 -> -0 ! dvix555 divideint -1.0 0 -> -Infinity Division_by_zero ! dvix556 divideint -1.0 -0 -> Infinity Division_by_zero ! dvix557 divideint 1.0 0 -> Infinity Division_by_zero ! dvix558 divideint 1.0 -0 -> -Infinity Division_by_zero ! ! dvix561 divideint 0 -1.0 -> -0 ! dvix562 divideint -0 -1.0 -> 0 ! dvix563 divideint 0 1.0 -> 0 ! dvix564 divideint -0 1.0 -> -0 ! dvix565 divideint -1 0.0 -> -Infinity Division_by_zero ! dvix566 divideint -1 -0.0 -> Infinity Division_by_zero ! dvix567 divideint 1 0.0 -> Infinity Division_by_zero ! dvix568 divideint 1 -0.0 -> -Infinity Division_by_zero ! ! dvix571 divideint 0.0 -1.0 -> -0 ! dvix572 divideint -0.0 -1.0 -> 0 ! dvix573 divideint 0.0 1.0 -> 0 ! dvix574 divideint -0.0 1.0 -> -0 ! dvix575 divideint -1.0 0.0 -> -Infinity Division_by_zero ! dvix576 divideint -1.0 -0.0 -> Infinity Division_by_zero ! dvix577 divideint 1.0 0.0 -> Infinity Division_by_zero ! dvix578 divideint 1.0 -0.0 -> -Infinity Division_by_zero ! ! -- Specials ! dvix580 divideint Inf -Inf -> NaN Invalid_operation ! dvix581 divideint Inf -1000 -> -Infinity ! dvix582 divideint Inf -1 -> -Infinity ! dvix583 divideint Inf -0 -> -Infinity ! dvix584 divideint Inf 0 -> Infinity ! dvix585 divideint Inf 1 -> Infinity ! dvix586 divideint Inf 1000 -> Infinity ! dvix587 divideint Inf Inf -> NaN Invalid_operation ! dvix588 divideint -1000 Inf -> -0 ! dvix589 divideint -Inf Inf -> NaN Invalid_operation ! dvix590 divideint -1 Inf -> -0 ! dvix591 divideint -0 Inf -> -0 ! dvix592 divideint 0 Inf -> 0 ! dvix593 divideint 1 Inf -> 0 ! dvix594 divideint 1000 Inf -> 0 ! dvix595 divideint Inf Inf -> NaN Invalid_operation ! ! dvix600 divideint -Inf -Inf -> NaN Invalid_operation ! dvix601 divideint -Inf -1000 -> Infinity ! dvix602 divideint -Inf -1 -> Infinity ! dvix603 divideint -Inf -0 -> Infinity ! dvix604 divideint -Inf 0 -> -Infinity ! dvix605 divideint -Inf 1 -> -Infinity ! dvix606 divideint -Inf 1000 -> -Infinity ! dvix607 divideint -Inf Inf -> NaN Invalid_operation ! dvix608 divideint -1000 Inf -> -0 ! dvix609 divideint -Inf -Inf -> NaN Invalid_operation ! dvix610 divideint -1 -Inf -> 0 ! dvix611 divideint -0 -Inf -> 0 ! dvix612 divideint 0 -Inf -> -0 ! dvix613 divideint 1 -Inf -> -0 ! dvix614 divideint 1000 -Inf -> -0 ! dvix615 divideint Inf -Inf -> NaN Invalid_operation ! ! dvix621 divideint NaN -Inf -> NaN ! dvix622 divideint NaN -1000 -> NaN ! dvix623 divideint NaN -1 -> NaN ! dvix624 divideint NaN -0 -> NaN ! dvix625 divideint NaN 0 -> NaN ! dvix626 divideint NaN 1 -> NaN ! dvix627 divideint NaN 1000 -> NaN ! dvix628 divideint NaN Inf -> NaN ! dvix629 divideint NaN NaN -> NaN ! dvix630 divideint -Inf NaN -> NaN ! dvix631 divideint -1000 NaN -> NaN ! dvix632 divideint -1 NaN -> NaN ! dvix633 divideint -0 NaN -> NaN ! dvix634 divideint 0 NaN -> NaN ! dvix635 divideint 1 NaN -> NaN ! dvix636 divideint 1000 NaN -> NaN ! dvix637 divideint Inf NaN -> NaN ! ! dvix641 divideint sNaN -Inf -> NaN Invalid_operation ! dvix642 divideint sNaN -1000 -> NaN Invalid_operation ! dvix643 divideint sNaN -1 -> NaN Invalid_operation ! dvix644 divideint sNaN -0 -> NaN Invalid_operation ! dvix645 divideint sNaN 0 -> NaN Invalid_operation ! dvix646 divideint sNaN 1 -> NaN Invalid_operation ! dvix647 divideint sNaN 1000 -> NaN Invalid_operation ! dvix648 divideint sNaN NaN -> NaN Invalid_operation ! dvix649 divideint sNaN sNaN -> NaN Invalid_operation ! dvix650 divideint NaN sNaN -> NaN Invalid_operation ! dvix651 divideint -Inf sNaN -> NaN Invalid_operation ! dvix652 divideint -1000 sNaN -> NaN Invalid_operation ! dvix653 divideint -1 sNaN -> NaN Invalid_operation ! dvix654 divideint -0 sNaN -> NaN Invalid_operation ! dvix655 divideint 0 sNaN -> NaN Invalid_operation ! dvix656 divideint 1 sNaN -> NaN Invalid_operation ! dvix657 divideint 1000 sNaN -> NaN Invalid_operation ! dvix658 divideint Inf sNaN -> NaN Invalid_operation ! dvix659 divideint NaN sNaN -> NaN Invalid_operation ! ! -- propagating NaNs ! dvix661 divideint NaN9 -Inf -> NaN9 ! dvix662 divideint NaN8 1000 -> NaN8 ! dvix663 divideint NaN7 Inf -> NaN7 ! dvix664 divideint -NaN6 NaN5 -> -NaN6 ! dvix665 divideint -Inf NaN4 -> NaN4 ! dvix666 divideint -1000 NaN3 -> NaN3 ! dvix667 divideint Inf -NaN2 -> -NaN2 ! ! dvix671 divideint -sNaN99 -Inf -> -NaN99 Invalid_operation ! dvix672 divideint sNaN98 -1 -> NaN98 Invalid_operation ! dvix673 divideint sNaN97 NaN -> NaN97 Invalid_operation ! dvix674 divideint sNaN96 sNaN94 -> NaN96 Invalid_operation ! dvix675 divideint NaN95 sNaN93 -> NaN93 Invalid_operation ! dvix676 divideint -Inf sNaN92 -> NaN92 Invalid_operation ! dvix677 divideint 0 sNaN91 -> NaN91 Invalid_operation ! dvix678 divideint Inf -sNaN90 -> -NaN90 Invalid_operation ! dvix679 divideint NaN sNaN89 -> NaN89 Invalid_operation ! ! -- some long operand cases again ! precision: 8 ! dvix710 divideint 100000001 1 -> NaN Division_impossible ! dvix711 divideint 100000000.4 1 -> NaN Division_impossible ! dvix712 divideint 100000000.5 1 -> NaN Division_impossible ! dvix713 divideint 100000000.9 1 -> NaN Division_impossible ! dvix714 divideint 100000000.999 1 -> NaN Division_impossible ! precision: 6 ! dvix720 divideint 100000000 1 -> NaN Division_impossible ! dvix721 divideint 10000000 1 -> NaN Division_impossible ! dvix722 divideint 1000000 1 -> NaN Division_impossible ! dvix723 divideint 100000 1 -> 100000 ! dvix724 divideint 10000 1 -> 10000 ! dvix725 divideint 1000 1 -> 1000 ! dvix726 divideint 100 1 -> 100 ! dvix727 divideint 10 1 -> 10 ! dvix728 divideint 1 1 -> 1 ! dvix729 divideint 1 10 -> 0 ! ! precision: 9 ! maxexponent: 999999999 ! minexponent: -999999999 ! dvix732 divideint 1 0.99e999999999 -> 0 ! dvix733 divideint 1 0.999999999e999999999 -> 0 ! dvix734 divideint 9e999999999 1 -> NaN Division_impossible ! dvix735 divideint 9.9e999999999 1 -> NaN Division_impossible ! dvix736 divideint 9.99e999999999 1 -> NaN Division_impossible ! dvix737 divideint 9.99999999e999999999 1 -> NaN Division_impossible ! ! dvix740 divideint 0.1 9e-999999999 -> NaN Division_impossible ! dvix741 divideint 0.1 99e-999999999 -> NaN Division_impossible ! dvix742 divideint 0.1 999e-999999999 -> NaN Division_impossible ! ! dvix743 divideint 0.1 9e-999999998 -> NaN Division_impossible ! dvix744 divideint 0.1 99e-999999998 -> NaN Division_impossible ! dvix745 divideint 0.1 999e-999999998 -> NaN Division_impossible ! dvix746 divideint 0.1 999e-999999997 -> NaN Division_impossible ! dvix747 divideint 0.1 9999e-999999997 -> NaN Division_impossible ! dvix748 divideint 0.1 99999e-999999997 -> NaN Division_impossible ! ! ! -- Null tests ! dvix900 divideint 10 # -> NaN Invalid_operation ! dvix901 divideint # 10 -> NaN Invalid_operation Index: inexact.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/inexact.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** inexact.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- inexact.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,215 **** ! ------------------------------------------------------------------------ ! -- inexact.decTest -- decimal inexact and rounded edge cases -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.35 ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! ! inx001 add 1 1 -> 2 ! inx002 add 123456789 0 -> 123456789 ! inx003 add 123456789 0.0 -> 123456789 Rounded ! inx004 add 123456789 0.00 -> 123456789 Rounded ! inx005 add 123456789 1 -> 123456790 ! inx006 add 123456789 0.1 -> 123456789 Inexact Rounded ! inx007 add 123456789 0.01 -> 123456789 Inexact Rounded ! inx008 add 123456789 0.001 -> 123456789 Inexact Rounded ! inx009 add 123456789 0.000001 -> 123456789 Inexact Rounded ! inx010 add 123456789 0.000000001 -> 123456789 Inexact Rounded ! inx011 add 123456789 0.000000000001 -> 123456789 Inexact Rounded ! ! inx012 add 123456789 0.9 -> 123456790 Inexact Rounded ! inx013 add 123456789 0.09 -> 123456789 Inexact Rounded ! inx014 add 123456789 0.009 -> 123456789 Inexact Rounded ! inx015 add 123456789 0.000009 -> 123456789 Inexact Rounded ! inx016 add 123456789 0.000000009 -> 123456789 Inexact Rounded ! inx017 add 123456789 0.000000000009 -> 123456789 Inexact Rounded ! ! inx021 add 1 -1 -> 0 ! inx022 add 123456789 -0 -> 123456789 ! inx023 add 123456789 -0.0 -> 123456789 Rounded ! inx024 add 123456789 -0.00 -> 123456789 Rounded ! inx025 add 123456789 -1 -> 123456788 ! inx026 add 123456789 -0.1 -> 123456789 Inexact Rounded ! inx027 add 123456789 -0.01 -> 123456789 Inexact Rounded ! inx028 add 123456789 -0.001 -> 123456789 Inexact Rounded ! inx029 add 123456789 -0.000001 -> 123456789 Inexact Rounded ! inx030 add 123456789 -0.000000001 -> 123456789 Inexact Rounded ! inx031 add 123456789 -0.000000000001 -> 123456789 Inexact Rounded ! inx032 add 123456789 -0.9 -> 123456788 Inexact Rounded ! inx033 add 123456789 -0.09 -> 123456789 Inexact Rounded ! inx034 add 123456789 -0.009 -> 123456789 Inexact Rounded ! inx035 add 123456789 -0.000009 -> 123456789 Inexact Rounded ! inx036 add 123456789 -0.000000009 -> 123456789 Inexact Rounded ! inx037 add 123456789 -0.000000000009 -> 123456789 Inexact Rounded ! ! inx042 add 0 123456789 -> 123456789 ! inx043 add 0.0 123456789 -> 123456789 Rounded ! inx044 add 0.00 123456789 -> 123456789 Rounded ! inx045 add 1 123456789 -> 123456790 ! inx046 add 0.1 123456789 -> 123456789 Inexact Rounded ! inx047 add 0.01 123456789 -> 123456789 Inexact Rounded ! inx048 add 0.001 123456789 -> 123456789 Inexact Rounded ! inx049 add 0.000001 123456789 -> 123456789 Inexact Rounded ! inx050 add 0.000000001 123456789 -> 123456789 Inexact Rounded ! inx051 add 0.000000000001 123456789 -> 123456789 Inexact Rounded ! inx052 add 0.9 123456789 -> 123456790 Inexact Rounded ! inx053 add 0.09 123456789 -> 123456789 Inexact Rounded ! inx054 add 0.009 123456789 -> 123456789 Inexact Rounded ! inx055 add 0.000009 123456789 -> 123456789 Inexact Rounded ! inx056 add 0.000000009 123456789 -> 123456789 Inexact Rounded ! inx057 add 0.000000000009 123456789 -> 123456789 Inexact Rounded ! ! inx062 add -0 123456789 -> 123456789 ! inx063 add -0.0 123456789 -> 123456789 Rounded ! inx064 add -0.00 123456789 -> 123456789 Rounded ! inx065 add -1 123456789 -> 123456788 ! inx066 add -0.1 123456789 -> 123456789 Inexact Rounded ! inx067 add -0.01 123456789 -> 123456789 Inexact Rounded ! inx068 add -0.001 123456789 -> 123456789 Inexact Rounded ! inx069 add -0.000001 123456789 -> 123456789 Inexact Rounded ! inx070 add -0.000000001 123456789 -> 123456789 Inexact Rounded ! inx071 add -0.000000000001 123456789 -> 123456789 Inexact Rounded ! inx072 add -0.9 123456789 -> 123456788 Inexact Rounded ! inx073 add -0.09 123456789 -> 123456789 Inexact Rounded ! inx074 add -0.009 123456789 -> 123456789 Inexact Rounded ! inx075 add -0.000009 123456789 -> 123456789 Inexact Rounded ! inx076 add -0.000000009 123456789 -> 123456789 Inexact Rounded ! inx077 add -0.000000000009 123456789 -> 123456789 Inexact Rounded ! ! -- some boundaries ! inx081 add 999999999 0 -> 999999999 ! inx082 add 0.999999999 0.000000000 -> 0.999999999 ! inx083 add 999999999 1 -> 1.00000000E+9 Rounded ! inx084 add 0.999999999 0.000000001 -> 1.00000000 Rounded ! inx085 add 999999999 2 -> 1.00000000E+9 Inexact Rounded ! inx086 add 0.999999999 0.000000002 -> 1.00000000 Inexact Rounded ! inx087 add 999999999 3 -> 1.00000000E+9 Inexact Rounded ! inx089 add 0.999999999 0.000000003 -> 1.00000000 Inexact Rounded ! ! -- minus, plus, and subtract all assumed to work like add. ! ! -- multiply ! precision: 8 ! inx101 multiply 1000 1000 -> 1000000 ! inx102 multiply 9000 9000 -> 81000000 ! inx103 multiply 9999 9999 -> 99980001 ! inx104 multiply 1000 10000 -> 10000000 ! inx105 multiply 10000 10000 -> 1.0000000E+8 Rounded ! inx106 multiply 10001 10000 -> 1.0001000E+8 Rounded ! inx107 multiply 10001 10001 -> 1.0002000E+8 Inexact Rounded ! inx108 multiply 10101 10001 -> 1.0102010E+8 Inexact Rounded ! inx109 multiply 10001 10101 -> 1.0102010E+8 Inexact Rounded ! ! -- divide ! precision: 4 ! inx201 divide 1000 1000 -> 1 ! inx202 divide 1000 1 -> 1000 ! inx203 divide 1000 2 -> 500 ! inx204 divide 1000 3 -> 333.3 Inexact Rounded ! inx205 divide 1000 4 -> 250 ! inx206 divide 1000 5 -> 200 ! inx207 divide 1000 6 -> 166.7 Inexact Rounded ! inx208 divide 1000 7 -> 142.9 Inexact Rounded ! inx209 divide 1000 8 -> 125 ! inx210 divide 1000 9 -> 111.1 Inexact Rounded ! inx211 divide 1000 10 -> 100 ! ! inx220 divide 1 1 -> 1 ! inx221 divide 1 2 -> 0.5 ! inx222 divide 1 4 -> 0.25 ! inx223 divide 1 8 -> 0.125 ! inx224 divide 1 16 -> 0.0625 ! inx225 divide 1 32 -> 0.03125 ! inx226 divide 1 64 -> 0.01563 Inexact Rounded ! inx227 divide 1 128 -> 0.007813 Inexact Rounded ! ! precision: 5 ! inx230 divide 1 1 -> 1 ! inx231 divide 1 2 -> 0.5 ! inx232 divide 1 4 -> 0.25 ! inx233 divide 1 8 -> 0.125 ! inx234 divide 1 16 -> 0.0625 ! inx235 divide 1 32 -> 0.03125 ! inx236 divide 1 64 -> 0.015625 ! inx237 divide 1 128 -> 0.0078125 ! ! precision: 3 ! inx240 divide 1 1 -> 1 ! inx241 divide 1 2 -> 0.5 ! inx242 divide 1 4 -> 0.25 ! inx243 divide 1 8 -> 0.125 ! inx244 divide 1 16 -> 0.0625 ! inx245 divide 1 32 -> 0.0313 Inexact Rounded ! inx246 divide 1 64 -> 0.0156 Inexact Rounded ! inx247 divide 1 128 -> 0.00781 Inexact Rounded ! ! precision: 2 ! inx250 divide 1 1 -> 1 ! inx251 divide 1 2 -> 0.5 ! inx252 divide 1 4 -> 0.25 ! inx253 divide 1 8 -> 0.13 Inexact Rounded ! inx254 divide 1 16 -> 0.063 Inexact Rounded ! inx255 divide 1 32 -> 0.031 Inexact Rounded ! inx256 divide 1 64 -> 0.016 Inexact Rounded ! inx257 divide 1 128 -> 0.0078 Inexact Rounded ! ! precision: 1 ! inx260 divide 1 1 -> 1 ! inx261 divide 1 2 -> 0.5 ! inx262 divide 1 4 -> 0.3 Inexact Rounded ! inx263 divide 1 8 -> 0.1 Inexact Rounded ! inx264 divide 1 16 -> 0.06 Inexact Rounded ! inx265 divide 1 32 -> 0.03 Inexact Rounded ! inx266 divide 1 64 -> 0.02 Inexact Rounded ! inx267 divide 1 128 -> 0.008 Inexact Rounded ! ! ! -- power ! precision: 4 ! inx301 power 0.5 2 -> 0.25 ! inx302 power 0.5 4 -> 0.0625 ! inx303 power 0.5 8 -> 0.003906 Inexact Rounded ! inx304 power 0.5 16 -> 0.00001526 Inexact Rounded ! inx305 power 0.5 32 -> 2.328E-10 Inexact Rounded ! ! -- compare, divideInteger, and remainder are always exact ! ! -- rescale ! precision: 4 ! inx401 rescale 0 0 -> 0 ! inx402 rescale 1 0 -> 1 ! inx403 rescale 0.1 +2 -> 0E+2 Inexact Rounded ! inx404 rescale 0.1 +1 -> 0E+1 Inexact Rounded ! inx405 rescale 0.1 0 -> 0 Inexact Rounded ! inx406 rescale 0.1 -1 -> 0.1 ! inx407 rescale 0.1 -2 -> 0.10 ! ! -- long operands cause rounding too ! precision: 9 ! inx801 plus 123456789 -> 123456789 ! inx802 plus 1234567890 -> 1.23456789E+9 Rounded ! inx803 plus 1234567891 -> 1.23456789E+9 Inexact Rounded ! inx804 plus 1234567892 -> 1.23456789E+9 Inexact Rounded ! inx805 plus 1234567899 -> 1.23456790E+9 Inexact Rounded ! inx806 plus 1234567900 -> 1.23456790E+9 Rounded ! --- 1,215 ---- ! ------------------------------------------------------------------------ ! -- inexact.decTest -- decimal inexact and rounded edge cases -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.38 ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! ! inx001 add 1 1 -> 2 ! inx002 add 123456789 0 -> 123456789 ! inx003 add 123456789 0.0 -> 123456789 Rounded ! inx004 add 123456789 0.00 -> 123456789 Rounded ! inx005 add 123456789 1 -> 123456790 ! inx006 add 123456789 0.1 -> 123456789 Inexact Rounded ! inx007 add 123456789 0.01 -> 123456789 Inexact Rounded ! inx008 add 123456789 0.001 -> 123456789 Inexact Rounded ! inx009 add 123456789 0.000001 -> 123456789 Inexact Rounded ! inx010 add 123456789 0.000000001 -> 123456789 Inexact Rounded ! inx011 add 123456789 0.000000000001 -> 123456789 Inexact Rounded ! ! inx012 add 123456789 0.9 -> 123456790 Inexact Rounded ! inx013 add 123456789 0.09 -> 123456789 Inexact Rounded ! inx014 add 123456789 0.009 -> 123456789 Inexact Rounded ! inx015 add 123456789 0.000009 -> 123456789 Inexact Rounded ! inx016 add 123456789 0.000000009 -> 123456789 Inexact Rounded ! inx017 add 123456789 0.000000000009 -> 123456789 Inexact Rounded ! ! inx021 add 1 -1 -> 0 ! inx022 add 123456789 -0 -> 123456789 ! inx023 add 123456789 -0.0 -> 123456789 Rounded ! inx024 add 123456789 -0.00 -> 123456789 Rounded ! inx025 add 123456789 -1 -> 123456788 ! inx026 add 123456789 -0.1 -> 123456789 Inexact Rounded ! inx027 add 123456789 -0.01 -> 123456789 Inexact Rounded ! inx028 add 123456789 -0.001 -> 123456789 Inexact Rounded ! inx029 add 123456789 -0.000001 -> 123456789 Inexact Rounded ! inx030 add 123456789 -0.000000001 -> 123456789 Inexact Rounded ! inx031 add 123456789 -0.000000000001 -> 123456789 Inexact Rounded ! inx032 add 123456789 -0.9 -> 123456788 Inexact Rounded ! inx033 add 123456789 -0.09 -> 123456789 Inexact Rounded ! inx034 add 123456789 -0.009 -> 123456789 Inexact Rounded ! inx035 add 123456789 -0.000009 -> 123456789 Inexact Rounded ! inx036 add 123456789 -0.000000009 -> 123456789 Inexact Rounded ! inx037 add 123456789 -0.000000000009 -> 123456789 Inexact Rounded ! ! inx042 add 0 123456789 -> 123456789 ! inx043 add 0.0 123456789 -> 123456789 Rounded ! inx044 add 0.00 123456789 -> 123456789 Rounded ! inx045 add 1 123456789 -> 123456790 ! inx046 add 0.1 123456789 -> 123456789 Inexact Rounded ! inx047 add 0.01 123456789 -> 123456789 Inexact Rounded ! inx048 add 0.001 123456789 -> 123456789 Inexact Rounded ! inx049 add 0.000001 123456789 -> 123456789 Inexact Rounded ! inx050 add 0.000000001 123456789 -> 123456789 Inexact Rounded ! inx051 add 0.000000000001 123456789 -> 123456789 Inexact Rounded ! inx052 add 0.9 123456789 -> 123456790 Inexact Rounded ! inx053 add 0.09 123456789 -> 123456789 Inexact Rounded ! inx054 add 0.009 123456789 -> 123456789 Inexact Rounded ! inx055 add 0.000009 123456789 -> 123456789 Inexact Rounded ! inx056 add 0.000000009 123456789 -> 123456789 Inexact Rounded ! inx057 add 0.000000000009 123456789 -> 123456789 Inexact Rounded ! ! inx062 add -0 123456789 -> 123456789 ! inx063 add -0.0 123456789 -> 123456789 Rounded ! inx064 add -0.00 123456789 -> 123456789 Rounded ! inx065 add -1 123456789 -> 123456788 ! inx066 add -0.1 123456789 -> 123456789 Inexact Rounded ! inx067 add -0.01 123456789 -> 123456789 Inexact Rounded ! inx068 add -0.001 123456789 -> 123456789 Inexact Rounded ! inx069 add -0.000001 123456789 -> 123456789 Inexact Rounded ! inx070 add -0.000000001 123456789 -> 123456789 Inexact Rounded ! inx071 add -0.000000000001 123456789 -> 123456789 Inexact Rounded ! inx072 add -0.9 123456789 -> 123456788 Inexact Rounded ! inx073 add -0.09 123456789 -> 123456789 Inexact Rounded ! inx074 add -0.009 123456789 -> 123456789 Inexact Rounded ! inx075 add -0.000009 123456789 -> 123456789 Inexact Rounded ! inx076 add -0.000000009 123456789 -> 123456789 Inexact Rounded ! inx077 add -0.000000000009 123456789 -> 123456789 Inexact Rounded ! ! -- some boundaries ! inx081 add 999999999 0 -> 999999999 ! inx082 add 0.999999999 0.000000000 -> 0.999999999 ! inx083 add 999999999 1 -> 1.00000000E+9 Rounded ! inx084 add 0.999999999 0.000000001 -> 1.00000000 Rounded ! inx085 add 999999999 2 -> 1.00000000E+9 Inexact Rounded ! inx086 add 0.999999999 0.000000002 -> 1.00000000 Inexact Rounded ! inx087 add 999999999 3 -> 1.00000000E+9 Inexact Rounded ! inx089 add 0.999999999 0.000000003 -> 1.00000000 Inexact Rounded ! ! -- minus, plus, and subtract all assumed to work like add. ! ! -- multiply ! precision: 8 ! inx101 multiply 1000 1000 -> 1000000 ! inx102 multiply 9000 9000 -> 81000000 ! inx103 multiply 9999 9999 -> 99980001 ! inx104 multiply 1000 10000 -> 10000000 ! inx105 multiply 10000 10000 -> 1.0000000E+8 Rounded ! inx106 multiply 10001 10000 -> 1.0001000E+8 Rounded ! inx107 multiply 10001 10001 -> 1.0002000E+8 Inexact Rounded ! inx108 multiply 10101 10001 -> 1.0102010E+8 Inexact Rounded ! inx109 multiply 10001 10101 -> 1.0102010E+8 Inexact Rounded ! ! -- divide ! precision: 4 ! inx201 divide 1000 1000 -> 1 ! inx202 divide 1000 1 -> 1000 ! inx203 divide 1000 2 -> 500 ! inx204 divide 1000 3 -> 333.3 Inexact Rounded ! inx205 divide 1000 4 -> 250 ! inx206 divide 1000 5 -> 200 ! inx207 divide 1000 6 -> 166.7 Inexact Rounded ! inx208 divide 1000 7 -> 142.9 Inexact Rounded ! inx209 divide 1000 8 -> 125 ! inx210 divide 1000 9 -> 111.1 Inexact Rounded ! inx211 divide 1000 10 -> 100 ! ! inx220 divide 1 1 -> 1 ! inx221 divide 1 2 -> 0.5 ! inx222 divide 1 4 -> 0.25 ! inx223 divide 1 8 -> 0.125 ! inx224 divide 1 16 -> 0.0625 ! inx225 divide 1 32 -> 0.03125 ! inx226 divide 1 64 -> 0.01563 Inexact Rounded ! inx227 divide 1 128 -> 0.007813 Inexact Rounded ! ! precision: 5 ! inx230 divide 1 1 -> 1 ! inx231 divide 1 2 -> 0.5 ! inx232 divide 1 4 -> 0.25 ! inx233 divide 1 8 -> 0.125 ! inx234 divide 1 16 -> 0.0625 ! inx235 divide 1 32 -> 0.03125 ! inx236 divide 1 64 -> 0.015625 ! inx237 divide 1 128 -> 0.0078125 ! ! precision: 3 ! inx240 divide 1 1 -> 1 ! inx241 divide 1 2 -> 0.5 ! inx242 divide 1 4 -> 0.25 ! inx243 divide 1 8 -> 0.125 ! inx244 divide 1 16 -> 0.0625 ! inx245 divide 1 32 -> 0.0313 Inexact Rounded ! inx246 divide 1 64 -> 0.0156 Inexact Rounded ! inx247 divide 1 128 -> 0.00781 Inexact Rounded ! ! precision: 2 ! inx250 divide 1 1 -> 1 ! inx251 divide 1 2 -> 0.5 ! inx252 divide 1 4 -> 0.25 ! inx253 divide 1 8 -> 0.13 Inexact Rounded ! inx254 divide 1 16 -> 0.063 Inexact Rounded ! inx255 divide 1 32 -> 0.031 Inexact Rounded ! inx256 divide 1 64 -> 0.016 Inexact Rounded ! inx257 divide 1 128 -> 0.0078 Inexact Rounded ! ! precision: 1 ! inx260 divide 1 1 -> 1 ! inx261 divide 1 2 -> 0.5 ! inx262 divide 1 4 -> 0.3 Inexact Rounded ! inx263 divide 1 8 -> 0.1 Inexact Rounded ! inx264 divide 1 16 -> 0.06 Inexact Rounded ! inx265 divide 1 32 -> 0.03 Inexact Rounded ! inx266 divide 1 64 -> 0.02 Inexact Rounded ! inx267 divide 1 128 -> 0.008 Inexact Rounded ! ! ! -- power ! precision: 4 ! inx301 power 0.5 2 -> 0.25 ! inx302 power 0.5 4 -> 0.0625 ! inx303 power 0.5 8 -> 0.003906 Inexact Rounded ! inx304 power 0.5 16 -> 0.00001526 Inexact Rounded ! inx305 power 0.5 32 -> 2.328E-10 Inexact Rounded ! ! -- compare, divideInteger, and remainder are always exact ! ! -- rescale ! precision: 4 ! inx401 rescale 0 0 -> 0 ! inx402 rescale 1 0 -> 1 ! inx403 rescale 0.1 +2 -> 0E+2 Inexact Rounded ! inx404 rescale 0.1 +1 -> 0E+1 Inexact Rounded ! inx405 rescale 0.1 0 -> 0 Inexact Rounded ! inx406 rescale 0.1 -1 -> 0.1 ! inx407 rescale 0.1 -2 -> 0.10 ! ! -- long operands cause rounding too ! precision: 9 ! inx801 plus 123456789 -> 123456789 ! inx802 plus 1234567890 -> 1.23456789E+9 Rounded ! inx803 plus 1234567891 -> 1.23456789E+9 Inexact Rounded ! inx804 plus 1234567892 -> 1.23456789E+9 Inexact Rounded ! inx805 plus 1234567899 -> 1.23456790E+9 Inexact Rounded ! inx806 plus 1234567900 -> 1.23456790E+9 Rounded ! Index: max.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/max.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** max.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- max.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,300 **** ! ------------------------------------------------------------------------ ! -- max.decTest -- decimal maximum -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.35 ! ! -- we assume that base comparison is tested in compare.decTest, so ! -- these mainly cover special cases and rounding ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! ! -- sanity checks ! maxx001 max -2 -2 -> -2 ! maxx002 max -2 -1 -> -1 ! maxx003 max -2 0 -> 0 ! maxx004 max -2 1 -> 1 ! maxx005 max -2 2 -> 2 ! maxx006 max -1 -2 -> -1 ! maxx007 max -1 -1 -> -1 ! maxx008 max -1 0 -> 0 ! maxx009 max -1 1 -> 1 ! maxx010 max -1 2 -> 2 ! maxx011 max 0 -2 -> 0 ! maxx012 max 0 -1 -> 0 ! maxx013 max 0 0 -> 0 ! maxx014 max 0 1 -> 1 ! maxx015 max 0 2 -> 2 ! maxx016 max 1 -2 -> 1 ! maxx017 max 1 -1 -> 1 ! maxx018 max 1 0 -> 1 ! maxx019 max 1 1 -> 1 ! maxx020 max 1 2 -> 2 ! maxx021 max 2 -2 -> 2 ! maxx022 max 2 -1 -> 2 ! maxx023 max 2 0 -> 2 ! maxx025 max 2 1 -> 2 ! maxx026 max 2 2 -> 2 ! ! -- extended zeros ! maxx030 max 0 0 -> 0 ! maxx031 max 0 -0 -> 0 ! maxx032 max 0 -0.0 -> 0 ! maxx033 max 0 0.0 -> 0 ! maxx034 max -0 0 -> -0 -- note: -0 = 0 ! maxx035 max -0 -0 -> -0 ! maxx036 max -0 -0.0 -> -0 ! maxx037 max -0 0.0 -> -0 ! maxx038 max 0.0 0 -> 0.0 ! maxx039 max 0.0 -0 -> 0.0 ! maxx040 max 0.0 -0.0 -> 0.0 ! maxx041 max 0.0 0.0 -> 0.0 ! maxx042 max -0.0 0 -> -0.0 ! maxx043 max -0.0 -0 -> -0.0 ! maxx044 max -0.0 -0.0 -> -0.0 ! maxx045 max -0.0 0.0 -> -0.0 ! ! maxx046 max -0E1 0E2 -> -0E+1 ! maxx047 max 0E2 0E1 -> 0E+2 ! maxx048 max 0E1 0E2 -> 0E+1 ! maxx049 max -0E3 -0E2 -> -0E+3 ! ! ! -- Specials ! precision: 9 ! maxx090 max Inf -Inf -> Infinity ! maxx091 max Inf -1000 -> Infinity ! maxx092 max Inf -1 -> Infinity ! maxx093 max Inf -0 -> Infinity ! maxx094 max Inf 0 -> Infinity ! maxx095 max Inf 1 -> Infinity ! maxx096 max Inf 1000 -> Infinity ! maxx097 max Inf Inf -> Infinity ! maxx098 max -1000 Inf -> Infinity ! maxx099 max -Inf Inf -> Infinity ! maxx100 max -1 Inf -> Infinity ! maxx101 max -0 Inf -> Infinity ! maxx102 max 0 Inf -> Infinity ! maxx103 max 1 Inf -> Infinity ! maxx104 max 1000 Inf -> Infinity ! maxx105 max Inf Inf -> Infinity ! ! maxx120 max -Inf -Inf -> -Infinity ! maxx121 max -Inf -1000 -> -1000 ! maxx122 max -Inf -1 -> -1 ! maxx123 max -Inf -0 -> -0 ! maxx124 max -Inf 0 -> 0 ! maxx125 max -Inf 1 -> 1 ! maxx126 max -Inf 1000 -> 1000 ! maxx127 max -Inf Inf -> Infinity ! maxx128 max -Inf -Inf -> -Infinity ! maxx129 max -1000 -Inf -> -1000 ! maxx130 max -1 -Inf -> -1 ! maxx131 max -0 -Inf -> -0 ! maxx132 max 0 -Inf -> 0 ! maxx133 max 1 -Inf -> 1 ! maxx134 max 1000 -Inf -> 1000 ! maxx135 max Inf -Inf -> Infinity ! ! maxx141 max NaN -Inf -> NaN ! maxx142 max NaN -1000 -> NaN ! maxx143 max NaN -1 -> NaN ! maxx144 max NaN -0 -> NaN ! maxx145 max NaN 0 -> NaN ! maxx146 max NaN 1 -> NaN ! maxx147 max NaN 1000 -> NaN ! maxx148 max NaN Inf -> NaN ! maxx149 max NaN NaN -> NaN ! maxx150 max -Inf NaN -> NaN ! maxx151 max -1000 NaN -> NaN ! maxx152 max -1 NaN -> NaN ! maxx153 max -0 NaN -> NaN ! maxx154 max 0 NaN -> NaN ! maxx155 max 1 NaN -> NaN ! maxx156 max 1000 NaN -> NaN ! maxx157 max Inf NaN -> NaN ! ! maxx161 max sNaN -Inf -> NaN Invalid_operation ! maxx162 max sNaN -1000 -> NaN Invalid_operation ! maxx163 max sNaN -1 -> NaN Invalid_operation ! maxx164 max sNaN -0 -> NaN Invalid_operation ! maxx165 max sNaN 0 -> NaN Invalid_operation ! maxx166 max sNaN 1 -> NaN Invalid_operation ! maxx167 max sNaN 1000 -> NaN Invalid_operation ! maxx168 max sNaN NaN -> NaN Invalid_operation ! maxx169 max sNaN sNaN -> NaN Invalid_operation ! maxx170 max NaN sNaN -> NaN Invalid_operation ! maxx171 max -Inf sNaN -> NaN Invalid_operation ! maxx172 max -1000 sNaN -> NaN Invalid_operation ! maxx173 max -1 sNaN -> NaN Invalid_operation ! maxx174 max -0 sNaN -> NaN Invalid_operation ! maxx175 max 0 sNaN -> NaN Invalid_operation ! maxx176 max 1 sNaN -> NaN Invalid_operation ! maxx177 max 1000 sNaN -> NaN Invalid_operation ! maxx178 max Inf sNaN -> NaN Invalid_operation ! maxx179 max NaN sNaN -> NaN Invalid_operation ! ! -- propagating NaNs ! maxx181 max NaN9 -Inf -> NaN9 ! maxx182 max NaN8 9 -> NaN8 ! maxx183 max -NaN7 Inf -> -NaN7 ! maxx184 max NaN6 NaN5 -> NaN6 ! maxx185 max -Inf NaN4 -> NaN4 ! maxx186 max -9 -NaN3 -> -NaN3 ! maxx187 max Inf NaN2 -> NaN2 ! ! maxx191 max sNaN99 -Inf -> NaN99 Invalid_operation ! maxx192 max sNaN98 -1 -> NaN98 Invalid_operation ! maxx193 max -sNaN97 NaN -> -NaN97 Invalid_operation ! maxx194 max sNaN96 sNaN94 -> NaN96 Invalid_operation ! maxx195 max NaN95 sNaN93 -> NaN93 Invalid_operation ! maxx196 max -Inf sNaN92 -> NaN92 Invalid_operation ! maxx197 max 0 sNaN91 -> NaN91 Invalid_operation ! maxx198 max Inf -sNaN90 -> -NaN90 Invalid_operation ! maxx199 max NaN sNaN89 -> NaN89 Invalid_operation ! ! -- rounding checks ! maxexponent: 999 ! minexponent: -999 ! precision: 9 ! maxx201 max 12345678000 1 -> 1.23456780E+10 Rounded ! maxx202 max 1 12345678000 -> 1.23456780E+10 Rounded ! maxx203 max 1234567800 1 -> 1.23456780E+9 Rounded ! maxx204 max 1 1234567800 -> 1.23456780E+9 Rounded ! maxx205 max 1234567890 1 -> 1.23456789E+9 Rounded ! maxx206 max 1 1234567890 -> 1.23456789E+9 Rounded ! maxx207 max 1234567891 1 -> 1.23456789E+9 Inexact Rounded ! maxx208 max 1 1234567891 -> 1.23456789E+9 Inexact Rounded ! maxx209 max 12345678901 1 -> 1.23456789E+10 Inexact Rounded ! maxx210 max 1 12345678901 -> 1.23456789E+10 Inexact Rounded ! maxx211 max 1234567896 1 -> 1.23456790E+9 Inexact Rounded ! maxx212 max 1 1234567896 -> 1.23456790E+9 Inexact Rounded ! maxx213 max -1234567891 1 -> 1 ! maxx214 max 1 -1234567891 -> 1 ! maxx215 max -12345678901 1 -> 1 ! maxx216 max 1 -12345678901 -> 1 ! maxx217 max -1234567896 1 -> 1 ! maxx218 max 1 -1234567896 -> 1 ! ! precision: 15 ! maxx221 max 12345678000 1 -> 12345678000 ! maxx222 max 1 12345678000 -> 12345678000 ! maxx223 max 1234567800 1 -> 1234567800 ! maxx224 max 1 1234567800 -> 1234567800 ! maxx225 max 1234567890 1 -> 1234567890 ! maxx226 max 1 1234567890 -> 1234567890 ! maxx227 max 1234567891 1 -> 1234567891 ! maxx228 max 1 1234567891 -> 1234567891 ! maxx229 max 12345678901 1 -> 12345678901 ! maxx230 max 1 12345678901 -> 12345678901 ! maxx231 max 1234567896 1 -> 1234567896 ! maxx232 max 1 1234567896 -> 1234567896 ! maxx233 max -1234567891 1 -> 1 ! maxx234 max 1 -1234567891 -> 1 ! maxx235 max -12345678901 1 -> 1 ! maxx236 max 1 -12345678901 -> 1 ! maxx237 max -1234567896 1 -> 1 ! maxx238 max 1 -1234567896 -> 1 ! ! -- from examples ! maxx280 max '3' '2' -> '3' ! maxx281 max '-10' '3' -> '3' ! maxx282 max '1.0' '1' -> '1.0' ! maxx283 max '1' '1.0' -> '1' ! ! -- overflow and underflow tests ... ! maxExponent: 999999999 ! minexponent: -999999999 ! maxx330 max +1.23456789012345E-0 9E+999999999 -> 9E+999999999 ! maxx331 max 9E+999999999 +1.23456789012345E-0 -> 9E+999999999 ! maxx332 max +0.100 9E-999999999 -> 0.100 ! maxx333 max 9E-999999999 +0.100 -> 0.100 ! maxx335 max -1.23456789012345E-0 9E+999999999 -> 9E+999999999 ! maxx336 max 9E+999999999 -1.23456789012345E-0 -> 9E+999999999 ! maxx337 max -0.100 9E-999999999 -> 9E-999999999 ! maxx338 max 9E-999999999 -0.100 -> 9E-999999999 ! ! maxx339 max 1e-599999999 1e-400000001 -> 1E-400000001 ! maxx340 max 1e-599999999 1e-400000000 -> 1E-400000000 ! maxx341 max 1e-600000000 1e-400000000 -> 1E-400000000 ! maxx342 max 9e-999999998 0.01 -> 0.01 ! maxx343 max 9e-999999998 0.1 -> 0.1 ! maxx344 max 0.01 9e-999999998 -> 0.01 ! maxx345 max 1e599999999 1e400000001 -> 1E+599999999 ! maxx346 max 1e599999999 1e400000000 -> 1E+599999999 ! maxx347 max 1e600000000 1e400000000 -> 1E+600000000 ! maxx348 max 9e999999998 100 -> 9E+999999998 ! maxx349 max 9e999999998 10 -> 9E+999999998 ! maxx350 max 100 9e999999998 -> 9E+999999998 ! -- signs ! maxx351 max 1e+777777777 1e+411111111 -> 1E+777777777 ! maxx352 max 1e+777777777 -1e+411111111 -> 1E+777777777 ! maxx353 max -1e+777777777 1e+411111111 -> 1E+411111111 ! maxx354 max -1e+777777777 -1e+411111111 -> -1E+411111111 ! maxx355 max 1e-777777777 1e-411111111 -> 1E-411111111 ! maxx356 max 1e-777777777 -1e-411111111 -> 1E-777777777 ! maxx357 max -1e-777777777 1e-411111111 -> 1E-411111111 ! maxx358 max -1e-777777777 -1e-411111111 -> -1E-777777777 ! ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! maxx400 max 9.999E+999999999 0 -> Infinity Inexact Overflow Rounded ! maxx401 max -9.999E+999999999 0 -> 0 ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! maxx410 max 1.00E-999 0 -> 1.00E-999 ! maxx411 max 0.1E-999 0 -> 1E-1000 Subnormal ! maxx412 max 0.10E-999 0 -> 1.0E-1000 Subnormal ! maxx413 max 0.100E-999 0 -> 1.0E-1000 Subnormal Rounded ! maxx414 max 0.01E-999 0 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! maxx415 max 0.999E-999 0 -> 1.00E-999 Inexact Rounded Subnormal Underflow ! maxx416 max 0.099E-999 0 -> 1.0E-1000 Inexact Rounded Subnormal Underflow ! maxx417 max 0.009E-999 0 -> 1E-1001 Inexact Rounded Subnormal Underflow ! maxx418 max 0.001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow ! maxx419 max 0.0009E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow ! maxx420 max 0.0001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow ! ! maxx430 max -1.00E-999 0 -> 0 ! maxx431 max -0.1E-999 0 -> 0 ! maxx432 max -0.10E-999 0 -> 0 ! maxx433 max -0.100E-999 0 -> 0 ! maxx434 max -0.01E-999 0 -> 0 ! maxx435 max -0.999E-999 0 -> 0 ! maxx436 max -0.099E-999 0 -> 0 ! maxx437 max -0.009E-999 0 -> 0 ! maxx438 max -0.001E-999 0 -> 0 ! maxx439 max -0.0009E-999 0 -> 0 ! maxx440 max -0.0001E-999 0 -> 0 ! ! -- Null tests ! maxx900 max 10 # -> NaN Invalid_operation ! maxx901 max # 10 -> NaN Invalid_operation ! ! ! --- 1,300 ---- ! ------------------------------------------------------------------------ ! -- max.decTest -- decimal maximum -- ! -- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.38 ! ! -- we assume that base comparison is tested in compare.decTest, so ! -- these mainly cover special cases and rounding ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 384 ! minexponent: -383 ! ! -- sanity checks ! maxx001 max -2 -2 -> -2 ! maxx002 max -2 -1 -> -1 ! maxx003 max -2 0 -> 0 ! maxx004 max -2 1 -> 1 ! maxx005 max -2 2 -> 2 ! maxx006 max -1 -2 -> -1 ! maxx007 max -1 -1 -> -1 ! maxx008 max -1 0 -> 0 ! maxx009 max -1 1 -> 1 ! maxx010 max -1 2 -> 2 ! maxx011 max 0 -2 -> 0 ! maxx012 max 0 -1 -> 0 ! maxx013 max 0 0 -> 0 ! maxx014 max 0 1 -> 1 ! maxx015 max 0 2 -> 2 ! maxx016 max 1 -2 -> 1 ! maxx017 max 1 -1 -> 1 ! maxx018 max 1 0 -> 1 ! maxx019 max 1 1 -> 1 ! maxx020 max 1 2 -> 2 ! maxx021 max 2 -2 -> 2 ! maxx022 max 2 -1 -> 2 ! maxx023 max 2 0 -> 2 ! maxx025 max 2 1 -> 2 ! maxx026 max 2 2 -> 2 ! ! -- extended zeros ! maxx030 max 0 0 -> 0 ! maxx031 max 0 -0 -> 0 ! maxx032 max 0 -0.0 -> 0 ! maxx033 max 0 0.0 -> 0 ! maxx034 max -0 0 -> -0 -- note: -0 = 0 ! maxx035 max -0 -0 -> -0 ! maxx036 max -0 -0.0 -> -0 ! maxx037 max -0 0.0 -> -0 ! maxx038 max 0.0 0 -> 0.0 ! maxx039 max 0.0 -0 -> 0.0 ! maxx040 max 0.0 -0.0 -> 0.0 ! maxx041 max 0.0 0.0 -> 0.0 ! maxx042 max -0.0 0 -> -0.0 ! maxx043 max -0.0 -0 -> -0.0 ! maxx044 max -0.0 -0.0 -> -0.0 ! maxx045 max -0.0 0.0 -> -0.0 ! ! maxx046 max -0E1 0E2 -> -0E+1 ! maxx047 max 0E2 0E1 -> 0E+2 ! maxx048 max 0E1 0E2 -> 0E+1 ! maxx049 max -0E3 -0E2 -> -0E+3 ! ! ! -- Specials ! precision: 9 ! maxx090 max Inf -Inf -> Infinity ! maxx091 max Inf -1000 -> Infinity ! maxx092 max Inf -1 -> Infinity ! maxx093 max Inf -0 -> Infinity ! maxx094 max Inf 0 -> Infinity ! maxx095 max Inf 1 -> Infinity ! maxx096 max Inf 1000 -> Infinity ! maxx097 max Inf Inf -> Infinity ! maxx098 max -1000 Inf -> Infinity ! maxx099 max -Inf Inf -> Infinity ! maxx100 max -1 Inf -> Infinity ! maxx101 max -0 Inf -> Infinity ! maxx102 max 0 Inf -> Infinity ! maxx103 max 1 Inf -> Infinity ! maxx104 max 1000 Inf -> Infinity ! maxx105 max Inf Inf -> Infinity ! ! maxx120 max -Inf -Inf -> -Infinity ! maxx121 max -Inf -1000 -> -1000 ! maxx122 max -Inf -1 -> -1 ! maxx123 max -Inf -0 -> -0 ! maxx124 max -Inf 0 -> 0 ! maxx125 max -Inf 1 -> 1 ! maxx126 max -Inf 1000 -> 1000 ! maxx127 max -Inf Inf -> Infinity ! maxx128 max -Inf -Inf -> -Infinity ! maxx129 max -1000 -Inf -> -1000 ! maxx130 max -1 -Inf -> -1 ! maxx131 max -0 -Inf -> -0 ! maxx132 max 0 -Inf -> 0 ! maxx133 max 1 -Inf -> 1 ! maxx134 max 1000 -Inf -> 1000 ! maxx135 max Inf -Inf -> Infinity ! ! maxx141 max NaN -Inf -> NaN ! maxx142 max NaN -1000 -> NaN ! maxx143 max NaN -1 -> NaN ! maxx144 max NaN -0 -> NaN ! maxx145 max NaN 0 -> NaN ! maxx146 max NaN 1 -> NaN ! maxx147 max NaN 1000 -> NaN ! maxx148 max NaN Inf -> NaN ! maxx149 max NaN NaN -> NaN ! maxx150 max -Inf NaN -> NaN ! maxx151 max -1000 NaN -> NaN ! maxx152 max -1 NaN -> NaN ! maxx153 max -0 NaN -> NaN ! maxx154 max 0 NaN -> NaN ! maxx155 max 1 NaN -> NaN ! maxx156 max 1000 NaN -> NaN ! maxx157 max Inf NaN -> NaN ! ! maxx161 max sNaN -Inf -> NaN Invalid_operation ! maxx162 max sNaN -1000 -> NaN Invalid_operation ! maxx163 max sNaN -1 -> NaN Invalid_operation ! maxx164 max sNaN -0 -> NaN Invalid_operation ! maxx165 max sNaN 0 -> NaN Invalid_operation ! maxx166 max sNaN 1 -> NaN Invalid_operation ! maxx167 max sNaN 1000 -> NaN Invalid_operation ! maxx168 max sNaN NaN -> NaN Invalid_operation ! maxx169 max sNaN sNaN -> NaN Invalid_operation ! maxx170 max NaN sNaN -> NaN Invalid_operation ! maxx171 max -Inf sNaN -> NaN Invalid_operation ! maxx172 max -1000 sNaN -> NaN Invalid_operation ! maxx173 max -1 sNaN -> NaN Invalid_operation ! maxx174 max -0 sNaN -> NaN Invalid_operation ! maxx175 max 0 sNaN -> NaN Invalid_operation ! maxx176 max 1 sNaN -> NaN Invalid_operation ! maxx177 max 1000 sNaN -> NaN Invalid_operation ! maxx178 max Inf sNaN -> NaN Invalid_operation ! maxx179 max NaN sNaN -> NaN Invalid_operation ! ! -- propagating NaNs ! maxx181 max NaN9 -Inf -> NaN9 ! maxx182 max NaN8 9 -> NaN8 ! maxx183 max -NaN7 Inf -> -NaN7 ! maxx184 max NaN6 NaN5 -> NaN6 ! maxx185 max -Inf NaN4 -> NaN4 ! maxx186 max -9 -NaN3 -> -NaN3 ! maxx187 max Inf NaN2 -> NaN2 ! ! maxx191 max sNaN99 -Inf -> NaN99 Invalid_operation ! maxx192 max sNaN98 -1 -> NaN98 Invalid_operation ! maxx193 max -sNaN97 NaN -> -NaN97 Invalid_operation ! maxx194 max sNaN96 sNaN94 -> NaN96 Invalid_operation ! maxx195 max NaN95 sNaN93 -> NaN93 Invalid_operation ! maxx196 max -Inf sNaN92 -> NaN92 Invalid_operation ! maxx197 max 0 sNaN91 -> NaN91 Invalid_operation ! maxx198 max Inf -sNaN90 -> -NaN90 Invalid_operation ! maxx199 max NaN sNaN89 -> NaN89 Invalid_operation ! ! -- rounding checks ! maxexponent: 999 ! minexponent: -999 ! precision: 9 ! maxx201 max 12345678000 1 -> 1.23456780E+10 Rounded ! maxx202 max 1 12345678000 -> 1.23456780E+10 Rounded ! maxx203 max 1234567800 1 -> 1.23456780E+9 Rounded ! maxx204 max 1 1234567800 -> 1.23456780E+9 Rounded ! maxx205 max 1234567890 1 -> 1.23456789E+9 Rounded ! maxx206 max 1 1234567890 -> 1.23456789E+9 Rounded ! maxx207 max 1234567891 1 -> 1.23456789E+9 Inexact Rounded ! maxx208 max 1 1234567891 -> 1.23456789E+9 Inexact Rounded ! maxx209 max 12345678901 1 -> 1.23456789E+10 Inexact Rounded ! maxx210 max 1 12345678901 -> 1.23456789E+10 Inexact Rounded ! maxx211 max 1234567896 1 -> 1.23456790E+9 Inexact Rounded ! maxx212 max 1 1234567896 -> 1.23456790E+9 Inexact Rounded ! maxx213 max -1234567891 1 -> 1 ! maxx214 max 1 -1234567891 -> 1 ! maxx215 max -12345678901 1 -> 1 ! maxx216 max 1 -12345678901 -> 1 ! maxx217 max -1234567896 1 -> 1 ! maxx218 max 1 -1234567896 -> 1 ! ! precision: 15 ! maxx221 max 12345678000 1 -> 12345678000 ! maxx222 max 1 12345678000 -> 12345678000 ! maxx223 max 1234567800 1 -> 1234567800 ! maxx224 max 1 1234567800 -> 1234567800 ! maxx225 max 1234567890 1 -> 1234567890 ! maxx226 max 1 1234567890 -> 1234567890 ! maxx227 max 1234567891 1 -> 1234567891 ! maxx228 max 1 1234567891 -> 1234567891 ! maxx229 max 12345678901 1 -> 12345678901 ! maxx230 max 1 12345678901 -> 12345678901 ! maxx231 max 1234567896 1 -> 1234567896 ! maxx232 max 1 1234567896 -> 1234567896 ! maxx233 max -1234567891 1 -> 1 ! maxx234 max 1 -1234567891 -> 1 ! maxx235 max -12345678901 1 -> 1 ! maxx236 max 1 -12345678901 -> 1 ! maxx237 max -1234567896 1 -> 1 ! maxx238 max 1 -1234567896 -> 1 ! ! -- from examples ! maxx280 max '3' '2' -> '3' ! maxx281 max '-10' '3' -> '3' ! maxx282 max '1.0' '1' -> '1.0' ! maxx283 max '1' '1.0' -> '1' ! ! -- overflow and underflow tests ... ! maxExponent: 999999999 ! minexponent: -999999999 ! maxx330 max +1.23456789012345E-0 9E+999999999 -> 9E+999999999 ! maxx331 max 9E+999999999 +1.23456789012345E-0 -> 9E+999999999 ! maxx332 max +0.100 9E-999999999 -> 0.100 ! maxx333 max 9E-999999999 +0.100 -> 0.100 ! maxx335 max -1.23456789012345E-0 9E+999999999 -> 9E+999999999 ! maxx336 max 9E+999999999 -1.23456789012345E-0 -> 9E+999999999 ! maxx337 max -0.100 9E-999999999 -> 9E-999999999 ! maxx338 max 9E-999999999 -0.100 -> 9E-999999999 ! ! maxx339 max 1e-599999999 1e-400000001 -> 1E-400000001 ! maxx340 max 1e-599999999 1e-400000000 -> 1E-400000000 ! maxx341 max 1e-600000000 1e-400000000 -> 1E-400000000 ! maxx342 max 9e-999999998 0.01 -> 0.01 ! maxx343 max 9e-999999998 0.1 -> 0.1 ! maxx344 max 0.01 9e-999999998 -> 0.01 ! maxx345 max 1e599999999 1e400000001 -> 1E+599999999 ! maxx346 max 1e599999999 1e400000000 -> 1E+599999999 ! maxx347 max 1e600000000 1e400000000 -> 1E+600000000 ! maxx348 max 9e999999998 100 -> 9E+999999998 ! maxx349 max 9e999999998 10 -> 9E+999999998 ! maxx350 max 100 9e999999998 -> 9E+999999998 ! -- signs ! maxx351 max 1e+777777777 1e+411111111 -> 1E+777777777 ! maxx352 max 1e+777777777 -1e+411111111 -> 1E+777777777 ! maxx353 max -1e+777777777 1e+411111111 -> 1E+411111111 ! maxx354 max -1e+777777777 -1e+411111111 -> -1E+411111111 ! maxx355 max 1e-777777777 1e-411111111 -> 1E-411111111 ! maxx356 max 1e-777777777 -1e-411111111 -> 1E-777777777 ! maxx357 max -1e-777777777 1e-411111111 -> 1E-411111111 ! maxx358 max -1e-777777777 -1e-411111111 -> -1E-777777777 ! ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! maxx400 max 9.999E+999999999 0 -> Infinity Inexact Overflow Rounded ! maxx401 max -9.999E+999999999 0 -> 0 ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! maxx410 max 1.00E-999 0 -> 1.00E-999 ! maxx411 max 0.1E-999 0 -> 1E-1000 Subnormal ! maxx412 max 0.10E-999 0 -> 1.0E-1000 Subnormal ! maxx413 max 0.100E-999 0 -> 1.0E-1000 Subnormal Rounded ! maxx414 max 0.01E-999 0 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! maxx415 max 0.999E-999 0 -> 1.00E-999 Inexact Rounded Subnormal Underflow ! maxx416 max 0.099E-999 0 -> 1.0E-1000 Inexact Rounded Subnormal Underflow ! maxx417 max 0.009E-999 0 -> 1E-1001 Inexact Rounded Subnormal Underflow ! maxx418 max 0.001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow ! maxx419 max 0.0009E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow ! maxx420 max 0.0001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow ! ! maxx430 max -1.00E-999 0 -> 0 ! maxx431 max -0.1E-999 0 -> 0 ! maxx432 max -0.10E-999 0 -> 0 ! maxx433 max -0.100E-999 0 -> 0 ! maxx434 max -0.01E-999 0 -> 0 ! maxx435 max -0.999E-999 0 -> 0 ! maxx436 max -0.099E-999 0 -> 0 ! maxx437 max -0.009E-999 0 -> 0 ! maxx438 max -0.001E-999 0 -> 0 ! maxx439 max -0.0009E-999 0 -> 0 ! maxx440 max -0.0001E-999 0 -> 0 ! ! -- Null tests ! maxx900 max 10 # -> NaN Invalid_operation ! maxx901 max # 10 -> NaN Invalid_operation ! ! ! Index: min.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/min.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** min.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- min.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,297 **** ! ------------------------------------------------------------------------ ! -- min.decTest -- decimal minimum -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.35 ! ! -- we assume that base comparison is tested in compare.decTest, so ! -- these mainly cover special cases and rounding ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! ! -- sanity checks ! mnmx001 min -2 -2 -> -2 ! mnmx002 min -2 -1 -> -2 ! mnmx003 min -2 0 -> -2 ! mnmx004 min -2 1 -> -2 ! mnmx005 min -2 2 -> -2 ! mnmx006 min -1 -2 -> -2 ! mnmx007 min -1 -1 -> -1 ! mnmx008 min -1 0 -> -1 ! mnmx009 min -1 1 -> -1 ! mnmx010 min -1 2 -> -1 ! mnmx011 min 0 -2 -> -2 ! mnmx012 min 0 -1 -> -1 ! mnmx013 min 0 0 -> 0 ! mnmx014 min 0 1 -> 0 ! mnmx015 min 0 2 -> 0 ! mnmx016 min 1 -2 -> -2 ! mnmx017 min 1 -1 -> -1 ! mnmx018 min 1 0 -> 0 ! mnmx019 min 1 1 -> 1 ! mnmx020 min 1 2 -> 1 ! mnmx021 min 2 -2 -> -2 ! mnmx022 min 2 -1 -> -1 ! mnmx023 min 2 0 -> 0 ! mnmx025 min 2 1 -> 1 ! mnmx026 min 2 2 -> 2 ! ! -- extended zeros ! mnmx030 min 0 0 -> 0 ! mnmx031 min 0 -0 -> 0 ! mnmx032 min 0 -0.0 -> 0 ! mnmx033 min 0 0.0 -> 0 ! mnmx034 min -0 0 -> -0 ! mnmx035 min -0 -0 -> -0 ! mnmx036 min -0 -0.0 -> -0 ! mnmx037 min -0 0.0 -> -0 ! mnmx038 min 0.0 0 -> 0.0 ! mnmx039 min 0.0 -0 -> 0.0 ! mnmx040 min 0.0 -0.0 -> 0.0 ! mnmx041 min 0.0 0.0 -> 0.0 ! mnmx042 min -0.0 0 -> -0.0 ! mnmx043 min -0.0 -0 -> -0.0 ! mnmx044 min -0.0 -0.0 -> -0.0 ! mnmx045 min -0.0 0.0 -> -0.0 ! ! mnmx046 min -0E1 0E2 -> -0E+1 ! mnmx047 min 0E2 0E1 -> 0E+2 ! mnmx048 min 0E1 0E2 -> 0E+1 ! mnmx049 min -0E3 -0E2 -> -0E+3 ! ! -- Specials ! precision: 9 ! mnmx090 min Inf -Inf -> -Infinity ! mnmx091 min Inf -1000 -> -1000 ! mnmx092 min Inf -1 -> -1 ! mnmx093 min Inf -0 -> -0 ! mnmx094 min Inf 0 -> 0 ! mnmx095 min Inf 1 -> 1 ! mnmx096 min Inf 1000 -> 1000 ! mnmx097 min Inf Inf -> Infinity ! mnmx098 min -1000 Inf -> -1000 ! mnmx099 min -Inf Inf -> -Infinity ! mnmx100 min -1 Inf -> -1 ! mnmx101 min -0 Inf -> -0 ! mnmx102 min 0 Inf -> 0 ! mnmx103 min 1 Inf -> 1 ! mnmx104 min 1000 Inf -> 1000 ! mnmx105 min Inf Inf -> Infinity ! ! mnmx120 min -Inf -Inf -> -Infinity ! mnmx121 min -Inf -1000 -> -Infinity ! mnmx122 min -Inf -1 -> -Infinity ! mnmx123 min -Inf -0 -> -Infinity ! mnmx124 min -Inf 0 -> -Infinity ! mnmx125 min -Inf 1 -> -Infinity ! mnmx126 min -Inf 1000 -> -Infinity ! mnmx127 min -Inf Inf -> -Infinity ! mnmx128 min -Inf -Inf -> -Infinity ! mnmx129 min -1000 -Inf -> -Infinity ! mnmx130 min -1 -Inf -> -Infinity ! mnmx131 min -0 -Inf -> -Infinity ! mnmx132 min 0 -Inf -> -Infinity ! mnmx133 min 1 -Inf -> -Infinity ! mnmx134 min 1000 -Inf -> -Infinity ! mnmx135 min Inf -Inf -> -Infinity ! ! mnmx141 min NaN -Inf -> NaN ! mnmx142 min NaN -1000 -> NaN ! mnmx143 min NaN -1 -> NaN ! mnmx144 min NaN -0 -> NaN ! mnmx145 min NaN 0 -> NaN ! mnmx146 min NaN 1 -> NaN ! mnmx147 min NaN 1000 -> NaN ! mnmx148 min NaN Inf -> NaN ! mnmx149 min NaN NaN -> NaN ! mnmx150 min -Inf NaN -> NaN ! mnmx151 min -1000 NaN -> NaN ! mnmx152 min -1 -NaN -> -NaN ! mnmx153 min -0 NaN -> NaN ! mnmx154 min 0 -NaN -> -NaN ! mnmx155 min 1 NaN -> NaN ! mnmx156 min 1000 NaN -> NaN ! mnmx157 min Inf NaN -> NaN ! ! mnmx161 min sNaN -Inf -> NaN Invalid_operation ! mnmx162 min sNaN -1000 -> NaN Invalid_operation ! mnmx163 min sNaN -1 -> NaN Invalid_operation ! mnmx164 min sNaN -0 -> NaN Invalid_operation ! mnmx165 min -sNaN 0 -> -NaN Invalid_operation ! mnmx166 min -sNaN 1 -> -NaN Invalid_operation ! mnmx167 min sNaN 1000 -> NaN Invalid_operation ! mnmx168 min sNaN NaN -> NaN Invalid_operation ! mnmx169 min sNaN sNaN -> NaN Invalid_operation ! mnmx170 min NaN sNaN -> NaN Invalid_operation ! mnmx171 min -Inf sNaN -> NaN Invalid_operation ! mnmx172 min -1000 sNaN -> NaN Invalid_operation ! mnmx173 min -1 sNaN -> NaN Invalid_operation ! mnmx174 min -0 sNaN -> NaN Invalid_operation ! mnmx175 min 0 sNaN -> NaN Invalid_operation ! mnmx176 min 1 sNaN -> NaN Invalid_operation ! mnmx177 min 1000 sNaN -> NaN Invalid_operation ! mnmx178 min Inf sNaN -> NaN Invalid_operation ! mnmx179 min NaN sNaN -> NaN Invalid_operation ! ! -- propagating NaNs ! mnmx181 min NaN9 -Inf -> NaN9 ! mnmx182 min -NaN8 9990 -> -NaN8 ! mnmx183 min NaN71 Inf -> NaN71 ! mnmx184 min NaN6 NaN51 -> NaN6 ! mnmx185 min -Inf NaN41 -> NaN41 ! mnmx186 min -9999 -NaN33 -> -NaN33 ! mnmx187 min Inf NaN2 -> NaN2 ! ! mnmx191 min sNaN99 -Inf -> NaN99 Invalid_operation ! mnmx192 min sNaN98 -11 -> NaN98 Invalid_operation ! mnmx193 min -sNaN97 NaN -> -NaN97 Invalid_operation ! mnmx194 min sNaN69 sNaN94 -> NaN69 Invalid_operation ! mnmx195 min NaN95 sNaN93 -> NaN93 Invalid_operation ! mnmx196 min -Inf sNaN92 -> NaN92 Invalid_operation ! mnmx197 min 088 sNaN91 -> NaN91 Invalid_operation ! mnmx198 min Inf -sNaN90 -> -NaN90 Invalid_operation ! mnmx199 min NaN sNaN86 -> NaN86 Invalid_operation ! ! -- rounding checks -- chosen is rounded, or not ! maxExponent: 999 ! minexponent: -999 ! precision: 9 ! mnmx201 min -12345678000 1 -> -1.23456780E+10 Rounded ! mnmx202 min 1 -12345678000 -> -1.23456780E+10 Rounded ! mnmx203 min -1234567800 1 -> -1.23456780E+9 Rounded ! mnmx204 min 1 -1234567800 -> -1.23456780E+9 Rounded ! mnmx205 min -1234567890 1 -> -1.23456789E+9 Rounded ! mnmx206 min 1 -1234567890 -> -1.23456789E+9 Rounded ! mnmx207 min -1234567891 1 -> -1.23456789E+9 Inexact Rounded ! mnmx208 min 1 -1234567891 -> -1.23456789E+9 Inexact Rounded ! mnmx209 min -12345678901 1 -> -1.23456789E+10 Inexact Rounded ! mnmx210 min 1 -12345678901 -> -1.23456789E+10 Inexact Rounded ! mnmx211 min -1234567896 1 -> -1.23456790E+9 Inexact Rounded ! mnmx212 min 1 -1234567896 -> -1.23456790E+9 Inexact Rounded ! mnmx213 min 1234567891 1 -> 1 ! mnmx214 min 1 1234567891 -> 1 ! mnmx215 min 12345678901 1 -> 1 ! mnmx216 min 1 12345678901 -> 1 ! mnmx217 min 1234567896 1 -> 1 ! mnmx218 min 1 1234567896 -> 1 ! ! precision: 15 ! mnmx221 min -12345678000 1 -> -12345678000 ! mnmx222 min 1 -12345678000 -> -12345678000 ! mnmx223 min -1234567800 1 -> -1234567800 ! mnmx224 min 1 -1234567800 -> -1234567800 ! mnmx225 min -1234567890 1 -> -1234567890 ! mnmx226 min 1 -1234567890 -> -1234567890 ! mnmx227 min -1234567891 1 -> -1234567891 ! mnmx228 min 1 -1234567891 -> -1234567891 ! mnmx229 min -12345678901 1 -> -12345678901 ! mnmx230 min 1 -12345678901 -> -12345678901 ! mnmx231 min -1234567896 1 -> -1234567896 ! mnmx232 min 1 -1234567896 -> -1234567896 ! mnmx233 min 1234567891 1 -> 1 ! mnmx234 min 1 1234567891 -> 1 ! mnmx235 min 12345678901 1 -> 1 ! mnmx236 min 1 12345678901 -> 1 ! mnmx237 min 1234567896 1 -> 1 ! mnmx238 min 1 1234567896 -> 1 ! ! -- from examples ! mnmx280 min '3' '2' -> '2' ! mnmx281 min '-10' '3' -> '-10' ! mnmx282 min '1.0' '1' -> '1.0' ! mnmx283 min '1' '1.0' -> '1' ! ! -- overflow and underflow tests .. subnormal results [inputs] now allowed ! maxExponent: 999999999 ! minexponent: -999999999 ! mnmx330 min -1.23456789012345E-0 -9E+999999999 -> -9E+999999999 ! mnmx331 min -9E+999999999 -1.23456789012345E-0 -> -9E+999999999 ! mnmx332 min -0.100 -9E-999999999 -> -0.100 ! mnmx333 min -9E-999999999 -0.100 -> -0.100 ! mnmx335 min +1.23456789012345E-0 -9E+999999999 -> -9E+999999999 ! mnmx336 min -9E+999999999 1.23456789012345E-0 -> -9E+999999999 ! mnmx337 min +0.100 -9E-999999999 -> -9E-999999999 ! mnmx338 min -9E-999999999 0.100 -> -9E-999999999 ! ! mnmx339 min -1e-599999999 -1e-400000001 -> -1E-400000001 ! mnmx340 min -1e-599999999 -1e-400000000 -> -1E-400000000 ! mnmx341 min -1e-600000000 -1e-400000000 -> -1E-400000000 ! mnmx342 min -9e-999999998 -0.01 -> -0.01 ! mnmx343 min -9e-999999998 -0.1 -> -0.1 ! mnmx344 min -0.01 -9e-999999998 -> -0.01 ! mnmx345 min -1e599999999 -1e400000001 -> -1E+599999999 ! mnmx346 min -1e599999999 -1e400000000 -> -1E+599999999 ! mnmx347 min -1e600000000 -1e400000000 -> -1E+600000000 ! mnmx348 min -9e999999998 -100 -> -9E+999999998 ! mnmx349 min -9e999999998 -10 -> -9E+999999998 ! mnmx350 min -100 -9e999999998 -> -9E+999999998 ! -- signs ! mnmx351 min -1e+777777777 -1e+411111111 -> -1E+777777777 ! mnmx352 min -1e+777777777 +1e+411111111 -> -1E+777777777 ! mnmx353 min +1e+777777777 -1e+411111111 -> -1E+411111111 ! mnmx354 min +1e+777777777 +1e+411111111 -> 1E+411111111 ! mnmx355 min -1e-777777777 -1e-411111111 -> -1E-411111111 ! mnmx356 min -1e-777777777 +1e-411111111 -> -1E-777777777 ! mnmx357 min +1e-777777777 -1e-411111111 -> -1E-411111111 ! mnmx358 min +1e-777777777 +1e-411111111 -> 1E-777777777 ! ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! mnmx400 min 9.999E+999999999 0 -> 0 ! mnmx401 min -9.999E+999999999 0 -> -Infinity Inexact Overflow Rounded ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! mnmx410 min 1.00E-999 0 -> 0 ! mnmx411 min 0.1E-999 0 -> 0 ! mnmx412 min 0.10E-999 0 -> 0 ! mnmx413 min 0.100E-999 0 -> 0 ! mnmx414 min 0.01E-999 0 -> 0 ! mnmx415 min 0.999E-999 0 -> 0 ! mnmx416 min 0.099E-999 0 -> 0 ! mnmx417 min 0.009E-999 0 -> 0 ! mnmx418 min 0.001E-999 0 -> 0 ! mnmx419 min 0.0009E-999 0 -> 0 ! mnmx420 min 0.0001E-999 0 -> 0 ! ! mnmx430 min -1.00E-999 0 -> -1.00E-999 ! mnmx431 min -0.1E-999 0 -> -1E-1000 Subnormal ! mnmx432 min -0.10E-999 0 -> -1.0E-1000 Subnormal ! mnmx433 min -0.100E-999 0 -> -1.0E-1000 Subnormal Rounded ! mnmx434 min -0.01E-999 0 -> -1E-1001 Subnormal ! -- next is rounded to Emin ! mnmx435 min -0.999E-999 0 -> -1.00E-999 Inexact Rounded Subnormal Underflow ! mnmx436 min -0.099E-999 0 -> -1.0E-1000 Inexact Rounded Subnormal Underflow ! mnmx437 min -0.009E-999 0 -> -1E-1001 Inexact Rounded Subnormal Underflow ! mnmx438 min -0.001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow ! mnmx439 min -0.0009E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow ! mnmx440 min -0.0001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow ! ! ! -- Null tests ! mnm900 min 10 # -> NaN Invalid_operation ! mnm901 min # 10 -> NaN Invalid_operation --- 1,297 ---- ! ------------------------------------------------------------------------ ! -- min.decTest -- decimal minimum -- ! -- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.38 ! ! -- we assume that base comparison is tested in compare.decTest, so ! -- these mainly cover special cases and rounding ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 384 ! minexponent: -383 ! ! -- sanity checks ! mnmx001 min -2 -2 -> -2 ! mnmx002 min -2 -1 -> -2 ! mnmx003 min -2 0 -> -2 ! mnmx004 min -2 1 -> -2 ! mnmx005 min -2 2 -> -2 ! mnmx006 min -1 -2 -> -2 ! mnmx007 min -1 -1 -> -1 ! mnmx008 min -1 0 -> -1 ! mnmx009 min -1 1 -> -1 ! mnmx010 min -1 2 -> -1 ! mnmx011 min 0 -2 -> -2 ! mnmx012 min 0 -1 -> -1 ! mnmx013 min 0 0 -> 0 ! mnmx014 min 0 1 -> 0 ! mnmx015 min 0 2 -> 0 ! mnmx016 min 1 -2 -> -2 ! mnmx017 min 1 -1 -> -1 ! mnmx018 min 1 0 -> 0 ! mnmx019 min 1 1 -> 1 ! mnmx020 min 1 2 -> 1 ! mnmx021 min 2 -2 -> -2 ! mnmx022 min 2 -1 -> -1 ! mnmx023 min 2 0 -> 0 ! mnmx025 min 2 1 -> 1 ! mnmx026 min 2 2 -> 2 ! ! -- extended zeros ! mnmx030 min 0 0 -> 0 ! mnmx031 min 0 -0 -> 0 ! mnmx032 min 0 -0.0 -> 0 ! mnmx033 min 0 0.0 -> 0 ! mnmx034 min -0 0 -> -0 ! mnmx035 min -0 -0 -> -0 ! mnmx036 min -0 -0.0 -> -0 ! mnmx037 min -0 0.0 -> -0 ! mnmx038 min 0.0 0 -> 0.0 ! mnmx039 min 0.0 -0 -> 0.0 ! mnmx040 min 0.0 -0.0 -> 0.0 ! mnmx041 min 0.0 0.0 -> 0.0 ! mnmx042 min -0.0 0 -> -0.0 ! mnmx043 min -0.0 -0 -> -0.0 ! mnmx044 min -0.0 -0.0 -> -0.0 ! mnmx045 min -0.0 0.0 -> -0.0 ! ! mnmx046 min -0E1 0E2 -> -0E+1 ! mnmx047 min 0E2 0E1 -> 0E+2 ! mnmx048 min 0E1 0E2 -> 0E+1 ! mnmx049 min -0E3 -0E2 -> -0E+3 ! ! -- Specials ! precision: 9 ! mnmx090 min Inf -Inf -> -Infinity ! mnmx091 min Inf -1000 -> -1000 ! mnmx092 min Inf -1 -> -1 ! mnmx093 min Inf -0 -> -0 ! mnmx094 min Inf 0 -> 0 ! mnmx095 min Inf 1 -> 1 ! mnmx096 min Inf 1000 -> 1000 ! mnmx097 min Inf Inf -> Infinity ! mnmx098 min -1000 Inf -> -1000 ! mnmx099 min -Inf Inf -> -Infinity ! mnmx100 min -1 Inf -> -1 ! mnmx101 min -0 Inf -> -0 ! mnmx102 min 0 Inf -> 0 ! mnmx103 min 1 Inf -> 1 ! mnmx104 min 1000 Inf -> 1000 ! mnmx105 min Inf Inf -> Infinity ! ! mnmx120 min -Inf -Inf -> -Infinity ! mnmx121 min -Inf -1000 -> -Infinity ! mnmx122 min -Inf -1 -> -Infinity ! mnmx123 min -Inf -0 -> -Infinity ! mnmx124 min -Inf 0 -> -Infinity ! mnmx125 min -Inf 1 -> -Infinity ! mnmx126 min -Inf 1000 -> -Infinity ! mnmx127 min -Inf Inf -> -Infinity ! mnmx128 min -Inf -Inf -> -Infinity ! mnmx129 min -1000 -Inf -> -Infinity ! mnmx130 min -1 -Inf -> -Infinity ! mnmx131 min -0 -Inf -> -Infinity ! mnmx132 min 0 -Inf -> -Infinity ! mnmx133 min 1 -Inf -> -Infinity ! mnmx134 min 1000 -Inf -> -Infinity ! mnmx135 min Inf -Inf -> -Infinity ! ! mnmx141 min NaN -Inf -> NaN ! mnmx142 min NaN -1000 -> NaN ! mnmx143 min NaN -1 -> NaN ! mnmx144 min NaN -0 -> NaN ! mnmx145 min NaN 0 -> NaN ! mnmx146 min NaN 1 -> NaN ! mnmx147 min NaN 1000 -> NaN ! mnmx148 min NaN Inf -> NaN ! mnmx149 min NaN NaN -> NaN ! mnmx150 min -Inf NaN -> NaN ! mnmx151 min -1000 NaN -> NaN ! mnmx152 min -1 -NaN -> -NaN ! mnmx153 min -0 NaN -> NaN ! mnmx154 min 0 -NaN -> -NaN ! mnmx155 min 1 NaN -> NaN ! mnmx156 min 1000 NaN -> NaN ! mnmx157 min Inf NaN -> NaN ! ! mnmx161 min sNaN -Inf -> NaN Invalid_operation ! mnmx162 min sNaN -1000 -> NaN Invalid_operation ! mnmx163 min sNaN -1 -> NaN Invalid_operation ! mnmx164 min sNaN -0 -> NaN Invalid_operation ! mnmx165 min -sNaN 0 -> -NaN Invalid_operation ! mnmx166 min -sNaN 1 -> -NaN Invalid_operation ! mnmx167 min sNaN 1000 -> NaN Invalid_operation ! mnmx168 min sNaN NaN -> NaN Invalid_operation ! mnmx169 min sNaN sNaN -> NaN Invalid_operation ! mnmx170 min NaN sNaN -> NaN Invalid_operation ! mnmx171 min -Inf sNaN -> NaN Invalid_operation ! mnmx172 min -1000 sNaN -> NaN Invalid_operation ! mnmx173 min -1 sNaN -> NaN Invalid_operation ! mnmx174 min -0 sNaN -> NaN Invalid_operation ! mnmx175 min 0 sNaN -> NaN Invalid_operation ! mnmx176 min 1 sNaN -> NaN Invalid_operation ! mnmx177 min 1000 sNaN -> NaN Invalid_operation ! mnmx178 min Inf sNaN -> NaN Invalid_operation ! mnmx179 min NaN sNaN -> NaN Invalid_operation ! ! -- propagating NaNs ! mnmx181 min NaN9 -Inf -> NaN9 ! mnmx182 min -NaN8 9990 -> -NaN8 ! mnmx183 min NaN71 Inf -> NaN71 ! mnmx184 min NaN6 NaN51 -> NaN6 ! mnmx185 min -Inf NaN41 -> NaN41 ! mnmx186 min -9999 -NaN33 -> -NaN33 ! mnmx187 min Inf NaN2 -> NaN2 ! ! mnmx191 min sNaN99 -Inf -> NaN99 Invalid_operation ! mnmx192 min sNaN98 -11 -> NaN98 Invalid_operation ! mnmx193 min -sNaN97 NaN -> -NaN97 Invalid_operation ! mnmx194 min sNaN69 sNaN94 -> NaN69 Invalid_operation ! mnmx195 min NaN95 sNaN93 -> NaN93 Invalid_operation ! mnmx196 min -Inf sNaN92 -> NaN92 Invalid_operation ! mnmx197 min 088 sNaN91 -> NaN91 Invalid_operation ! mnmx198 min Inf -sNaN90 -> -NaN90 Invalid_operation ! mnmx199 min NaN sNaN86 -> NaN86 Invalid_operation ! ! -- rounding checks -- chosen is rounded, or not ! maxExponent: 999 ! minexponent: -999 ! precision: 9 ! mnmx201 min -12345678000 1 -> -1.23456780E+10 Rounded ! mnmx202 min 1 -12345678000 -> -1.23456780E+10 Rounded ! mnmx203 min -1234567800 1 -> -1.23456780E+9 Rounded ! mnmx204 min 1 -1234567800 -> -1.23456780E+9 Rounded ! mnmx205 min -1234567890 1 -> -1.23456789E+9 Rounded ! mnmx206 min 1 -1234567890 -> -1.23456789E+9 Rounded ! mnmx207 min -1234567891 1 -> -1.23456789E+9 Inexact Rounded ! mnmx208 min 1 -1234567891 -> -1.23456789E+9 Inexact Rounded ! mnmx209 min -12345678901 1 -> -1.23456789E+10 Inexact Rounded ! mnmx210 min 1 -12345678901 -> -1.23456789E+10 Inexact Rounded ! mnmx211 min -1234567896 1 -> -1.23456790E+9 Inexact Rounded ! mnmx212 min 1 -1234567896 -> -1.23456790E+9 Inexact Rounded ! mnmx213 min 1234567891 1 -> 1 ! mnmx214 min 1 1234567891 -> 1 ! mnmx215 min 12345678901 1 -> 1 ! mnmx216 min 1 12345678901 -> 1 ! mnmx217 min 1234567896 1 -> 1 ! mnmx218 min 1 1234567896 -> 1 ! ! precision: 15 ! mnmx221 min -12345678000 1 -> -12345678000 ! mnmx222 min 1 -12345678000 -> -12345678000 ! mnmx223 min -1234567800 1 -> -1234567800 ! mnmx224 min 1 -1234567800 -> -1234567800 ! mnmx225 min -1234567890 1 -> -1234567890 ! mnmx226 min 1 -1234567890 -> -1234567890 ! mnmx227 min -1234567891 1 -> -1234567891 ! mnmx228 min 1 -1234567891 -> -1234567891 ! mnmx229 min -12345678901 1 -> -12345678901 ! mnmx230 min 1 -12345678901 -> -12345678901 ! mnmx231 min -1234567896 1 -> -1234567896 ! mnmx232 min 1 -1234567896 -> -1234567896 ! mnmx233 min 1234567891 1 -> 1 ! mnmx234 min 1 1234567891 -> 1 ! mnmx235 min 12345678901 1 -> 1 ! mnmx236 min 1 12345678901 -> 1 ! mnmx237 min 1234567896 1 -> 1 ! mnmx238 min 1 1234567896 -> 1 ! ! -- from examples ! mnmx280 min '3' '2' -> '2' ! mnmx281 min '-10' '3' -> '-10' ! mnmx282 min '1.0' '1' -> '1.0' ! mnmx283 min '1' '1.0' -> '1' ! ! -- overflow and underflow tests .. subnormal results [inputs] now allowed ! maxExponent: 999999999 ! minexponent: -999999999 ! mnmx330 min -1.23456789012345E-0 -9E+999999999 -> -9E+999999999 ! mnmx331 min -9E+999999999 -1.23456789012345E-0 -> -9E+999999999 ! mnmx332 min -0.100 -9E-999999999 -> -0.100 ! mnmx333 min -9E-999999999 -0.100 -> -0.100 ! mnmx335 min +1.23456789012345E-0 -9E+999999999 -> -9E+999999999 ! mnmx336 min -9E+999999999 1.23456789012345E-0 -> -9E+999999999 ! mnmx337 min +0.100 -9E-999999999 -> -9E-999999999 ! mnmx338 min -9E-999999999 0.100 -> -9E-999999999 ! ! mnmx339 min -1e-599999999 -1e-400000001 -> -1E-400000001 ! mnmx340 min -1e-599999999 -1e-400000000 -> -1E-400000000 ! mnmx341 min -1e-600000000 -1e-400000000 -> -1E-400000000 ! mnmx342 min -9e-999999998 -0.01 -> -0.01 ! mnmx343 min -9e-999999998 -0.1 -> -0.1 ! mnmx344 min -0.01 -9e-999999998 -> -0.01 ! mnmx345 min -1e599999999 -1e400000001 -> -1E+599999999 ! mnmx346 min -1e599999999 -1e400000000 -> -1E+599999999 ! mnmx347 min -1e600000000 -1e400000000 -> -1E+600000000 ! mnmx348 min -9e999999998 -100 -> -9E+999999998 ! mnmx349 min -9e999999998 -10 -> -9E+999999998 ! mnmx350 min -100 -9e999999998 -> -9E+999999998 ! -- signs ! mnmx351 min -1e+777777777 -1e+411111111 -> -1E+777777777 ! mnmx352 min -1e+777777777 +1e+411111111 -> -1E+777777777 ! mnmx353 min +1e+777777777 -1e+411111111 -> -1E+411111111 ! mnmx354 min +1e+777777777 +1e+411111111 -> 1E+411111111 ! mnmx355 min -1e-777777777 -1e-411111111 -> -1E-411111111 ! mnmx356 min -1e-777777777 +1e-411111111 -> -1E-777777777 ! mnmx357 min +1e-777777777 -1e-411111111 -> -1E-411111111 ! mnmx358 min +1e-777777777 +1e-411111111 -> 1E-777777777 ! ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! mnmx400 min 9.999E+999999999 0 -> 0 ! mnmx401 min -9.999E+999999999 0 -> -Infinity Inexact Overflow Rounded ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! mnmx410 min 1.00E-999 0 -> 0 ! mnmx411 min 0.1E-999 0 -> 0 ! mnmx412 min 0.10E-999 0 -> 0 ! mnmx413 min 0.100E-999 0 -> 0 ! mnmx414 min 0.01E-999 0 -> 0 ! mnmx415 min 0.999E-999 0 -> 0 ! mnmx416 min 0.099E-999 0 -> 0 ! mnmx417 min 0.009E-999 0 -> 0 ! mnmx418 min 0.001E-999 0 -> 0 ! mnmx419 min 0.0009E-999 0 -> 0 ! mnmx420 min 0.0001E-999 0 -> 0 ! ! mnmx430 min -1.00E-999 0 -> -1.00E-999 ! mnmx431 min -0.1E-999 0 -> -1E-1000 Subnormal ! mnmx432 min -0.10E-999 0 -> -1.0E-1000 Subnormal ! mnmx433 min -0.100E-999 0 -> -1.0E-1000 Subnormal Rounded ! mnmx434 min -0.01E-999 0 -> -1E-1001 Subnormal ! -- next is rounded to Emin ! mnmx435 min -0.999E-999 0 -> -1.00E-999 Inexact Rounded Subnormal Underflow ! mnmx436 min -0.099E-999 0 -> -1.0E-1000 Inexact Rounded Subnormal Underflow ! mnmx437 min -0.009E-999 0 -> -1E-1001 Inexact Rounded Subnormal Underflow ! mnmx438 min -0.001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow ! mnmx439 min -0.0009E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow ! mnmx440 min -0.0001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow ! ! ! -- Null tests ! mnm900 min 10 # -> NaN Invalid_operation ! mnm901 min # 10 -> NaN Invalid_operation Index: minus.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/minus.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** minus.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- minus.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,182 **** ! ------------------------------------------------------------------------ ! -- minus.decTest -- decimal negation -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.35 ! ! -- This set of tests primarily tests the existence of the operator. ! -- Subtraction, rounding, and more overflows are tested elsewhere. ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! ! minx001 minus '1' -> '-1' ! minx002 minus '-1' -> '1' ! minx003 minus '1.00' -> '-1.00' ! minx004 minus '-1.00' -> '1.00' ! minx005 minus '0' -> '0' ! minx006 minus '0.00' -> '0.00' ! minx007 minus '00.0' -> '0.0' ! minx008 minus '00.00' -> '0.00' ! minx009 minus '00' -> '0' ! ! minx010 minus '-2' -> '2' ! minx011 minus '2' -> '-2' ! minx012 minus '-2.00' -> '2.00' ! minx013 minus '2.00' -> '-2.00' ! minx014 minus '-0' -> '0' ! minx015 minus '-0.00' -> '0.00' ! minx016 minus '-00.0' -> '0.0' ! minx017 minus '-00.00' -> '0.00' ! minx018 minus '-00' -> '0' ! ! -- "lhs" zeros in plus and minus have exponent = operand ! minx020 minus '-0E3' -> '0E+3' ! minx021 minus '-0E2' -> '0E+2' ! minx022 minus '-0E1' -> '0E+1' ! minx023 minus '-0E0' -> '0' ! minx024 minus '+0E0' -> '0' ! minx025 minus '+0E1' -> '0E+1' ! minx026 minus '+0E2' -> '0E+2' ! minx027 minus '+0E3' -> '0E+3' ! ! minx030 minus '-5E3' -> '5E+3' ! minx031 minus '-5E8' -> '5E+8' ! minx032 minus '-5E13' -> '5E+13' ! minx033 minus '-5E18' -> '5E+18' ! minx034 minus '+5E3' -> '-5E+3' ! minx035 minus '+5E8' -> '-5E+8' ! minx036 minus '+5E13' -> '-5E+13' ! minx037 minus '+5E18' -> '-5E+18' ! ! minx050 minus '-2000000' -> '2000000' ! minx051 minus '2000000' -> '-2000000' ! precision: 7 ! minx052 minus '-2000000' -> '2000000' ! minx053 minus '2000000' -> '-2000000' ! precision: 6 ! minx054 minus '-2000000' -> '2.00000E+6' Rounded ! minx055 minus '2000000' -> '-2.00000E+6' Rounded ! precision: 3 ! minx056 minus '-2000000' -> '2.00E+6' Rounded ! minx057 minus '2000000' -> '-2.00E+6' Rounded ! ! -- more fixed, potential LHS swaps/overlays if done by 0 subtract x ! precision: 9 ! minx060 minus '56267E-10' -> '-0.0000056267' ! minx061 minus '56267E-5' -> '-0.56267' ! minx062 minus '56267E-2' -> '-562.67' ! minx063 minus '56267E-1' -> '-5626.7' ! minx065 minus '56267E-0' -> '-56267' ! minx066 minus '56267E+0' -> '-56267' ! minx067 minus '56267E+1' -> '-5.6267E+5' ! minx068 minus '56267E+2' -> '-5.6267E+6' ! minx069 minus '56267E+3' -> '-5.6267E+7' ! minx070 minus '56267E+4' -> '-5.6267E+8' ! minx071 minus '56267E+5' -> '-5.6267E+9' ! minx072 minus '56267E+6' -> '-5.6267E+10' ! minx080 minus '-56267E-10' -> '0.0000056267' ! minx081 minus '-56267E-5' -> '0.56267' ! minx082 minus '-56267E-2' -> '562.67' ! minx083 minus '-56267E-1' -> '5626.7' ! minx085 minus '-56267E-0' -> '56267' ! minx086 minus '-56267E+0' -> '56267' ! minx087 minus '-56267E+1' -> '5.6267E+5' ! minx088 minus '-56267E+2' -> '5.6267E+6' ! minx089 minus '-56267E+3' -> '5.6267E+7' ! minx090 minus '-56267E+4' -> '5.6267E+8' ! minx091 minus '-56267E+5' -> '5.6267E+9' ! minx092 minus '-56267E+6' -> '5.6267E+10' ! ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! minx100 minus 9.999E+999999999 -> -Infinity Inexact Overflow Rounded ! minx101 minus -9.999E+999999999 -> Infinity Inexact Overflow Rounded ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! minx110 minus 1.00E-999 -> -1.00E-999 ! minx111 minus 0.1E-999 -> -1E-1000 Subnormal ! minx112 minus 0.10E-999 -> -1.0E-1000 Subnormal ! minx113 minus 0.100E-999 -> -1.0E-1000 Subnormal Rounded ! minx114 minus 0.01E-999 -> -1E-1001 Subnormal ! -- next is rounded to Emin ! minx115 minus 0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow ! minx116 minus 0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow ! minx117 minus 0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow ! minx118 minus 0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! minx119 minus 0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! minx120 minus 0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! ! minx130 minus -1.00E-999 -> 1.00E-999 ! minx131 minus -0.1E-999 -> 1E-1000 Subnormal ! minx132 minus -0.10E-999 -> 1.0E-1000 Subnormal ! minx133 minus -0.100E-999 -> 1.0E-1000 Subnormal Rounded ! minx134 minus -0.01E-999 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! minx135 minus -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow ! minx136 minus -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow ! minx137 minus -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow ! minx138 minus -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! minx139 minus -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! minx140 minus -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! ! ! -- long operand checks ! maxexponent: 999 ! minexponent: -999 ! precision: 9 ! minx301 minus 12345678000 -> -1.23456780E+10 Rounded ! minx302 minus 1234567800 -> -1.23456780E+9 Rounded ! minx303 minus 1234567890 -> -1.23456789E+9 Rounded ! minx304 minus 1234567891 -> -1.23456789E+9 Inexact Rounded ! minx305 minus 12345678901 -> -1.23456789E+10 Inexact Rounded ! minx306 minus 1234567896 -> -1.23456790E+9 Inexact Rounded ! ! precision: 15 ! -- still checking ! minx321 minus 12345678000 -> -12345678000 ! minx322 minus 1234567800 -> -1234567800 ! minx323 minus 1234567890 -> -1234567890 ! minx324 minus 1234567891 -> -1234567891 ! minx325 minus 12345678901 -> -12345678901 ! minx326 minus 1234567896 -> -1234567896 ! ! -- specials ! minx420 minus 'Inf' -> '-Infinity' ! minx421 minus '-Inf' -> 'Infinity' ! minx422 minus NaN -> NaN ! minx423 minus sNaN -> NaN Invalid_operation ! minx424 minus NaN255 -> NaN255 ! minx425 minus sNaN256 -> NaN256 Invalid_operation ! minx426 minus -NaN -> -NaN ! minx427 minus -sNaN -> -NaN Invalid_operation ! minx428 minus -NaN255 -> -NaN255 ! minx429 minus -sNaN256 -> -NaN256 Invalid_operation ! ! -- Null tests ! minx900 minus # -> NaN Invalid_operation ! --- 1,182 ---- ! ------------------------------------------------------------------------ ! -- minus.decTest -- decimal negation -- ! -- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.38 ! ! -- This set of tests primarily tests the existence of the operator. ! -- Subtraction, rounding, and more overflows are tested elsewhere. ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 384 ! minexponent: -383 ! ! minx001 minus '1' -> '-1' ! minx002 minus '-1' -> '1' ! minx003 minus '1.00' -> '-1.00' ! minx004 minus '-1.00' -> '1.00' ! minx005 minus '0' -> '0' ! minx006 minus '0.00' -> '0.00' ! minx007 minus '00.0' -> '0.0' ! minx008 minus '00.00' -> '0.00' ! minx009 minus '00' -> '0' ! ! minx010 minus '-2' -> '2' ! minx011 minus '2' -> '-2' ! minx012 minus '-2.00' -> '2.00' ! minx013 minus '2.00' -> '-2.00' ! minx014 minus '-0' -> '0' ! minx015 minus '-0.00' -> '0.00' ! minx016 minus '-00.0' -> '0.0' ! minx017 minus '-00.00' -> '0.00' ! minx018 minus '-00' -> '0' ! ! -- "lhs" zeros in plus and minus have exponent = operand ! minx020 minus '-0E3' -> '0E+3' ! minx021 minus '-0E2' -> '0E+2' ! minx022 minus '-0E1' -> '0E+1' ! minx023 minus '-0E0' -> '0' ! minx024 minus '+0E0' -> '0' ! minx025 minus '+0E1' -> '0E+1' ! minx026 minus '+0E2' -> '0E+2' ! minx027 minus '+0E3' -> '0E+3' ! ! minx030 minus '-5E3' -> '5E+3' ! minx031 minus '-5E8' -> '5E+8' ! minx032 minus '-5E13' -> '5E+13' ! minx033 minus '-5E18' -> '5E+18' ! minx034 minus '+5E3' -> '-5E+3' ! minx035 minus '+5E8' -> '-5E+8' ! minx036 minus '+5E13' -> '-5E+13' ! minx037 minus '+5E18' -> '-5E+18' ! ! minx050 minus '-2000000' -> '2000000' ! minx051 minus '2000000' -> '-2000000' ! precision: 7 ! minx052 minus '-2000000' -> '2000000' ! minx053 minus '2000000' -> '-2000000' ! precision: 6 ! minx054 minus '-2000000' -> '2.00000E+6' Rounded ! minx055 minus '2000000' -> '-2.00000E+6' Rounded ! precision: 3 ! minx056 minus '-2000000' -> '2.00E+6' Rounded ! minx057 minus '2000000' -> '-2.00E+6' Rounded ! ! -- more fixed, potential LHS swaps/overlays if done by 0 subtract x ! precision: 9 ! minx060 minus '56267E-10' -> '-0.0000056267' ! minx061 minus '56267E-5' -> '-0.56267' ! minx062 minus '56267E-2' -> '-562.67' ! minx063 minus '56267E-1' -> '-5626.7' ! minx065 minus '56267E-0' -> '-56267' ! minx066 minus '56267E+0' -> '-56267' ! minx067 minus '56267E+1' -> '-5.6267E+5' ! minx068 minus '56267E+2' -> '-5.6267E+6' ! minx069 minus '56267E+3' -> '-5.6267E+7' ! minx070 minus '56267E+4' -> '-5.6267E+8' ! minx071 minus '56267E+5' -> '-5.6267E+9' ! minx072 minus '56267E+6' -> '-5.6267E+10' ! minx080 minus '-56267E-10' -> '0.0000056267' ! minx081 minus '-56267E-5' -> '0.56267' ! minx082 minus '-56267E-2' -> '562.67' ! minx083 minus '-56267E-1' -> '5626.7' ! minx085 minus '-56267E-0' -> '56267' ! minx086 minus '-56267E+0' -> '56267' ! minx087 minus '-56267E+1' -> '5.6267E+5' ! minx088 minus '-56267E+2' -> '5.6267E+6' ! minx089 minus '-56267E+3' -> '5.6267E+7' ! minx090 minus '-56267E+4' -> '5.6267E+8' ! minx091 minus '-56267E+5' -> '5.6267E+9' ! minx092 minus '-56267E+6' -> '5.6267E+10' ! ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! minx100 minus 9.999E+999999999 -> -Infinity Inexact Overflow Rounded ! minx101 minus -9.999E+999999999 -> Infinity Inexact Overflow Rounded ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! minx110 minus 1.00E-999 -> -1.00E-999 ! minx111 minus 0.1E-999 -> -1E-1000 Subnormal ! minx112 minus 0.10E-999 -> -1.0E-1000 Subnormal ! minx113 minus 0.100E-999 -> -1.0E-1000 Subnormal Rounded ! minx114 minus 0.01E-999 -> -1E-1001 Subnormal ! -- next is rounded to Emin ! minx115 minus 0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow ! minx116 minus 0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow ! minx117 minus 0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow ! minx118 minus 0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! minx119 minus 0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! minx120 minus 0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! ! minx130 minus -1.00E-999 -> 1.00E-999 ! minx131 minus -0.1E-999 -> 1E-1000 Subnormal ! minx132 minus -0.10E-999 -> 1.0E-1000 Subnormal ! minx133 minus -0.100E-999 -> 1.0E-1000 Subnormal Rounded ! minx134 minus -0.01E-999 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! minx135 minus -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow ! minx136 minus -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow ! minx137 minus -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow ! minx138 minus -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! minx139 minus -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! minx140 minus -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! ! ! -- long operand checks ! maxexponent: 999 ! minexponent: -999 ! precision: 9 ! minx301 minus 12345678000 -> -1.23456780E+10 Rounded ! minx302 minus 1234567800 -> -1.23456780E+9 Rounded ! minx303 minus 1234567890 -> -1.23456789E+9 Rounded ! minx304 minus 1234567891 -> -1.23456789E+9 Inexact Rounded ! minx305 minus 12345678901 -> -1.23456789E+10 Inexact Rounded ! minx306 minus 1234567896 -> -1.23456790E+9 Inexact Rounded ! ! precision: 15 ! -- still checking ! minx321 minus 12345678000 -> -12345678000 ! minx322 minus 1234567800 -> -1234567800 ! minx323 minus 1234567890 -> -1234567890 ! minx324 minus 1234567891 -> -1234567891 ! minx325 minus 12345678901 -> -12345678901 ! minx326 minus 1234567896 -> -1234567896 ! ! -- specials ! minx420 minus 'Inf' -> '-Infinity' ! minx421 minus '-Inf' -> 'Infinity' ! minx422 minus NaN -> NaN ! minx423 minus sNaN -> NaN Invalid_operation ! minx424 minus NaN255 -> NaN255 ! minx425 minus sNaN256 -> NaN256 Invalid_operation ! minx426 minus -NaN -> -NaN ! minx427 minus -sNaN -> -NaN Invalid_operation ! minx428 minus -NaN255 -> -NaN255 ! minx429 minus -sNaN256 -> -NaN256 Invalid_operation ! ! -- Null tests ! minx900 minus # -> NaN Invalid_operation ! Index: multiply.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/multiply.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** multiply.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- multiply.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,651 **** ! ------------------------------------------------------------------------ ! -- multiply.decTest -- decimal multiplication -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...1273 lines suppressed...] ! mulx881 multiply 1.2347E-40 1.2347E-40 -> 1.524E-80 Inexact Rounded Subnormal Underflow ! mulx882 multiply 1.234E-40 1.234E-40 -> 1.523E-80 Inexact Rounded Subnormal Underflow ! mulx883 multiply 1.23E-40 1.23E-40 -> 1.513E-80 Inexact Rounded Subnormal Underflow ! mulx884 multiply 1.2E-40 1.2E-40 -> 1.44E-80 Subnormal ! mulx885 multiply 1.2E-40 1.2E-41 -> 1.44E-81 Subnormal ! mulx886 multiply 1.2E-40 1.2E-42 -> 1.4E-82 Subnormal Inexact Rounded Underflow ! mulx887 multiply 1.2E-40 1.3E-42 -> 1.6E-82 Subnormal Inexact Rounded Underflow ! mulx888 multiply 1.3E-40 1.3E-42 -> 1.7E-82 Subnormal Inexact Rounded Underflow ! ! mulx891 multiply 1.2345E-39 1.234E-40 -> 1.5234E-79 Inexact Rounded ! mulx892 multiply 1.23456E-39 1.234E-40 -> 1.5234E-79 Inexact Rounded ! mulx893 multiply 1.2345E-40 1.234E-40 -> 1.523E-80 Inexact Rounded Subnormal Underflow ! mulx894 multiply 1.23456E-40 1.234E-40 -> 1.523E-80 Inexact Rounded Subnormal Underflow ! mulx895 multiply 1.2345E-41 1.234E-40 -> 1.52E-81 Inexact Rounded Subnormal Underflow ! mulx896 multiply 1.23456E-41 1.234E-40 -> 1.52E-81 Inexact Rounded Subnormal Underflow ! ! -- Null tests ! mulx900 multiply 10 # -> NaN Invalid_operation ! mulx901 multiply # 10 -> NaN Invalid_operation ! Index: normalize.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/normalize.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** normalize.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- normalize.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,225 **** ! ------------------------------------------------------------------------ ! -- normalize.decTest -- remove trailing zeros -- ! -- Copyright (c) IBM Corporation, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.35 ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! ! nrmx001 normalize '1' -> '1' ! nrmx002 normalize '-1' -> '-1' ! nrmx003 normalize '1.00' -> '1' ! nrmx004 normalize '-1.00' -> '-1' ! nrmx005 normalize '0' -> '0' ! nrmx006 normalize '0.00' -> '0' ! nrmx007 normalize '00.0' -> '0' ! nrmx008 normalize '00.00' -> '0' ! nrmx009 normalize '00' -> '0' ! nrmx010 normalize '0E+1' -> '0' ! nrmx011 normalize '0E+5' -> '0' ! ! nrmx012 normalize '-2' -> '-2' ! nrmx013 normalize '2' -> '2' ! nrmx014 normalize '-2.00' -> '-2' ! nrmx015 normalize '2.00' -> '2' ! nrmx016 normalize '-0' -> '-0' ! nrmx017 normalize '-0.00' -> '-0' ! nrmx018 normalize '-00.0' -> '-0' ! nrmx019 normalize '-00.00' -> '-0' ! nrmx020 normalize '-00' -> '-0' ! nrmx021 normalize '-0E+5' -> '-0' ! nrmx022 normalize '-0E+1' -> '-0' ! ! nrmx030 normalize '+0.1' -> '0.1' ! nrmx031 normalize '-0.1' -> '-0.1' ! nrmx032 normalize '+0.01' -> '0.01' ! nrmx033 normalize '-0.01' -> '-0.01' ! nrmx034 normalize '+0.001' -> '0.001' ! nrmx035 normalize '-0.001' -> '-0.001' ! nrmx036 normalize '+0.000001' -> '0.000001' ! nrmx037 normalize '-0.000001' -> '-0.000001' ! nrmx038 normalize '+0.000000000001' -> '1E-12' ! nrmx039 normalize '-0.000000000001' -> '-1E-12' ! ! nrmx041 normalize 1.1 -> 1.1 ! nrmx042 normalize 1.10 -> 1.1 ! nrmx043 normalize 1.100 -> 1.1 ! nrmx044 normalize 1.110 -> 1.11 ! nrmx045 normalize -1.1 -> -1.1 ! nrmx046 normalize -1.10 -> -1.1 ! nrmx047 normalize -1.100 -> -1.1 ! nrmx048 normalize -1.110 -> -1.11 ! nrmx049 normalize 9.9 -> 9.9 ! nrmx050 normalize 9.90 -> 9.9 ! nrmx051 normalize 9.900 -> 9.9 ! nrmx052 normalize 9.990 -> 9.99 ! nrmx053 normalize -9.9 -> -9.9 ! nrmx054 normalize -9.90 -> -9.9 ! nrmx055 normalize -9.900 -> -9.9 ! nrmx056 normalize -9.990 -> -9.99 ! ! -- some trailing fractional zeros with zeros in units ! nrmx060 normalize 10.0 -> 1E+1 ! nrmx061 normalize 10.00 -> 1E+1 ! nrmx062 normalize 100.0 -> 1E+2 ! nrmx063 normalize 100.00 -> 1E+2 ! nrmx064 normalize 1.1000E+3 -> 1.1E+3 ! nrmx065 normalize 1.10000E+3 -> 1.1E+3 ! nrmx066 normalize -10.0 -> -1E+1 ! nrmx067 normalize -10.00 -> -1E+1 ! nrmx068 normalize -100.0 -> -1E+2 ! nrmx069 normalize -100.00 -> -1E+2 ! nrmx070 normalize -1.1000E+3 -> -1.1E+3 ! nrmx071 normalize -1.10000E+3 -> -1.1E+3 ! ! -- some insignificant trailing zeros with positive exponent ! nrmx080 normalize 10E+1 -> 1E+2 ! nrmx081 normalize 100E+1 -> 1E+3 ! nrmx082 normalize 1.0E+2 -> 1E+2 ! nrmx083 normalize 1.0E+3 -> 1E+3 ! nrmx084 normalize 1.1E+3 -> 1.1E+3 ! nrmx085 normalize 1.00E+3 -> 1E+3 ! nrmx086 normalize 1.10E+3 -> 1.1E+3 ! nrmx087 normalize -10E+1 -> -1E+2 ! nrmx088 normalize -100E+1 -> -1E+3 ! nrmx089 normalize -1.0E+2 -> -1E+2 ! nrmx090 normalize -1.0E+3 -> -1E+3 ! nrmx091 normalize -1.1E+3 -> -1.1E+3 ! nrmx092 normalize -1.00E+3 -> -1E+3 ! nrmx093 normalize -1.10E+3 -> -1.1E+3 ! ! -- some significant trailing zeros, were we to be trimming ! nrmx100 normalize 11 -> 11 ! nrmx101 normalize 10 -> 1E+1 ! nrmx102 normalize 10. -> 1E+1 ! nrmx103 normalize 1.1E+1 -> 11 ! nrmx104 normalize 1.0E+1 -> 1E+1 ! nrmx105 normalize 1.10E+2 -> 1.1E+2 ! nrmx106 normalize 1.00E+2 -> 1E+2 ! nrmx107 normalize 1.100E+3 -> 1.1E+3 ! nrmx108 normalize 1.000E+3 -> 1E+3 ! nrmx109 normalize 1.000000E+6 -> 1E+6 ! nrmx110 normalize -11 -> -11 ! nrmx111 normalize -10 -> -1E+1 ! nrmx112 normalize -10. -> -1E+1 ! nrmx113 normalize -1.1E+1 -> -11 ! nrmx114 normalize -1.0E+1 -> -1E+1 ! nrmx115 normalize -1.10E+2 -> -1.1E+2 ! nrmx116 normalize -1.00E+2 -> -1E+2 ! nrmx117 normalize -1.100E+3 -> -1.1E+3 ! nrmx118 normalize -1.000E+3 -> -1E+3 ! nrmx119 normalize -1.00000E+5 -> -1E+5 ! nrmx120 normalize -1.000000E+6 -> -1E+6 ! nrmx121 normalize -10.00000E+6 -> -1E+7 ! nrmx122 normalize -100.0000E+6 -> -1E+8 ! nrmx123 normalize -1000.000E+6 -> -1E+9 ! nrmx124 normalize -10000.00E+6 -> -1E+10 ! nrmx125 normalize -100000.0E+6 -> -1E+11 ! nrmx126 normalize -1000000.E+6 -> -1E+12 ! ! -- examples from decArith ! nrmx140 normalize '2.1' -> '2.1' ! nrmx141 normalize '-2.0' -> '-2' ! nrmx142 normalize '1.200' -> '1.2' ! nrmx143 normalize '-120' -> '-1.2E+2' ! nrmx144 normalize '120.00' -> '1.2E+2' ! nrmx145 normalize '0.00' -> '0' ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! nrmx160 normalize 9.999E+999999999 -> Infinity Inexact Overflow Rounded ! nrmx161 normalize -9.999E+999999999 -> -Infinity Inexact Overflow Rounded ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! nrmx210 normalize 1.00E-999 -> 1E-999 ! nrmx211 normalize 0.1E-999 -> 1E-1000 Subnormal ! nrmx212 normalize 0.10E-999 -> 1E-1000 Subnormal ! nrmx213 normalize 0.100E-999 -> 1E-1000 Subnormal Rounded ! nrmx214 normalize 0.01E-999 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! nrmx215 normalize 0.999E-999 -> 1E-999 Inexact Rounded Subnormal Underflow ! nrmx216 normalize 0.099E-999 -> 1E-1000 Inexact Rounded Subnormal Underflow ! nrmx217 normalize 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow ! nrmx218 normalize 0.001E-999 -> 0 Inexact Rounded Subnormal Underflow ! nrmx219 normalize 0.0009E-999 -> 0 Inexact Rounded Subnormal Underflow ! nrmx220 normalize 0.0001E-999 -> 0 Inexact Rounded Subnormal Underflow ! ! nrmx230 normalize -1.00E-999 -> -1E-999 ! nrmx231 normalize -0.1E-999 -> -1E-1000 Subnormal ! nrmx232 normalize -0.10E-999 -> -1E-1000 Subnormal ! nrmx233 normalize -0.100E-999 -> -1E-1000 Subnormal Rounded ! nrmx234 normalize -0.01E-999 -> -1E-1001 Subnormal ! -- next is rounded to Emin ! nrmx235 normalize -0.999E-999 -> -1E-999 Inexact Rounded Subnormal Underflow ! nrmx236 normalize -0.099E-999 -> -1E-1000 Inexact Rounded Subnormal Underflow ! nrmx237 normalize -0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow ! nrmx238 normalize -0.001E-999 -> -0 Inexact Rounded Subnormal Underflow ! nrmx239 normalize -0.0009E-999 -> -0 Inexact Rounded Subnormal Underflow ! nrmx240 normalize -0.0001E-999 -> -0 Inexact Rounded Subnormal Underflow ! ! -- more reshaping ! precision: 9 ! nrmx260 normalize '56260E-10' -> '0.000005626' ! nrmx261 normalize '56260E-5' -> '0.5626' ! nrmx262 normalize '56260E-2' -> '562.6' ! nrmx263 normalize '56260E-1' -> '5626' ! nrmx265 normalize '56260E-0' -> '5.626E+4' ! nrmx266 normalize '56260E+0' -> '5.626E+4' ! nrmx267 normalize '56260E+1' -> '5.626E+5' ! nrmx268 normalize '56260E+2' -> '5.626E+6' ! nrmx269 normalize '56260E+3' -> '5.626E+7' ! nrmx270 normalize '56260E+4' -> '5.626E+8' ! nrmx271 normalize '56260E+5' -> '5.626E+9' ! nrmx272 normalize '56260E+6' -> '5.626E+10' ! nrmx280 normalize '-56260E-10' -> '-0.000005626' ! nrmx281 normalize '-56260E-5' -> '-0.5626' ! nrmx282 normalize '-56260E-2' -> '-562.6' ! nrmx283 normalize '-56260E-1' -> '-5626' ! nrmx285 normalize '-56260E-0' -> '-5.626E+4' ! nrmx286 normalize '-56260E+0' -> '-5.626E+4' ! nrmx287 normalize '-56260E+1' -> '-5.626E+5' ! nrmx288 normalize '-56260E+2' -> '-5.626E+6' ! nrmx289 normalize '-56260E+3' -> '-5.626E+7' ! nrmx290 normalize '-56260E+4' -> '-5.626E+8' ! nrmx291 normalize '-56260E+5' -> '-5.626E+9' ! nrmx292 normalize '-56260E+6' -> '-5.626E+10' ! ! ! -- specials ! nrmx820 normalize 'Inf' -> 'Infinity' ! nrmx821 normalize '-Inf' -> '-Infinity' ! nrmx822 normalize NaN -> NaN ! nrmx823 normalize sNaN -> NaN Invalid_operation ! nrmx824 normalize NaN101 -> NaN101 ! nrmx825 normalize sNaN010 -> NaN10 Invalid_operation ! nrmx827 normalize -NaN -> -NaN ! nrmx828 normalize -sNaN -> -NaN Invalid_operation ! nrmx829 normalize -NaN101 -> -NaN101 ! nrmx830 normalize -sNaN010 -> -NaN10 Invalid_operation ! ! -- Null test ! nrmx900 normalize # -> NaN Invalid_operation --- 1,225 ---- ! ------------------------------------------------------------------------ ! -- normalize.decTest -- remove trailing zeros -- ! -- Copyright (c) IBM Corporation, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.38 ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! ! nrmx001 normalize '1' -> '1' ! nrmx002 normalize '-1' -> '-1' ! nrmx003 normalize '1.00' -> '1' ! nrmx004 normalize '-1.00' -> '-1' ! nrmx005 normalize '0' -> '0' ! nrmx006 normalize '0.00' -> '0' ! nrmx007 normalize '00.0' -> '0' ! nrmx008 normalize '00.00' -> '0' ! nrmx009 normalize '00' -> '0' ! nrmx010 normalize '0E+1' -> '0' ! nrmx011 normalize '0E+5' -> '0' ! ! nrmx012 normalize '-2' -> '-2' ! nrmx013 normalize '2' -> '2' ! nrmx014 normalize '-2.00' -> '-2' ! nrmx015 normalize '2.00' -> '2' ! nrmx016 normalize '-0' -> '-0' ! nrmx017 normalize '-0.00' -> '-0' ! nrmx018 normalize '-00.0' -> '-0' ! nrmx019 normalize '-00.00' -> '-0' ! nrmx020 normalize '-00' -> '-0' ! nrmx021 normalize '-0E+5' -> '-0' ! nrmx022 normalize '-0E+1' -> '-0' ! ! nrmx030 normalize '+0.1' -> '0.1' ! nrmx031 normalize '-0.1' -> '-0.1' ! nrmx032 normalize '+0.01' -> '0.01' ! nrmx033 normalize '-0.01' -> '-0.01' ! nrmx034 normalize '+0.001' -> '0.001' ! nrmx035 normalize '-0.001' -> '-0.001' ! nrmx036 normalize '+0.000001' -> '0.000001' ! nrmx037 normalize '-0.000001' -> '-0.000001' ! nrmx038 normalize '+0.000000000001' -> '1E-12' ! nrmx039 normalize '-0.000000000001' -> '-1E-12' ! ! nrmx041 normalize 1.1 -> 1.1 ! nrmx042 normalize 1.10 -> 1.1 ! nrmx043 normalize 1.100 -> 1.1 ! nrmx044 normalize 1.110 -> 1.11 ! nrmx045 normalize -1.1 -> -1.1 ! nrmx046 normalize -1.10 -> -1.1 ! nrmx047 normalize -1.100 -> -1.1 ! nrmx048 normalize -1.110 -> -1.11 ! nrmx049 normalize 9.9 -> 9.9 ! nrmx050 normalize 9.90 -> 9.9 ! nrmx051 normalize 9.900 -> 9.9 ! nrmx052 normalize 9.990 -> 9.99 ! nrmx053 normalize -9.9 -> -9.9 ! nrmx054 normalize -9.90 -> -9.9 ! nrmx055 normalize -9.900 -> -9.9 ! nrmx056 normalize -9.990 -> -9.99 ! ! -- some trailing fractional zeros with zeros in units ! nrmx060 normalize 10.0 -> 1E+1 ! nrmx061 normalize 10.00 -> 1E+1 ! nrmx062 normalize 100.0 -> 1E+2 ! nrmx063 normalize 100.00 -> 1E+2 ! nrmx064 normalize 1.1000E+3 -> 1.1E+3 ! nrmx065 normalize 1.10000E+3 -> 1.1E+3 ! nrmx066 normalize -10.0 -> -1E+1 ! nrmx067 normalize -10.00 -> -1E+1 ! nrmx068 normalize -100.0 -> -1E+2 ! nrmx069 normalize -100.00 -> -1E+2 ! nrmx070 normalize -1.1000E+3 -> -1.1E+3 ! nrmx071 normalize -1.10000E+3 -> -1.1E+3 ! ! -- some insignificant trailing zeros with positive exponent ! nrmx080 normalize 10E+1 -> 1E+2 ! nrmx081 normalize 100E+1 -> 1E+3 ! nrmx082 normalize 1.0E+2 -> 1E+2 ! nrmx083 normalize 1.0E+3 -> 1E+3 ! nrmx084 normalize 1.1E+3 -> 1.1E+3 ! nrmx085 normalize 1.00E+3 -> 1E+3 ! nrmx086 normalize 1.10E+3 -> 1.1E+3 ! nrmx087 normalize -10E+1 -> -1E+2 ! nrmx088 normalize -100E+1 -> -1E+3 ! nrmx089 normalize -1.0E+2 -> -1E+2 ! nrmx090 normalize -1.0E+3 -> -1E+3 ! nrmx091 normalize -1.1E+3 -> -1.1E+3 ! nrmx092 normalize -1.00E+3 -> -1E+3 ! nrmx093 normalize -1.10E+3 -> -1.1E+3 ! ! -- some significant trailing zeros, were we to be trimming ! nrmx100 normalize 11 -> 11 ! nrmx101 normalize 10 -> 1E+1 ! nrmx102 normalize 10. -> 1E+1 ! nrmx103 normalize 1.1E+1 -> 11 ! nrmx104 normalize 1.0E+1 -> 1E+1 ! nrmx105 normalize 1.10E+2 -> 1.1E+2 ! nrmx106 normalize 1.00E+2 -> 1E+2 ! nrmx107 normalize 1.100E+3 -> 1.1E+3 ! nrmx108 normalize 1.000E+3 -> 1E+3 ! nrmx109 normalize 1.000000E+6 -> 1E+6 ! nrmx110 normalize -11 -> -11 ! nrmx111 normalize -10 -> -1E+1 ! nrmx112 normalize -10. -> -1E+1 ! nrmx113 normalize -1.1E+1 -> -11 ! nrmx114 normalize -1.0E+1 -> -1E+1 ! nrmx115 normalize -1.10E+2 -> -1.1E+2 ! nrmx116 normalize -1.00E+2 -> -1E+2 ! nrmx117 normalize -1.100E+3 -> -1.1E+3 ! nrmx118 normalize -1.000E+3 -> -1E+3 ! nrmx119 normalize -1.00000E+5 -> -1E+5 ! nrmx120 normalize -1.000000E+6 -> -1E+6 ! nrmx121 normalize -10.00000E+6 -> -1E+7 ! nrmx122 normalize -100.0000E+6 -> -1E+8 ! nrmx123 normalize -1000.000E+6 -> -1E+9 ! nrmx124 normalize -10000.00E+6 -> -1E+10 ! nrmx125 normalize -100000.0E+6 -> -1E+11 ! nrmx126 normalize -1000000.E+6 -> -1E+12 ! ! -- examples from decArith ! nrmx140 normalize '2.1' -> '2.1' ! nrmx141 normalize '-2.0' -> '-2' ! nrmx142 normalize '1.200' -> '1.2' ! nrmx143 normalize '-120' -> '-1.2E+2' ! nrmx144 normalize '120.00' -> '1.2E+2' ! nrmx145 normalize '0.00' -> '0' ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! nrmx160 normalize 9.999E+999999999 -> Infinity Inexact Overflow Rounded ! nrmx161 normalize -9.999E+999999999 -> -Infinity Inexact Overflow Rounded ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! nrmx210 normalize 1.00E-999 -> 1E-999 ! nrmx211 normalize 0.1E-999 -> 1E-1000 Subnormal ! nrmx212 normalize 0.10E-999 -> 1E-1000 Subnormal ! nrmx213 normalize 0.100E-999 -> 1E-1000 Subnormal Rounded ! nrmx214 normalize 0.01E-999 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! nrmx215 normalize 0.999E-999 -> 1E-999 Inexact Rounded Subnormal Underflow ! nrmx216 normalize 0.099E-999 -> 1E-1000 Inexact Rounded Subnormal Underflow ! nrmx217 normalize 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow ! nrmx218 normalize 0.001E-999 -> 0 Inexact Rounded Subnormal Underflow ! nrmx219 normalize 0.0009E-999 -> 0 Inexact Rounded Subnormal Underflow ! nrmx220 normalize 0.0001E-999 -> 0 Inexact Rounded Subnormal Underflow ! ! nrmx230 normalize -1.00E-999 -> -1E-999 ! nrmx231 normalize -0.1E-999 -> -1E-1000 Subnormal ! nrmx232 normalize -0.10E-999 -> -1E-1000 Subnormal ! nrmx233 normalize -0.100E-999 -> -1E-1000 Subnormal Rounded ! nrmx234 normalize -0.01E-999 -> -1E-1001 Subnormal ! -- next is rounded to Emin ! nrmx235 normalize -0.999E-999 -> -1E-999 Inexact Rounded Subnormal Underflow ! nrmx236 normalize -0.099E-999 -> -1E-1000 Inexact Rounded Subnormal Underflow ! nrmx237 normalize -0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow ! nrmx238 normalize -0.001E-999 -> -0 Inexact Rounded Subnormal Underflow ! nrmx239 normalize -0.0009E-999 -> -0 Inexact Rounded Subnormal Underflow ! nrmx240 normalize -0.0001E-999 -> -0 Inexact Rounded Subnormal Underflow ! ! -- more reshaping ! precision: 9 ! nrmx260 normalize '56260E-10' -> '0.000005626' ! nrmx261 normalize '56260E-5' -> '0.5626' ! nrmx262 normalize '56260E-2' -> '562.6' ! nrmx263 normalize '56260E-1' -> '5626' ! nrmx265 normalize '56260E-0' -> '5.626E+4' ! nrmx266 normalize '56260E+0' -> '5.626E+4' ! nrmx267 normalize '56260E+1' -> '5.626E+5' ! nrmx268 normalize '56260E+2' -> '5.626E+6' ! nrmx269 normalize '56260E+3' -> '5.626E+7' ! nrmx270 normalize '56260E+4' -> '5.626E+8' ! nrmx271 normalize '56260E+5' -> '5.626E+9' ! nrmx272 normalize '56260E+6' -> '5.626E+10' ! nrmx280 normalize '-56260E-10' -> '-0.000005626' ! nrmx281 normalize '-56260E-5' -> '-0.5626' ! nrmx282 normalize '-56260E-2' -> '-562.6' ! nrmx283 normalize '-56260E-1' -> '-5626' ! nrmx285 normalize '-56260E-0' -> '-5.626E+4' ! nrmx286 normalize '-56260E+0' -> '-5.626E+4' ! nrmx287 normalize '-56260E+1' -> '-5.626E+5' ! nrmx288 normalize '-56260E+2' -> '-5.626E+6' ! nrmx289 normalize '-56260E+3' -> '-5.626E+7' ! nrmx290 normalize '-56260E+4' -> '-5.626E+8' ! nrmx291 normalize '-56260E+5' -> '-5.626E+9' ! nrmx292 normalize '-56260E+6' -> '-5.626E+10' ! ! ! -- specials ! nrmx820 normalize 'Inf' -> 'Infinity' ! nrmx821 normalize '-Inf' -> '-Infinity' ! nrmx822 normalize NaN -> NaN ! nrmx823 normalize sNaN -> NaN Invalid_operation ! nrmx824 normalize NaN101 -> NaN101 ! nrmx825 normalize sNaN010 -> NaN10 Invalid_operation ! nrmx827 normalize -NaN -> -NaN ! nrmx828 normalize -sNaN -> -NaN Invalid_operation ! nrmx829 normalize -NaN101 -> -NaN101 ! nrmx830 normalize -sNaN010 -> -NaN10 Invalid_operation ! ! -- Null test ! nrmx900 normalize # -> NaN Invalid_operation Index: plus.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/plus.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** plus.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- plus.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,181 **** ! ------------------------------------------------------------------------ ! -- plus.decTest -- decimal monadic addition -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.35 ! ! -- This set of tests primarily tests the existence of the operator. ! -- Addition and rounding, and most overflows, are tested elsewhere. ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minexponent: -999 ! ! plux001 plus '1' -> '1' ! plux002 plus '-1' -> '-1' ! plux003 plus '1.00' -> '1.00' ! plux004 plus '-1.00' -> '-1.00' ! plux005 plus '0' -> '0' ! plux006 plus '0.00' -> '0.00' ! plux007 plus '00.0' -> '0.0' ! plux008 plus '00.00' -> '0.00' ! plux009 plus '00' -> '0' ! ! plux010 plus '-2' -> '-2' ! plux011 plus '2' -> '2' ! plux012 plus '-2.00' -> '-2.00' ! plux013 plus '2.00' -> '2.00' ! plux014 plus '-0' -> '0' ! plux015 plus '-0.00' -> '0.00' ! plux016 plus '-00.0' -> '0.0' ! plux017 plus '-00.00' -> '0.00' ! plux018 plus '-00' -> '0' ! ! plux020 plus '-2000000' -> '-2000000' ! plux021 plus '2000000' -> '2000000' ! precision: 7 ! plux022 plus '-2000000' -> '-2000000' ! plux023 plus '2000000' -> '2000000' ! precision: 6 ! plux024 plus '-2000000' -> '-2.00000E+6' Rounded ! plux025 plus '2000000' -> '2.00000E+6' Rounded ! precision: 3 ! plux026 plus '-2000000' -> '-2.00E+6' Rounded ! plux027 plus '2000000' -> '2.00E+6' Rounded ! ! -- more fixed, potential LHS swaps if done by add 0 ! precision: 9 ! plux060 plus '56267E-10' -> '0.0000056267' ! plux061 plus '56267E-5' -> '0.56267' ! plux062 plus '56267E-2' -> '562.67' ! plux063 plus '56267E-1' -> '5626.7' ! plux065 plus '56267E-0' -> '56267' ! plux066 plus '56267E+0' -> '56267' ! plux067 plus '56267E+1' -> '5.6267E+5' ! plux068 plus '56267E+2' -> '5.6267E+6' ! plux069 plus '56267E+3' -> '5.6267E+7' ! plux070 plus '56267E+4' -> '5.6267E+8' ! plux071 plus '56267E+5' -> '5.6267E+9' ! plux072 plus '56267E+6' -> '5.6267E+10' ! plux080 plus '-56267E-10' -> '-0.0000056267' ! plux081 plus '-56267E-5' -> '-0.56267' ! plux082 plus '-56267E-2' -> '-562.67' ! plux083 plus '-56267E-1' -> '-5626.7' ! plux085 plus '-56267E-0' -> '-56267' ! plux086 plus '-56267E+0' -> '-56267' ! plux087 plus '-56267E+1' -> '-5.6267E+5' ! plux088 plus '-56267E+2' -> '-5.6267E+6' ! plux089 plus '-56267E+3' -> '-5.6267E+7' ! plux090 plus '-56267E+4' -> '-5.6267E+8' ! plux091 plus '-56267E+5' -> '-5.6267E+9' ! plux092 plus '-56267E+6' -> '-5.6267E+10' ! ! -- "lhs" zeros in plus and minus have exponent = operand ! plux120 plus '-0E3' -> '0E+3' ! plux121 plus '-0E2' -> '0E+2' ! plux122 plus '-0E1' -> '0E+1' ! plux123 plus '-0E0' -> '0' ! plux124 plus '+0E0' -> '0' ! plux125 plus '+0E1' -> '0E+1' ! plux126 plus '+0E2' -> '0E+2' ! plux127 plus '+0E3' -> '0E+3' ! ! plux130 plus '-5E3' -> '-5E+3' ! plux131 plus '-5E8' -> '-5E+8' ! plux132 plus '-5E13' -> '-5E+13' ! plux133 plus '-5E18' -> '-5E+18' ! plux134 plus '+5E3' -> '5E+3' ! plux135 plus '+5E8' -> '5E+8' ! plux136 plus '+5E13' -> '5E+13' ! plux137 plus '+5E18' -> '5E+18' ! ! -- specials ! plux150 plus 'Inf' -> 'Infinity' ! plux151 plus '-Inf' -> '-Infinity' ! plux152 plus NaN -> NaN ! plux153 plus sNaN -> NaN Invalid_operation ! plux154 plus NaN77 -> NaN77 ! plux155 plus sNaN88 -> NaN88 Invalid_operation ! plux156 plus -NaN -> -NaN ! plux157 plus -sNaN -> -NaN Invalid_operation ! plux158 plus -NaN77 -> -NaN77 ! plux159 plus -sNaN88 -> -NaN88 Invalid_operation ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! plux160 plus 9.999E+999999999 -> Infinity Inexact Overflow Rounded ! plux161 plus -9.999E+999999999 -> -Infinity Inexact Overflow Rounded ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! plux210 plus 1.00E-999 -> 1.00E-999 ! plux211 plus 0.1E-999 -> 1E-1000 Subnormal ! plux212 plus 0.10E-999 -> 1.0E-1000 Subnormal ! plux213 plus 0.100E-999 -> 1.0E-1000 Subnormal Rounded ! plux214 plus 0.01E-999 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! plux215 plus 0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow ! plux216 plus 0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow ! plux217 plus 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow ! plux218 plus 0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! plux219 plus 0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! plux220 plus 0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! ! plux230 plus -1.00E-999 -> -1.00E-999 ! plux231 plus -0.1E-999 -> -1E-1000 Subnormal ! plux232 plus -0.10E-999 -> -1.0E-1000 Subnormal ! plux233 plus -0.100E-999 -> -1.0E-1000 Subnormal Rounded ! plux234 plus -0.01E-999 -> -1E-1001 Subnormal ! -- next is rounded to Emin ! plux235 plus -0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow ! plux236 plus -0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow ! plux237 plus -0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow ! plux238 plus -0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! plux239 plus -0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! plux240 plus -0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! ! -- long operand checks ! maxexponent: 999 ! minexponent: -999 ! precision: 9 ! plux301 plus 12345678000 -> 1.23456780E+10 Rounded ! plux302 plus 1234567800 -> 1.23456780E+9 Rounded ! plux303 plus 1234567890 -> 1.23456789E+9 Rounded ! plux304 plus 1234567891 -> 1.23456789E+9 Inexact Rounded ! plux305 plus 12345678901 -> 1.23456789E+10 Inexact Rounded ! plux306 plus 1234567896 -> 1.23456790E+9 Inexact Rounded ! ! -- still checking ! precision: 15 ! plux321 plus 12345678000 -> 12345678000 ! plux322 plus 1234567800 -> 1234567800 ! plux323 plus 1234567890 -> 1234567890 ! plux324 plus 1234567891 -> 1234567891 ! plux325 plus 12345678901 -> 12345678901 ! plux326 plus 1234567896 -> 1234567896 ! precision: 9 ! ! -- Null tests ! plu900 plus # -> NaN Invalid_operation ! --- 1,181 ---- ! ------------------------------------------------------------------------ ! -- plus.decTest -- decimal monadic addition -- ! -- Copyright (c) IBM Corporation, 1981, 2004. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.38 ! ! -- This set of tests primarily tests the existence of the operator. ! -- Addition and rounding, and most overflows, are tested elsewhere. ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 384 ! minexponent: -383 ! ! plux001 plus '1' -> '1' ! plux002 plus '-1' -> '-1' ! plux003 plus '1.00' -> '1.00' ! plux004 plus '-1.00' -> '-1.00' ! plux005 plus '0' -> '0' ! plux006 plus '0.00' -> '0.00' ! plux007 plus '00.0' -> '0.0' ! plux008 plus '00.00' -> '0.00' ! plux009 plus '00' -> '0' ! ! plux010 plus '-2' -> '-2' ! plux011 plus '2' -> '2' ! plux012 plus '-2.00' -> '-2.00' ! plux013 plus '2.00' -> '2.00' ! plux014 plus '-0' -> '0' ! plux015 plus '-0.00' -> '0.00' ! plux016 plus '-00.0' -> '0.0' ! plux017 plus '-00.00' -> '0.00' ! plux018 plus '-00' -> '0' ! ! plux020 plus '-2000000' -> '-2000000' ! plux021 plus '2000000' -> '2000000' ! precision: 7 ! plux022 plus '-2000000' -> '-2000000' ! plux023 plus '2000000' -> '2000000' ! precision: 6 ! plux024 plus '-2000000' -> '-2.00000E+6' Rounded ! plux025 plus '2000000' -> '2.00000E+6' Rounded ! precision: 3 ! plux026 plus '-2000000' -> '-2.00E+6' Rounded ! plux027 plus '2000000' -> '2.00E+6' Rounded ! ! -- more fixed, potential LHS swaps if done by add 0 ! precision: 9 ! plux060 plus '56267E-10' -> '0.0000056267' ! plux061 plus '56267E-5' -> '0.56267' ! plux062 plus '56267E-2' -> '562.67' ! plux063 plus '56267E-1' -> '5626.7' ! plux065 plus '56267E-0' -> '56267' ! plux066 plus '56267E+0' -> '56267' ! plux067 plus '56267E+1' -> '5.6267E+5' ! plux068 plus '56267E+2' -> '5.6267E+6' ! plux069 plus '56267E+3' -> '5.6267E+7' ! plux070 plus '56267E+4' -> '5.6267E+8' ! plux071 plus '56267E+5' -> '5.6267E+9' ! plux072 plus '56267E+6' -> '5.6267E+10' ! plux080 plus '-56267E-10' -> '-0.0000056267' ! plux081 plus '-56267E-5' -> '-0.56267' ! plux082 plus '-56267E-2' -> '-562.67' ! plux083 plus '-56267E-1' -> '-5626.7' ! plux085 plus '-56267E-0' -> '-56267' ! plux086 plus '-56267E+0' -> '-56267' ! plux087 plus '-56267E+1' -> '-5.6267E+5' ! plux088 plus '-56267E+2' -> '-5.6267E+6' ! plux089 plus '-56267E+3' -> '-5.6267E+7' ! plux090 plus '-56267E+4' -> '-5.6267E+8' ! plux091 plus '-56267E+5' -> '-5.6267E+9' ! plux092 plus '-56267E+6' -> '-5.6267E+10' ! ! -- "lhs" zeros in plus and minus have exponent = operand ! plux120 plus '-0E3' -> '0E+3' ! plux121 plus '-0E2' -> '0E+2' ! plux122 plus '-0E1' -> '0E+1' ! plux123 plus '-0E0' -> '0' ! plux124 plus '+0E0' -> '0' ! plux125 plus '+0E1' -> '0E+1' ! plux126 plus '+0E2' -> '0E+2' ! plux127 plus '+0E3' -> '0E+3' ! ! plux130 plus '-5E3' -> '-5E+3' ! plux131 plus '-5E8' -> '-5E+8' ! plux132 plus '-5E13' -> '-5E+13' ! plux133 plus '-5E18' -> '-5E+18' ! plux134 plus '+5E3' -> '5E+3' ! plux135 plus '+5E8' -> '5E+8' ! plux136 plus '+5E13' -> '5E+13' ! plux137 plus '+5E18' -> '5E+18' ! ! -- specials ! plux150 plus 'Inf' -> 'Infinity' ! plux151 plus '-Inf' -> '-Infinity' ! plux152 plus NaN -> NaN ! plux153 plus sNaN -> NaN Invalid_operation ! plux154 plus NaN77 -> NaN77 ! plux155 plus sNaN88 -> NaN88 Invalid_operation ! plux156 plus -NaN -> -NaN ! plux157 plus -sNaN -> -NaN Invalid_operation ! plux158 plus -NaN77 -> -NaN77 ! plux159 plus -sNaN88 -> -NaN88 Invalid_operation ! ! -- overflow tests ! maxexponent: 999999999 ! minexponent: -999999999 ! precision: 3 ! plux160 plus 9.999E+999999999 -> Infinity Inexact Overflow Rounded ! plux161 plus -9.999E+999999999 -> -Infinity Inexact Overflow Rounded ! ! -- subnormals and underflow ! precision: 3 ! maxexponent: 999 ! minexponent: -999 ! plux210 plus 1.00E-999 -> 1.00E-999 ! plux211 plus 0.1E-999 -> 1E-1000 Subnormal ! plux212 plus 0.10E-999 -> 1.0E-1000 Subnormal ! plux213 plus 0.100E-999 -> 1.0E-1000 Subnormal Rounded ! plux214 plus 0.01E-999 -> 1E-1001 Subnormal ! -- next is rounded to Emin ! plux215 plus 0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow ! plux216 plus 0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow ! plux217 plus 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow ! plux218 plus 0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! plux219 plus 0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! plux220 plus 0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow ! ! plux230 plus -1.00E-999 -> -1.00E-999 ! plux231 plus -0.1E-999 -> -1E-1000 Subnormal ! plux232 plus -0.10E-999 -> -1.0E-1000 Subnormal ! plux233 plus -0.100E-999 -> -1.0E-1000 Subnormal Rounded ! plux234 plus -0.01E-999 -> -1E-1001 Subnormal ! -- next is rounded to Emin ! plux235 plus -0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow ! plux236 plus -0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow ! plux237 plus -0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow ! plux238 plus -0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! plux239 plus -0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! plux240 plus -0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow ! ! -- long operand checks ! maxexponent: 999 ! minexponent: -999 ! precision: 9 ! plux301 plus 12345678000 -> 1.23456780E+10 Rounded ! plux302 plus 1234567800 -> 1.23456780E+9 Rounded ! plux303 plus 1234567890 -> 1.23456789E+9 Rounded ! plux304 plus 1234567891 -> 1.23456789E+9 Inexact Rounded ! plux305 plus 12345678901 -> 1.23456789E+10 Inexact Rounded ! plux306 plus 1234567896 -> 1.23456790E+9 Inexact Rounded ! ! -- still checking ! precision: 15 ! plux321 plus 12345678000 -> 12345678000 ! plux322 plus 1234567800 -> 1234567800 ! plux323 plus 1234567890 -> 1234567890 ! plux324 plus 1234567891 -> 1234567891 ! plux325 plus 12345678901 -> 12345678901 ! plux326 plus 1234567896 -> 1234567896 ! precision: 9 ! ! -- Null tests ! plu900 plus # -> NaN Invalid_operation ! Index: power.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/power.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** power.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- power.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,651 **** ! ---------------------------------------------------------------------- ! -- power.decTest -- decimal exponentiation -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...1273 lines suppressed...] ! powx742 power 1234567800 1 -> 1234567800 ! powx743 power 1234567890 1 -> 1234567890 ! powx744 power 1234567891 1 -> 1234567891 ! powx745 power 12345678901 1 -> 12345678901 ! powx746 power 1234567896 1 -> 1234567896 ! powx747 power 1 12345678000 -> NaN Invalid_operation ! powx748 power 1 -1234567896 -> NaN Invalid_operation ! powx749 power 1 1000000000 -> NaN Invalid_operation ! powx740 power 1 -1000000000 -> NaN Invalid_operation ! ! -- check for double-rounded subnormals ! precision: 5 ! maxexponent: 79 ! minexponent: -79 ! powx750 power 1.2347E-40 2 -> 1.524E-80 Inexact Rounded Subnormal Underflow ! ! -- Null tests ! powx900 power 1 # -> NaN Invalid_operation ! powx901 power # 1 -> NaN Invalid_operation ! Index: quantize.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/quantize.decTest,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** quantize.decTest 6 Feb 2004 16:56:03 -0000 1.3 --- quantize.decTest 21 Jun 2004 21:48:22 -0000 1.4 *************** *** 1,779 **** ! ------------------------------------------------------------------------ ! -- quantize.decTest -- decimal quantize operation -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...1530 lines suppressed...] ! quax846 quantize 0 1e-1000000000 -> 0E-1000000000 ! quax847 quantize 0 1e-1000000001 -> 0E-1000000001 ! quax848 quantize 0 1e-1000000002 -> 0E-1000000002 ! quax849 quantize 0 1e-1000000003 -> 0E-1000000003 ! quax850 quantize 0 1e-1000000004 -> 0E-1000000004 ! quax851 quantize 0 1e-1000000005 -> 0E-1000000005 ! quax852 quantize 0 1e-1000000006 -> 0E-1000000006 ! quax853 quantize 0 1e-1000000007 -> 0E-1000000007 ! quax854 quantize 0 1e-1000000008 -> NaN Invalid_operation ! ! quax861 quantize 1 1e+2147483649 -> NaN Invalid_operation ! quax862 quantize 1 1e+2147483648 -> NaN Invalid_operation ! quax863 quantize 1 1e+2147483647 -> NaN Invalid_operation ! quax864 quantize 1 1e-2147483647 -> NaN Invalid_operation ! quax865 quantize 1 1e-2147483648 -> NaN Invalid_operation ! quax866 quantize 1 1e-2147483649 -> NaN Invalid_operation ! ! -- Null tests ! quax900 quantize 10 # -> NaN Invalid_operation ! quax901 quantize # 1e10 -> NaN Invalid_operation Index: randomBound32.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/randomBound32.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** randomBound32.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- randomBound32.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,2443 **** ! ------------------------------------------------------------------------ ! -- randomBound32.decTest -- decimal testcases -- boundaries near 32 -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...4857 lines suppressed...] ! mulx3498 multiply 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> -6.16714847260980448099292763939423E-733 Inexact Rounded ! powx3498 power 91936087917435.5974889495278215874 -7 -> 1.80134899939035708719659065082630E-98 Inexact Rounded ! remx3498 remainder 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> NaN Division_impossible ! subx3498 subtract 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> 91936087917435.5974889495278215874 Inexact Rounded ! addx3499 add -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -7.34564225185285561365214172598110E-597 Inexact Rounded ! comx3499 compare -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -1 ! divx3499 divide -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -1.78342822299163842247184303878022E+159 Inexact Rounded ! dvix3499 divideint -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> NaN Division_impossible ! mulx3499 multiply -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -3.02554705575380338274126867655676E-1352 Inexact Rounded ! powx3499 power -07345.6422518528556136521417259811E-600 4 -> 2.91151541552217582082937236255996E-2385 Inexact Rounded ! remx3499 remainder -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> NaN Division_impossible ! subx3499 subtract -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -7.34564225185285561365214172598110E-597 Inexact Rounded ! addx3500 add -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> 6.16988426425908872398170896375634E+401 Inexact Rounded ! comx3500 compare -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -1 ! divx3500 divide -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -4.10511306357337753351655511866170E-394 Inexact Rounded ! dvix3500 divideint -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -0 ! mulx3500 multiply -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -1.56271275924409657991913620522315E+410 Inexact Rounded ! powx3500 power -253280724.939458021588167965038184 6 -> 2.64005420221406808782284459794424E+50 Inexact Rounded ! remx3500 remainder -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -253280724.939458021588167965038184 ! subx3500 subtract -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -6.16988426425908872398170896375634E+401 Inexact Rounded Index: randoms.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/randoms.decTest,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** randoms.decTest 20 Jun 2004 01:53:06 -0000 1.6 --- randoms.decTest 21 Jun 2004 21:48:22 -0000 1.7 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.35 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.38 extended: 1 Index: remainder.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/remainder.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** remainder.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- remainder.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,518 **** ! ------------------------------------------------------------------------ ! -- remainder.decTest -- decimal remainder -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...1118 lines suppressed...] ! ! remx980 remainder 123e1 1000E999999 -> 1.23E+3 -- 123E+1 internally ! ! -- overflow and underflow tests [from divide] ! precision: 9 ! maxexponent: 999999999 ! minexponent: -999999999 ! remx990 remainder +1.23456789012345E-0 9E+999999999 -> 1.23456789 Inexact Rounded ! remx991 remainder 9E+999999999 +0.23456789012345E-0 -> NaN Division_impossible ! remx992 remainder +0.100 9E+999999999 -> 0.100 ! remx993 remainder 9E-999999999 +9.100 -> 9E-999999999 ! remx995 remainder -1.23456789012345E-0 9E+999999999 -> -1.23456789 Inexact Rounded ! remx996 remainder 9E+999999999 -0.83456789012345E-0 -> NaN Division_impossible ! remx997 remainder -0.100 9E+999999999 -> -0.100 ! remx998 remainder 9E-999999999 -9.100 -> 9E-999999999 ! ! -- Null tests ! remx1000 remainder 10 # -> NaN Invalid_operation ! remx1001 remainder # 10 -> NaN Invalid_operation ! Index: remainderNear.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/remainderNear.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** remainderNear.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- remainderNear.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,560 **** ! ------------------------------------------------------------------------ ! -- remainderNear.decTest -- decimal remainder-near (IEEE remainder) -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...1091 lines suppressed...] ! rmnx811 remaindernear 1234567896 10 -> -4 ! rmnx812 remaindernear 1 1234567896 -> 1 ! ! precision: 15 ! rmnx841 remaindernear 12345678000 100 -> 0 ! rmnx842 remaindernear 1 12345678000 -> 1 ! rmnx843 remaindernear 1234567800 10 -> 0 ! rmnx844 remaindernear 1 1234567800 -> 1 ! rmnx845 remaindernear 1234567890 10 -> 0 ! rmnx846 remaindernear 1 1234567890 -> 1 ! rmnx847 remaindernear 1234567891 10 -> 1 ! rmnx848 remaindernear 1 1234567891 -> 1 ! rmnx849 remaindernear 12345678901 100 -> 1 ! rmnx850 remaindernear 1 12345678901 -> 1 ! rmnx851 remaindernear 1234567896 10 -> -4 ! rmnx852 remaindernear 1 1234567896 -> 1 ! ! -- Null tests ! rmnx900 remaindernear 10 # -> NaN Invalid_operation ! rmnx901 remaindernear # 10 -> NaN Invalid_operation Index: rounding.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/rounding.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** rounding.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- rounding.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,1079 **** ! ------------------------------------------------------------------------ ! -- rounding.decTest -- decimal rounding modes testcases -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...2129 lines suppressed...] ! rmex401 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded ! rounding: half_down ! rmex402 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded ! rmex403 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded ! rounding: half_even ! rmex404 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded ! rmex405 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded ! rounding: floor ! rmex406 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded ! rmex407 multiply 9.999E+999999999 10 -> 9.99999999E+999999999 Overflow Inexact Rounded ! rounding: ceiling ! rmex408 multiply -9.999E+999999999 10 -> -9.99999999E+999999999 Overflow Inexact Rounded ! rmex409 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded ! rounding: up ! rmex410 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded ! rmex411 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded ! rounding: down ! rmex412 multiply -9.999E+999999999 10 -> -9.99999999E+999999999 Overflow Inexact Rounded ! rmex413 multiply 9.999E+999999999 10 -> 9.99999999E+999999999 Overflow Inexact Rounded ! Index: samequantum.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/samequantum.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** samequantum.decTest 6 Feb 2004 16:56:03 -0000 1.1 --- samequantum.decTest 21 Jun 2004 21:48:22 -0000 1.2 *************** *** 1,353 **** ! ------------------------------------------------------------------------ ! -- samequantum.decTest -- check quantums match -- ! -- Copyright (c) IBM Corporation, 2001, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.35 ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minExponent: -999 ! ! samq001 samequantum 0 0 -> 1 ! samq002 samequantum 0 1 -> 1 ! samq003 samequantum 1 0 -> 1 ! samq004 samequantum 1 1 -> 1 ! ! samq011 samequantum 10 1E+1 -> 0 ! samq012 samequantum 10E+1 10E+1 -> 1 ! samq013 samequantum 100 10E+1 -> 0 ! samq014 samequantum 100 1E+2 -> 0 ! samq015 samequantum 0.1 1E-2 -> 0 ! samq016 samequantum 0.1 1E-1 -> 1 ! samq017 samequantum 0.1 1E-0 -> 0 ! samq018 samequantum 999 999 -> 1 ! samq019 samequantum 999E-1 99.9 -> 1 ! samq020 samequantum 111E-1 22.2 -> 1 ! samq021 samequantum 111E-1 1234.2 -> 1 ! ! -- zeros ! samq030 samequantum 0.0 1.1 -> 1 ! samq031 samequantum 0.0 1.11 -> 0 ! samq032 samequantum 0.0 0 -> 0 ! samq033 samequantum 0.0 0.0 -> 1 ! samq034 samequantum 0.0 0.00 -> 0 ! samq035 samequantum 0E+1 0E+0 -> 0 ! samq036 samequantum 0E+1 0E+1 -> 1 ! samq037 samequantum 0E+1 0E+2 -> 0 ! samq038 samequantum 0E-17 0E-16 -> 0 ! samq039 samequantum 0E-17 0E-17 -> 1 ! samq040 samequantum 0E-17 0E-18 -> 0 ! samq041 samequantum 0E-17 0.0E-15 -> 0 ! samq042 samequantum 0E-17 0.0E-16 -> 1 ! samq043 samequantum 0E-17 0.0E-17 -> 0 ! samq044 samequantum -0E-17 0.0E-16 -> 1 ! samq045 samequantum 0E-17 -0.0E-17 -> 0 ! samq046 samequantum 0E-17 -0.0E-16 -> 1 ! samq047 samequantum -0E-17 0.0E-17 -> 0 ! samq048 samequantum -0E-17 -0.0E-16 -> 1 ! samq049 samequantum -0E-17 -0.0E-17 -> 0 ! ! -- specials & combinations ! ! samq0110 samequantum -Inf -Inf -> 1 ! samq0111 samequantum -Inf Inf -> 1 ! samq0112 samequantum -Inf NaN -> 0 ! samq0113 samequantum -Inf -7E+3 -> 0 ! samq0114 samequantum -Inf -7 -> 0 ! samq0115 samequantum -Inf -7E-3 -> 0 ! samq0116 samequantum -Inf -0E-3 -> 0 ! samq0117 samequantum -Inf -0 -> 0 ! samq0118 samequantum -Inf -0E+3 -> 0 ! samq0119 samequantum -Inf 0E-3 -> 0 ! samq0120 samequantum -Inf 0 -> 0 ! samq0121 samequantum -Inf 0E+3 -> 0 ! samq0122 samequantum -Inf 7E-3 -> 0 ! samq0123 samequantum -Inf 7 -> 0 ! samq0124 samequantum -Inf 7E+3 -> 0 ! samq0125 samequantum -Inf sNaN -> 0 ! ! samq0210 samequantum Inf -Inf -> 1 ! samq0211 samequantum Inf Inf -> 1 ! samq0212 samequantum Inf NaN -> 0 ! samq0213 samequantum Inf -7E+3 -> 0 ! samq0214 samequantum Inf -7 -> 0 ! samq0215 samequantum Inf -7E-3 -> 0 ! samq0216 samequantum Inf -0E-3 -> 0 ! samq0217 samequantum Inf -0 -> 0 ! samq0218 samequantum Inf -0E+3 -> 0 ! samq0219 samequantum Inf 0E-3 -> 0 ! samq0220 samequantum Inf 0 -> 0 ! samq0221 samequantum Inf 0E+3 -> 0 ! samq0222 samequantum Inf 7E-3 -> 0 ! samq0223 samequantum Inf 7 -> 0 ! samq0224 samequantum Inf 7E+3 -> 0 ! samq0225 samequantum Inf sNaN -> 0 ! ! samq0310 samequantum NaN -Inf -> 0 ! samq0311 samequantum NaN Inf -> 0 ! samq0312 samequantum NaN NaN -> 1 ! samq0313 samequantum NaN -7E+3 -> 0 ! samq0314 samequantum NaN -7 -> 0 ! samq0315 samequantum NaN -7E-3 -> 0 ! samq0316 samequantum NaN -0E-3 -> 0 ! samq0317 samequantum NaN -0 -> 0 ! samq0318 samequantum NaN -0E+3 -> 0 ! samq0319 samequantum NaN 0E-3 -> 0 ! samq0320 samequantum NaN 0 -> 0 ! samq0321 samequantum NaN 0E+3 -> 0 ! samq0322 samequantum NaN 7E-3 -> 0 ! samq0323 samequantum NaN 7 -> 0 ! samq0324 samequantum NaN 7E+3 -> 0 ! samq0325 samequantum NaN sNaN -> 1 ! ! samq0410 samequantum -7E+3 -Inf -> 0 ! samq0411 samequantum -7E+3 Inf -> 0 ! samq0412 samequantum -7E+3 NaN -> 0 ! samq0413 samequantum -7E+3 -7E+3 -> 1 ! samq0414 samequantum -7E+3 -7 -> 0 ! samq0415 samequantum -7E+3 -7E-3 -> 0 ! samq0416 samequantum -7E+3 -0E-3 -> 0 ! samq0417 samequantum -7E+3 -0 -> 0 ! samq0418 samequantum -7E+3 -0E+3 -> 1 ! samq0419 samequantum -7E+3 0E-3 -> 0 ! samq0420 samequantum -7E+3 0 -> 0 ! samq0421 samequantum -7E+3 0E+3 -> 1 ! samq0422 samequantum -7E+3 7E-3 -> 0 ! samq0423 samequantum -7E+3 7 -> 0 ! samq0424 samequantum -7E+3 7E+3 -> 1 ! samq0425 samequantum -7E+3 sNaN -> 0 ! ! samq0510 samequantum -7 -Inf -> 0 ! samq0511 samequantum -7 Inf -> 0 ! samq0512 samequantum -7 NaN -> 0 ! samq0513 samequantum -7 -7E+3 -> 0 ! samq0514 samequantum -7 -7 -> 1 ! samq0515 samequantum -7 -7E-3 -> 0 ! samq0516 samequantum -7 -0E-3 -> 0 ! samq0517 samequantum -7 -0 -> 1 ! samq0518 samequantum -7 -0E+3 -> 0 ! samq0519 samequantum -7 0E-3 -> 0 ! samq0520 samequantum -7 0 -> 1 ! samq0521 samequantum -7 0E+3 -> 0 ! samq0522 samequantum -7 7E-3 -> 0 ! samq0523 samequantum -7 7 -> 1 ! samq0524 samequantum -7 7E+3 -> 0 ! samq0525 samequantum -7 sNaN -> 0 ! ! samq0610 samequantum -7E-3 -Inf -> 0 ! samq0611 samequantum -7E-3 Inf -> 0 ! samq0612 samequantum -7E-3 NaN -> 0 ! samq0613 samequantum -7E-3 -7E+3 -> 0 ! samq0614 samequantum -7E-3 -7 -> 0 ! samq0615 samequantum -7E-3 -7E-3 -> 1 ! samq0616 samequantum -7E-3 -0E-3 -> 1 ! samq0617 samequantum -7E-3 -0 -> 0 ! samq0618 samequantum -7E-3 -0E+3 -> 0 ! samq0619 samequantum -7E-3 0E-3 -> 1 ! samq0620 samequantum -7E-3 0 -> 0 ! samq0621 samequantum -7E-3 0E+3 -> 0 ! samq0622 samequantum -7E-3 7E-3 -> 1 ! samq0623 samequantum -7E-3 7 -> 0 ! samq0624 samequantum -7E-3 7E+3 -> 0 ! samq0625 samequantum -7E-3 sNaN -> 0 ! ! samq0710 samequantum -0E-3 -Inf -> 0 ! samq0711 samequantum -0E-3 Inf -> 0 ! samq0712 samequantum -0E-3 NaN -> 0 ! samq0713 samequantum -0E-3 -7E+3 -> 0 ! samq0714 samequantum -0E-3 -7 -> 0 ! samq0715 samequantum -0E-3 -7E-3 -> 1 ! samq0716 samequantum -0E-3 -0E-3 -> 1 ! samq0717 samequantum -0E-3 -0 -> 0 ! samq0718 samequantum -0E-3 -0E+3 -> 0 ! samq0719 samequantum -0E-3 0E-3 -> 1 ! samq0720 samequantum -0E-3 0 -> 0 ! samq0721 samequantum -0E-3 0E+3 -> 0 ! samq0722 samequantum -0E-3 7E-3 -> 1 ! samq0723 samequantum -0E-3 7 -> 0 ! samq0724 samequantum -0E-3 7E+3 -> 0 ! samq0725 samequantum -0E-3 sNaN -> 0 ! ! samq0810 samequantum -0 -Inf -> 0 ! samq0811 samequantum -0 Inf -> 0 ! samq0812 samequantum -0 NaN -> 0 ! samq0813 samequantum -0 -7E+3 -> 0 ! samq0814 samequantum -0 -7 -> 1 ! samq0815 samequantum -0 -7E-3 -> 0 ! samq0816 samequantum -0 -0E-3 -> 0 ! samq0817 samequantum -0 -0 -> 1 ! samq0818 samequantum -0 -0E+3 -> 0 ! samq0819 samequantum -0 0E-3 -> 0 ! samq0820 samequantum -0 0 -> 1 ! samq0821 samequantum -0 0E+3 -> 0 ! samq0822 samequantum -0 7E-3 -> 0 ! samq0823 samequantum -0 7 -> 1 ! samq0824 samequantum -0 7E+3 -> 0 ! samq0825 samequantum -0 sNaN -> 0 ! ! samq0910 samequantum -0E+3 -Inf -> 0 ! samq0911 samequantum -0E+3 Inf -> 0 ! samq0912 samequantum -0E+3 NaN -> 0 ! samq0913 samequantum -0E+3 -7E+3 -> 1 ! samq0914 samequantum -0E+3 -7 -> 0 ! samq0915 samequantum -0E+3 -7E-3 -> 0 ! samq0916 samequantum -0E+3 -0E-3 -> 0 ! samq0917 samequantum -0E+3 -0 -> 0 ! samq0918 samequantum -0E+3 -0E+3 -> 1 ! samq0919 samequantum -0E+3 0E-3 -> 0 ! samq0920 samequantum -0E+3 0 -> 0 ! samq0921 samequantum -0E+3 0E+3 -> 1 ! samq0922 samequantum -0E+3 7E-3 -> 0 ! samq0923 samequantum -0E+3 7 -> 0 ! samq0924 samequantum -0E+3 7E+3 -> 1 ! samq0925 samequantum -0E+3 sNaN -> 0 ! ! samq1110 samequantum 0E-3 -Inf -> 0 ! samq1111 samequantum 0E-3 Inf -> 0 ! samq1112 samequantum 0E-3 NaN -> 0 ! samq1113 samequantum 0E-3 -7E+3 -> 0 ! samq1114 samequantum 0E-3 -7 -> 0 ! samq1115 samequantum 0E-3 -7E-3 -> 1 ! samq1116 samequantum 0E-3 -0E-3 -> 1 ! samq1117 samequantum 0E-3 -0 -> 0 ! samq1118 samequantum 0E-3 -0E+3 -> 0 ! samq1119 samequantum 0E-3 0E-3 -> 1 ! samq1120 samequantum 0E-3 0 -> 0 ! samq1121 samequantum 0E-3 0E+3 -> 0 ! samq1122 samequantum 0E-3 7E-3 -> 1 ! samq1123 samequantum 0E-3 7 -> 0 ! samq1124 samequantum 0E-3 7E+3 -> 0 ! samq1125 samequantum 0E-3 sNaN -> 0 ! ! samq1210 samequantum 0 -Inf -> 0 ! samq1211 samequantum 0 Inf -> 0 ! samq1212 samequantum 0 NaN -> 0 ! samq1213 samequantum 0 -7E+3 -> 0 ! samq1214 samequantum 0 -7 -> 1 ! samq1215 samequantum 0 -7E-3 -> 0 ! samq1216 samequantum 0 -0E-3 -> 0 ! samq1217 samequantum 0 -0 -> 1 ! samq1218 samequantum 0 -0E+3 -> 0 ! samq1219 samequantum 0 0E-3 -> 0 ! samq1220 samequantum 0 0 -> 1 ! samq1221 samequantum 0 0E+3 -> 0 ! samq1222 samequantum 0 7E-3 -> 0 ! samq1223 samequantum 0 7 -> 1 ! samq1224 samequantum 0 7E+3 -> 0 ! samq1225 samequantum 0 sNaN -> 0 ! ! samq1310 samequantum 0E+3 -Inf -> 0 ! samq1311 samequantum 0E+3 Inf -> 0 ! samq1312 samequantum 0E+3 NaN -> 0 ! samq1313 samequantum 0E+3 -7E+3 -> 1 ! samq1314 samequantum 0E+3 -7 -> 0 ! samq1315 samequantum 0E+3 -7E-3 -> 0 ! samq1316 samequantum 0E+3 -0E-3 -> 0 ! samq1317 samequantum 0E+3 -0 -> 0 ! samq1318 samequantum 0E+3 -0E+3 -> 1 ! samq1319 samequantum 0E+3 0E-3 -> 0 ! samq1320 samequantum 0E+3 0 -> 0 ! samq1321 samequantum 0E+3 0E+3 -> 1 ! samq1322 samequantum 0E+3 7E-3 -> 0 ! samq1323 samequantum 0E+3 7 -> 0 ! samq1324 samequantum 0E+3 7E+3 -> 1 ! samq1325 samequantum 0E+3 sNaN -> 0 ! ! samq1410 samequantum 7E-3 -Inf -> 0 ! samq1411 samequantum 7E-3 Inf -> 0 ! samq1412 samequantum 7E-3 NaN -> 0 ! samq1413 samequantum 7E-3 -7E+3 -> 0 ! samq1414 samequantum 7E-3 -7 -> 0 ! samq1415 samequantum 7E-3 -7E-3 -> 1 ! samq1416 samequantum 7E-3 -0E-3 -> 1 ! samq1417 samequantum 7E-3 -0 -> 0 ! samq1418 samequantum 7E-3 -0E+3 -> 0 ! samq1419 samequantum 7E-3 0E-3 -> 1 ! samq1420 samequantum 7E-3 0 -> 0 ! samq1421 samequantum 7E-3 0E+3 -> 0 ! samq1422 samequantum 7E-3 7E-3 -> 1 ! samq1423 samequantum 7E-3 7 -> 0 ! samq1424 samequantum 7E-3 7E+3 -> 0 ! samq1425 samequantum 7E-3 sNaN -> 0 ! ! samq1510 samequantum 7 -Inf -> 0 ! samq1511 samequantum 7 Inf -> 0 ! samq1512 samequantum 7 NaN -> 0 ! samq1513 samequantum 7 -7E+3 -> 0 ! samq1514 samequantum 7 -7 -> 1 ! samq1515 samequantum 7 -7E-3 -> 0 ! samq1516 samequantum 7 -0E-3 -> 0 ! samq1517 samequantum 7 -0 -> 1 ! samq1518 samequantum 7 -0E+3 -> 0 ! samq1519 samequantum 7 0E-3 -> 0 ! samq1520 samequantum 7 0 -> 1 ! samq1521 samequantum 7 0E+3 -> 0 ! samq1522 samequantum 7 7E-3 -> 0 ! samq1523 samequantum 7 7 -> 1 ! samq1524 samequantum 7 7E+3 -> 0 ! samq1525 samequantum 7 sNaN -> 0 ! ! samq1610 samequantum 7E+3 -Inf -> 0 ! samq1611 samequantum 7E+3 Inf -> 0 ! samq1612 samequantum 7E+3 NaN -> 0 ! samq1613 samequantum 7E+3 -7E+3 -> 1 ! samq1614 samequantum 7E+3 -7 -> 0 ! samq1615 samequantum 7E+3 -7E-3 -> 0 ! samq1616 samequantum 7E+3 -0E-3 -> 0 ! samq1617 samequantum 7E+3 -0 -> 0 ! samq1618 samequantum 7E+3 -0E+3 -> 1 ! samq1619 samequantum 7E+3 0E-3 -> 0 ! samq1620 samequantum 7E+3 0 -> 0 ! samq1621 samequantum 7E+3 0E+3 -> 1 ! samq1622 samequantum 7E+3 7E-3 -> 0 ! samq1623 samequantum 7E+3 7 -> 0 ! samq1624 samequantum 7E+3 7E+3 -> 1 ! samq1625 samequantum 7E+3 sNaN -> 0 ! ! samq1710 samequantum sNaN -Inf -> 0 ! samq1711 samequantum sNaN Inf -> 0 ! samq1712 samequantum sNaN NaN -> 1 ! samq1713 samequantum sNaN -7E+3 -> 0 ! samq1714 samequantum sNaN -7 -> 0 ! samq1715 samequantum sNaN -7E-3 -> 0 ! samq1716 samequantum sNaN -0E-3 -> 0 ! samq1717 samequantum sNaN -0 -> 0 ! samq1718 samequantum sNaN -0E+3 -> 0 ! samq1719 samequantum sNaN 0E-3 -> 0 ! samq1720 samequantum sNaN 0 -> 0 ! samq1721 samequantum sNaN 0E+3 -> 0 ! samq1722 samequantum sNaN 7E-3 -> 0 ! samq1723 samequantum sNaN 7 -> 0 ! samq1724 samequantum sNaN 7E+3 -> 0 ! samq1725 samequantum sNaN sNaN -> 1 ! -- noisy NaNs ! samq1730 samequantum sNaN3 sNaN3 -> 1 ! samq1731 samequantum sNaN3 sNaN4 -> 1 ! samq1732 samequantum NaN3 NaN3 -> 1 ! samq1733 samequantum NaN3 NaN4 -> 1 ! samq1734 samequantum sNaN3 3 -> 0 ! samq1735 samequantum NaN3 3 -> 0 ! samq1736 samequantum 4 sNaN4 -> 0 ! samq1737 samequantum 3 NaN3 -> 0 ! samq1738 samequantum Inf sNaN4 -> 0 ! samq1739 samequantum -Inf NaN3 -> 0 ! ! ! --- 1,353 ---- ! ------------------------------------------------------------------------ ! -- samequantum.decTest -- check quantums match -- ! -- Copyright (c) IBM Corporation, 2001, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.38 ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minExponent: -999 ! ! samq001 samequantum 0 0 -> 1 ! samq002 samequantum 0 1 -> 1 ! samq003 samequantum 1 0 -> 1 ! samq004 samequantum 1 1 -> 1 ! ! samq011 samequantum 10 1E+1 -> 0 ! samq012 samequantum 10E+1 10E+1 -> 1 ! samq013 samequantum 100 10E+1 -> 0 ! samq014 samequantum 100 1E+2 -> 0 ! samq015 samequantum 0.1 1E-2 -> 0 ! samq016 samequantum 0.1 1E-1 -> 1 ! samq017 samequantum 0.1 1E-0 -> 0 ! samq018 samequantum 999 999 -> 1 ! samq019 samequantum 999E-1 99.9 -> 1 ! samq020 samequantum 111E-1 22.2 -> 1 ! samq021 samequantum 111E-1 1234.2 -> 1 ! ! -- zeros ! samq030 samequantum 0.0 1.1 -> 1 ! samq031 samequantum 0.0 1.11 -> 0 ! samq032 samequantum 0.0 0 -> 0 ! samq033 samequantum 0.0 0.0 -> 1 ! samq034 samequantum 0.0 0.00 -> 0 ! samq035 samequantum 0E+1 0E+0 -> 0 ! samq036 samequantum 0E+1 0E+1 -> 1 ! samq037 samequantum 0E+1 0E+2 -> 0 ! samq038 samequantum 0E-17 0E-16 -> 0 ! samq039 samequantum 0E-17 0E-17 -> 1 ! samq040 samequantum 0E-17 0E-18 -> 0 ! samq041 samequantum 0E-17 0.0E-15 -> 0 ! samq042 samequantum 0E-17 0.0E-16 -> 1 ! samq043 samequantum 0E-17 0.0E-17 -> 0 ! samq044 samequantum -0E-17 0.0E-16 -> 1 ! samq045 samequantum 0E-17 -0.0E-17 -> 0 ! samq046 samequantum 0E-17 -0.0E-16 -> 1 ! samq047 samequantum -0E-17 0.0E-17 -> 0 ! samq048 samequantum -0E-17 -0.0E-16 -> 1 ! samq049 samequantum -0E-17 -0.0E-17 -> 0 ! ! -- specials & combinations ! ! samq0110 samequantum -Inf -Inf -> 1 ! samq0111 samequantum -Inf Inf -> 1 ! samq0112 samequantum -Inf NaN -> 0 ! samq0113 samequantum -Inf -7E+3 -> 0 ! samq0114 samequantum -Inf -7 -> 0 ! samq0115 samequantum -Inf -7E-3 -> 0 ! samq0116 samequantum -Inf -0E-3 -> 0 ! samq0117 samequantum -Inf -0 -> 0 ! samq0118 samequantum -Inf -0E+3 -> 0 ! samq0119 samequantum -Inf 0E-3 -> 0 ! samq0120 samequantum -Inf 0 -> 0 ! samq0121 samequantum -Inf 0E+3 -> 0 ! samq0122 samequantum -Inf 7E-3 -> 0 ! samq0123 samequantum -Inf 7 -> 0 ! samq0124 samequantum -Inf 7E+3 -> 0 ! samq0125 samequantum -Inf sNaN -> 0 ! ! samq0210 samequantum Inf -Inf -> 1 ! samq0211 samequantum Inf Inf -> 1 ! samq0212 samequantum Inf NaN -> 0 ! samq0213 samequantum Inf -7E+3 -> 0 ! samq0214 samequantum Inf -7 -> 0 ! samq0215 samequantum Inf -7E-3 -> 0 ! samq0216 samequantum Inf -0E-3 -> 0 ! samq0217 samequantum Inf -0 -> 0 ! samq0218 samequantum Inf -0E+3 -> 0 ! samq0219 samequantum Inf 0E-3 -> 0 ! samq0220 samequantum Inf 0 -> 0 ! samq0221 samequantum Inf 0E+3 -> 0 ! samq0222 samequantum Inf 7E-3 -> 0 ! samq0223 samequantum Inf 7 -> 0 ! samq0224 samequantum Inf 7E+3 -> 0 ! samq0225 samequantum Inf sNaN -> 0 ! ! samq0310 samequantum NaN -Inf -> 0 ! samq0311 samequantum NaN Inf -> 0 ! samq0312 samequantum NaN NaN -> 1 ! samq0313 samequantum NaN -7E+3 -> 0 ! samq0314 samequantum NaN -7 -> 0 ! samq0315 samequantum NaN -7E-3 -> 0 ! samq0316 samequantum NaN -0E-3 -> 0 ! samq0317 samequantum NaN -0 -> 0 ! samq0318 samequantum NaN -0E+3 -> 0 ! samq0319 samequantum NaN 0E-3 -> 0 ! samq0320 samequantum NaN 0 -> 0 ! samq0321 samequantum NaN 0E+3 -> 0 ! samq0322 samequantum NaN 7E-3 -> 0 ! samq0323 samequantum NaN 7 -> 0 ! samq0324 samequantum NaN 7E+3 -> 0 ! samq0325 samequantum NaN sNaN -> 1 ! ! samq0410 samequantum -7E+3 -Inf -> 0 ! samq0411 samequantum -7E+3 Inf -> 0 ! samq0412 samequantum -7E+3 NaN -> 0 ! samq0413 samequantum -7E+3 -7E+3 -> 1 ! samq0414 samequantum -7E+3 -7 -> 0 ! samq0415 samequantum -7E+3 -7E-3 -> 0 ! samq0416 samequantum -7E+3 -0E-3 -> 0 ! samq0417 samequantum -7E+3 -0 -> 0 ! samq0418 samequantum -7E+3 -0E+3 -> 1 ! samq0419 samequantum -7E+3 0E-3 -> 0 ! samq0420 samequantum -7E+3 0 -> 0 ! samq0421 samequantum -7E+3 0E+3 -> 1 ! samq0422 samequantum -7E+3 7E-3 -> 0 ! samq0423 samequantum -7E+3 7 -> 0 ! samq0424 samequantum -7E+3 7E+3 -> 1 ! samq0425 samequantum -7E+3 sNaN -> 0 ! ! samq0510 samequantum -7 -Inf -> 0 ! samq0511 samequantum -7 Inf -> 0 ! samq0512 samequantum -7 NaN -> 0 ! samq0513 samequantum -7 -7E+3 -> 0 ! samq0514 samequantum -7 -7 -> 1 ! samq0515 samequantum -7 -7E-3 -> 0 ! samq0516 samequantum -7 -0E-3 -> 0 ! samq0517 samequantum -7 -0 -> 1 ! samq0518 samequantum -7 -0E+3 -> 0 ! samq0519 samequantum -7 0E-3 -> 0 ! samq0520 samequantum -7 0 -> 1 ! samq0521 samequantum -7 0E+3 -> 0 ! samq0522 samequantum -7 7E-3 -> 0 ! samq0523 samequantum -7 7 -> 1 ! samq0524 samequantum -7 7E+3 -> 0 ! samq0525 samequantum -7 sNaN -> 0 ! ! samq0610 samequantum -7E-3 -Inf -> 0 ! samq0611 samequantum -7E-3 Inf -> 0 ! samq0612 samequantum -7E-3 NaN -> 0 ! samq0613 samequantum -7E-3 -7E+3 -> 0 ! samq0614 samequantum -7E-3 -7 -> 0 ! samq0615 samequantum -7E-3 -7E-3 -> 1 ! samq0616 samequantum -7E-3 -0E-3 -> 1 ! samq0617 samequantum -7E-3 -0 -> 0 ! samq0618 samequantum -7E-3 -0E+3 -> 0 ! samq0619 samequantum -7E-3 0E-3 -> 1 ! samq0620 samequantum -7E-3 0 -> 0 ! samq0621 samequantum -7E-3 0E+3 -> 0 ! samq0622 samequantum -7E-3 7E-3 -> 1 ! samq0623 samequantum -7E-3 7 -> 0 ! samq0624 samequantum -7E-3 7E+3 -> 0 ! samq0625 samequantum -7E-3 sNaN -> 0 ! ! samq0710 samequantum -0E-3 -Inf -> 0 ! samq0711 samequantum -0E-3 Inf -> 0 ! samq0712 samequantum -0E-3 NaN -> 0 ! samq0713 samequantum -0E-3 -7E+3 -> 0 ! samq0714 samequantum -0E-3 -7 -> 0 ! samq0715 samequantum -0E-3 -7E-3 -> 1 ! samq0716 samequantum -0E-3 -0E-3 -> 1 ! samq0717 samequantum -0E-3 -0 -> 0 ! samq0718 samequantum -0E-3 -0E+3 -> 0 ! samq0719 samequantum -0E-3 0E-3 -> 1 ! samq0720 samequantum -0E-3 0 -> 0 ! samq0721 samequantum -0E-3 0E+3 -> 0 ! samq0722 samequantum -0E-3 7E-3 -> 1 ! samq0723 samequantum -0E-3 7 -> 0 ! samq0724 samequantum -0E-3 7E+3 -> 0 ! samq0725 samequantum -0E-3 sNaN -> 0 ! ! samq0810 samequantum -0 -Inf -> 0 ! samq0811 samequantum -0 Inf -> 0 ! samq0812 samequantum -0 NaN -> 0 ! samq0813 samequantum -0 -7E+3 -> 0 ! samq0814 samequantum -0 -7 -> 1 ! samq0815 samequantum -0 -7E-3 -> 0 ! samq0816 samequantum -0 -0E-3 -> 0 ! samq0817 samequantum -0 -0 -> 1 ! samq0818 samequantum -0 -0E+3 -> 0 ! samq0819 samequantum -0 0E-3 -> 0 ! samq0820 samequantum -0 0 -> 1 ! samq0821 samequantum -0 0E+3 -> 0 ! samq0822 samequantum -0 7E-3 -> 0 ! samq0823 samequantum -0 7 -> 1 ! samq0824 samequantum -0 7E+3 -> 0 ! samq0825 samequantum -0 sNaN -> 0 ! ! samq0910 samequantum -0E+3 -Inf -> 0 ! samq0911 samequantum -0E+3 Inf -> 0 ! samq0912 samequantum -0E+3 NaN -> 0 ! samq0913 samequantum -0E+3 -7E+3 -> 1 ! samq0914 samequantum -0E+3 -7 -> 0 ! samq0915 samequantum -0E+3 -7E-3 -> 0 ! samq0916 samequantum -0E+3 -0E-3 -> 0 ! samq0917 samequantum -0E+3 -0 -> 0 ! samq0918 samequantum -0E+3 -0E+3 -> 1 ! samq0919 samequantum -0E+3 0E-3 -> 0 ! samq0920 samequantum -0E+3 0 -> 0 ! samq0921 samequantum -0E+3 0E+3 -> 1 ! samq0922 samequantum -0E+3 7E-3 -> 0 ! samq0923 samequantum -0E+3 7 -> 0 ! samq0924 samequantum -0E+3 7E+3 -> 1 ! samq0925 samequantum -0E+3 sNaN -> 0 ! ! samq1110 samequantum 0E-3 -Inf -> 0 ! samq1111 samequantum 0E-3 Inf -> 0 ! samq1112 samequantum 0E-3 NaN -> 0 ! samq1113 samequantum 0E-3 -7E+3 -> 0 ! samq1114 samequantum 0E-3 -7 -> 0 ! samq1115 samequantum 0E-3 -7E-3 -> 1 ! samq1116 samequantum 0E-3 -0E-3 -> 1 ! samq1117 samequantum 0E-3 -0 -> 0 ! samq1118 samequantum 0E-3 -0E+3 -> 0 ! samq1119 samequantum 0E-3 0E-3 -> 1 ! samq1120 samequantum 0E-3 0 -> 0 ! samq1121 samequantum 0E-3 0E+3 -> 0 ! samq1122 samequantum 0E-3 7E-3 -> 1 ! samq1123 samequantum 0E-3 7 -> 0 ! samq1124 samequantum 0E-3 7E+3 -> 0 ! samq1125 samequantum 0E-3 sNaN -> 0 ! ! samq1210 samequantum 0 -Inf -> 0 ! samq1211 samequantum 0 Inf -> 0 ! samq1212 samequantum 0 NaN -> 0 ! samq1213 samequantum 0 -7E+3 -> 0 ! samq1214 samequantum 0 -7 -> 1 ! samq1215 samequantum 0 -7E-3 -> 0 ! samq1216 samequantum 0 -0E-3 -> 0 ! samq1217 samequantum 0 -0 -> 1 ! samq1218 samequantum 0 -0E+3 -> 0 ! samq1219 samequantum 0 0E-3 -> 0 ! samq1220 samequantum 0 0 -> 1 ! samq1221 samequantum 0 0E+3 -> 0 ! samq1222 samequantum 0 7E-3 -> 0 ! samq1223 samequantum 0 7 -> 1 ! samq1224 samequantum 0 7E+3 -> 0 ! samq1225 samequantum 0 sNaN -> 0 ! ! samq1310 samequantum 0E+3 -Inf -> 0 ! samq1311 samequantum 0E+3 Inf -> 0 ! samq1312 samequantum 0E+3 NaN -> 0 ! samq1313 samequantum 0E+3 -7E+3 -> 1 ! samq1314 samequantum 0E+3 -7 -> 0 ! samq1315 samequantum 0E+3 -7E-3 -> 0 ! samq1316 samequantum 0E+3 -0E-3 -> 0 ! samq1317 samequantum 0E+3 -0 -> 0 ! samq1318 samequantum 0E+3 -0E+3 -> 1 ! samq1319 samequantum 0E+3 0E-3 -> 0 ! samq1320 samequantum 0E+3 0 -> 0 ! samq1321 samequantum 0E+3 0E+3 -> 1 ! samq1322 samequantum 0E+3 7E-3 -> 0 ! samq1323 samequantum 0E+3 7 -> 0 ! samq1324 samequantum 0E+3 7E+3 -> 1 ! samq1325 samequantum 0E+3 sNaN -> 0 ! ! samq1410 samequantum 7E-3 -Inf -> 0 ! samq1411 samequantum 7E-3 Inf -> 0 ! samq1412 samequantum 7E-3 NaN -> 0 ! samq1413 samequantum 7E-3 -7E+3 -> 0 ! samq1414 samequantum 7E-3 -7 -> 0 ! samq1415 samequantum 7E-3 -7E-3 -> 1 ! samq1416 samequantum 7E-3 -0E-3 -> 1 ! samq1417 samequantum 7E-3 -0 -> 0 ! samq1418 samequantum 7E-3 -0E+3 -> 0 ! samq1419 samequantum 7E-3 0E-3 -> 1 ! samq1420 samequantum 7E-3 0 -> 0 ! samq1421 samequantum 7E-3 0E+3 -> 0 ! samq1422 samequantum 7E-3 7E-3 -> 1 ! samq1423 samequantum 7E-3 7 -> 0 ! samq1424 samequantum 7E-3 7E+3 -> 0 ! samq1425 samequantum 7E-3 sNaN -> 0 ! ! samq1510 samequantum 7 -Inf -> 0 ! samq1511 samequantum 7 Inf -> 0 ! samq1512 samequantum 7 NaN -> 0 ! samq1513 samequantum 7 -7E+3 -> 0 ! samq1514 samequantum 7 -7 -> 1 ! samq1515 samequantum 7 -7E-3 -> 0 ! samq1516 samequantum 7 -0E-3 -> 0 ! samq1517 samequantum 7 -0 -> 1 ! samq1518 samequantum 7 -0E+3 -> 0 ! samq1519 samequantum 7 0E-3 -> 0 ! samq1520 samequantum 7 0 -> 1 ! samq1521 samequantum 7 0E+3 -> 0 ! samq1522 samequantum 7 7E-3 -> 0 ! samq1523 samequantum 7 7 -> 1 ! samq1524 samequantum 7 7E+3 -> 0 ! samq1525 samequantum 7 sNaN -> 0 ! ! samq1610 samequantum 7E+3 -Inf -> 0 ! samq1611 samequantum 7E+3 Inf -> 0 ! samq1612 samequantum 7E+3 NaN -> 0 ! samq1613 samequantum 7E+3 -7E+3 -> 1 ! samq1614 samequantum 7E+3 -7 -> 0 ! samq1615 samequantum 7E+3 -7E-3 -> 0 ! samq1616 samequantum 7E+3 -0E-3 -> 0 ! samq1617 samequantum 7E+3 -0 -> 0 ! samq1618 samequantum 7E+3 -0E+3 -> 1 ! samq1619 samequantum 7E+3 0E-3 -> 0 ! samq1620 samequantum 7E+3 0 -> 0 ! samq1621 samequantum 7E+3 0E+3 -> 1 ! samq1622 samequantum 7E+3 7E-3 -> 0 ! samq1623 samequantum 7E+3 7 -> 0 ! samq1624 samequantum 7E+3 7E+3 -> 1 ! samq1625 samequantum 7E+3 sNaN -> 0 ! ! samq1710 samequantum sNaN -Inf -> 0 ! samq1711 samequantum sNaN Inf -> 0 ! samq1712 samequantum sNaN NaN -> 1 ! samq1713 samequantum sNaN -7E+3 -> 0 ! samq1714 samequantum sNaN -7 -> 0 ! samq1715 samequantum sNaN -7E-3 -> 0 ! samq1716 samequantum sNaN -0E-3 -> 0 ! samq1717 samequantum sNaN -0 -> 0 ! samq1718 samequantum sNaN -0E+3 -> 0 ! samq1719 samequantum sNaN 0E-3 -> 0 ! samq1720 samequantum sNaN 0 -> 0 ! samq1721 samequantum sNaN 0E+3 -> 0 ! samq1722 samequantum sNaN 7E-3 -> 0 ! samq1723 samequantum sNaN 7 -> 0 ! samq1724 samequantum sNaN 7E+3 -> 0 ! samq1725 samequantum sNaN sNaN -> 1 ! -- noisy NaNs ! samq1730 samequantum sNaN3 sNaN3 -> 1 ! samq1731 samequantum sNaN3 sNaN4 -> 1 ! samq1732 samequantum NaN3 NaN3 -> 1 ! samq1733 samequantum NaN3 NaN4 -> 1 ! samq1734 samequantum sNaN3 3 -> 0 ! samq1735 samequantum NaN3 3 -> 0 ! samq1736 samequantum 4 sNaN4 -> 0 ! samq1737 samequantum 3 NaN3 -> 0 ! samq1738 samequantum Inf sNaN4 -> 0 ! samq1739 samequantum -Inf NaN3 -> 0 ! ! ! Index: squareroot.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/squareroot.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** squareroot.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- squareroot.decTest 21 Jun 2004 21:48:22 -0000 1.6 *************** *** 1,2958 **** ! ------------------------------------------------------------------------ ! -- squareroot.decTest -- decimal square root -- ! -- Copyright (c) IBM Corporation, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...5887 lines suppressed...] ! sqtx811 squareroot 10E-22 -> 3.16227766017E-11 Underflow Subnormal Inexact Rounded ! sqtx812 squareroot 1E-22 -> 1E-11 Subnormal -- Exact Subnormal case ! ! ! -- special values ! maxexponent: 999 ! minexponent: -999 ! sqtx820 squareroot Inf -> Infinity ! sqtx821 squareroot -Inf -> NaN Invalid_operation ! sqtx822 squareroot NaN -> NaN ! sqtx823 squareroot sNaN -> NaN Invalid_operation ! -- propagating NaNs ! sqtx824 squareroot sNaN123 -> NaN123 Invalid_operation ! sqtx825 squareroot -sNaN321 -> -NaN321 Invalid_operation ! sqtx826 squareroot NaN456 -> NaN456 ! sqtx827 squareroot -NaN654 -> -NaN654 ! sqtx828 squareroot NaN1 -> NaN1 ! ! -- Null test ! sqtx900 squareroot # -> NaN Invalid_operation Index: subtract.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/subtract.decTest,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** subtract.decTest 6 Feb 2004 16:56:03 -0000 1.5 --- subtract.decTest 21 Jun 2004 21:48:23 -0000 1.6 *************** *** 1,853 **** ! ------------------------------------------------------------------------ ! -- subtract.decTest -- decimal subtraction -- ! -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- [...1687 lines suppressed...] ! minexponent: -79 ! subx1101 subtract 0 1.52444E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow ! subx1102 subtract 0 1.52445E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow ! subx1103 subtract 0 1.52446E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow ! subx1104 subtract 1.52444E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow ! subx1105 subtract 1.52445E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow ! subx1106 subtract 1.52446E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow ! ! subx1111 subtract 1.2345678E-80 1.2345671E-80 -> 0E-83 Inexact Rounded Subnormal Underflow ! subx1112 subtract 1.2345678E-80 1.2345618E-80 -> 0E-83 Inexact Rounded Subnormal Underflow ! subx1113 subtract 1.2345678E-80 1.2345178E-80 -> 0E-83 Inexact Rounded Subnormal Underflow ! subx1114 subtract 1.2345678E-80 1.2341678E-80 -> 0E-83 Inexact Rounded Subnormal Underflow ! subx1115 subtract 1.2345678E-80 1.2315678E-80 -> 3E-83 Rounded Subnormal ! subx1116 subtract 1.2345678E-80 1.2145678E-80 -> 2.0E-82 Rounded Subnormal ! subx1117 subtract 1.2345678E-80 1.1345678E-80 -> 1.00E-81 Rounded Subnormal ! subx1118 subtract 1.2345678E-80 0.2345678E-80 -> 1.000E-80 Rounded Subnormal ! ! -- Null tests ! subx9990 subtract 10 # -> NaN Invalid_operation ! subx9991 subtract # 10 -> NaN Invalid_operation Index: tointegral.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/tointegral.decTest,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tointegral.decTest 6 Feb 2004 16:56:03 -0000 1.2 --- tointegral.decTest 21 Jun 2004 21:48:23 -0000 1.3 *************** *** 1,170 **** ! ------------------------------------------------------------------------ ! -- tointegral.decTest -- round decimal to integral value -- ! -- Copyright (c) IBM Corporation, 2001, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.35 ! ! -- This set of tests tests the extended specification 'round-to-integral ! -- value' operation (from IEEE 854, later modified in 754r). ! -- All non-zero results are defined as being those from either copy or ! -- quantize, so those are assumed to have been tested. ! -- Note that 754r requires that Inexact not be set, and we similarly ! -- assume Rounded is not set. ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minExponent: -999 ! ! intx001 tointegral 0 -> 0 ! intx002 tointegral 0.0 -> 0 ! intx003 tointegral 0.1 -> 0 ! intx004 tointegral 0.2 -> 0 ! intx005 tointegral 0.3 -> 0 ! intx006 tointegral 0.4 -> 0 ! intx007 tointegral 0.5 -> 1 ! intx008 tointegral 0.6 -> 1 ! intx009 tointegral 0.7 -> 1 ! intx010 tointegral 0.8 -> 1 ! intx011 tointegral 0.9 -> 1 ! intx012 tointegral 1 -> 1 ! intx013 tointegral 1.0 -> 1 ! intx014 tointegral 1.1 -> 1 ! intx015 tointegral 1.2 -> 1 ! intx016 tointegral 1.3 -> 1 ! intx017 tointegral 1.4 -> 1 ! intx018 tointegral 1.5 -> 2 ! intx019 tointegral 1.6 -> 2 ! intx020 tointegral 1.7 -> 2 ! intx021 tointegral 1.8 -> 2 ! intx022 tointegral 1.9 -> 2 ! -- negatives ! intx031 tointegral -0 -> -0 ! intx032 tointegral -0.0 -> -0 ! intx033 tointegral -0.1 -> -0 ! intx034 tointegral -0.2 -> -0 ! intx035 tointegral -0.3 -> -0 ! intx036 tointegral -0.4 -> -0 ! intx037 tointegral -0.5 -> -1 ! intx038 tointegral -0.6 -> -1 ! intx039 tointegral -0.7 -> -1 ! intx040 tointegral -0.8 -> -1 ! intx041 tointegral -0.9 -> -1 ! intx042 tointegral -1 -> -1 ! intx043 tointegral -1.0 -> -1 ! intx044 tointegral -1.1 -> -1 ! intx045 tointegral -1.2 -> -1 ! intx046 tointegral -1.3 -> -1 ! intx047 tointegral -1.4 -> -1 ! intx048 tointegral -1.5 -> -2 ! intx049 tointegral -1.6 -> -2 ! intx050 tointegral -1.7 -> -2 ! intx051 tointegral -1.8 -> -2 ! intx052 tointegral -1.9 -> -2 ! -- next two would be NaN using quantize(x, 0) ! intx053 tointegral 10E+30 -> 1.0E+31 ! intx054 tointegral -10E+30 -> -1.0E+31 ! ! -- numbers around precision ! precision: 9 ! intx060 tointegral '56267E-10' -> '0' ! intx061 tointegral '56267E-5' -> '1' ! intx062 tointegral '56267E-2' -> '563' ! intx063 tointegral '56267E-1' -> '5627' ! intx065 tointegral '56267E-0' -> '56267' ! intx066 tointegral '56267E+0' -> '56267' ! intx067 tointegral '56267E+1' -> '5.6267E+5' ! intx068 tointegral '56267E+2' -> '5.6267E+6' ! intx069 tointegral '56267E+3' -> '5.6267E+7' ! intx070 tointegral '56267E+4' -> '5.6267E+8' ! intx071 tointegral '56267E+5' -> '5.6267E+9' ! intx072 tointegral '56267E+6' -> '5.6267E+10' ! intx073 tointegral '1.23E+96' -> '1.23E+96' ! intx074 tointegral '1.23E+384' -> '1.23E+384' ! intx075 tointegral '1.23E+999' -> '1.23E+999' ! ! intx080 tointegral '-56267E-10' -> '-0' ! intx081 tointegral '-56267E-5' -> '-1' ! intx082 tointegral '-56267E-2' -> '-563' ! intx083 tointegral '-56267E-1' -> '-5627' ! intx085 tointegral '-56267E-0' -> '-56267' ! intx086 tointegral '-56267E+0' -> '-56267' ! intx087 tointegral '-56267E+1' -> '-5.6267E+5' ! intx088 tointegral '-56267E+2' -> '-5.6267E+6' ! intx089 tointegral '-56267E+3' -> '-5.6267E+7' ! intx090 tointegral '-56267E+4' -> '-5.6267E+8' ! intx091 tointegral '-56267E+5' -> '-5.6267E+9' ! intx092 tointegral '-56267E+6' -> '-5.6267E+10' ! intx093 tointegral '-1.23E+96' -> '-1.23E+96' ! intx094 tointegral '-1.23E+384' -> '-1.23E+384' ! intx095 tointegral '-1.23E+999' -> '-1.23E+999' ! ! -- specials and zeros ! intx120 tointegral 'Inf' -> Infinity ! intx121 tointegral '-Inf' -> -Infinity ! intx122 tointegral NaN -> NaN ! intx123 tointegral sNaN -> NaN Invalid_operation ! intx124 tointegral 0 -> 0 ! intx125 tointegral -0 -> -0 ! intx126 tointegral 0.000 -> 0 ! intx127 tointegral 0.00 -> 0 ! intx128 tointegral 0.0 -> 0 ! intx129 tointegral 0 -> 0 ! intx130 tointegral 0E-3 -> 0 ! intx131 tointegral 0E-2 -> 0 ! intx132 tointegral 0E-1 -> 0 ! intx133 tointegral 0E-0 -> 0 ! intx134 tointegral 0E+1 -> 0E+1 ! intx135 tointegral 0E+2 -> 0E+2 ! intx136 tointegral 0E+3 -> 0E+3 ! intx137 tointegral 0E+4 -> 0E+4 ! intx138 tointegral 0E+5 -> 0E+5 ! intx139 tointegral -0.000 -> -0 ! intx140 tointegral -0.00 -> -0 ! intx141 tointegral -0.0 -> -0 ! intx142 tointegral -0 -> -0 ! intx143 tointegral -0E-3 -> -0 ! intx144 tointegral -0E-2 -> -0 ! intx145 tointegral -0E-1 -> -0 ! intx146 tointegral -0E-0 -> -0 ! intx147 tointegral -0E+1 -> -0E+1 ! intx148 tointegral -0E+2 -> -0E+2 ! intx149 tointegral -0E+3 -> -0E+3 ! intx150 tointegral -0E+4 -> -0E+4 ! intx151 tointegral -0E+5 -> -0E+5 ! -- propagating NaNs ! intx152 tointegral NaN808 -> NaN808 ! intx153 tointegral sNaN080 -> NaN80 Invalid_operation ! intx154 tointegral -NaN808 -> -NaN808 ! intx155 tointegral -sNaN080 -> -NaN80 Invalid_operation ! intx156 tointegral -NaN -> -NaN ! intx157 tointegral -sNaN -> -NaN Invalid_operation ! ! -- examples ! rounding: half_up ! precision: 9 ! intx200 tointegral 2.1 -> 2 ! intx201 tointegral 100 -> 100 ! intx202 tointegral 100.0 -> 100 ! intx203 tointegral 101.5 -> 102 ! intx204 tointegral -101.5 -> -102 ! intx205 tointegral 10E+5 -> 1.0E+6 ! intx206 tointegral 7.89E+77 -> 7.89E+77 ! intx207 tointegral -Inf -> -Infinity ! --- 1,176 ---- ! ------------------------------------------------------------------------ ! -- tointegral.decTest -- round decimal to integral value -- ! -- Copyright (c) IBM Corporation, 2001, 2003. All rights reserved. -- ! ------------------------------------------------------------------------ ! -- Please see the document "General Decimal Arithmetic Testcases" -- ! -- at http://www2.hursley.ibm.com/decimal for the description of -- ! -- these testcases. -- ! -- -- ! -- These testcases are experimental ('beta' versions), and they -- ! -- may contain errors. They are offered on an as-is basis. In -- ! -- particular, achieving the same results as the tests here is not -- ! -- a guarantee that an implementation complies with any Standard -- ! -- or specification. The tests are not exhaustive. -- ! -- -- ! -- Please send comments, suggestions, and corrections to the author: -- ! -- Mike Cowlishaw, IBM Fellow -- ! -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- ! -- mfc@uk.ibm.com -- ! ------------------------------------------------------------------------ ! version: 2.38 ! ! -- This set of tests tests the extended specification 'round-to-integral ! -- value' operation (from IEEE 854, later modified in 754r). ! -- All non-zero results are defined as being those from either copy or ! -- quantize, so those are assumed to have been tested. ! -- Note that 754r requires that Inexact not be set, and we similarly ! -- assume Rounded is not set. ! ! extended: 1 ! precision: 9 ! rounding: half_up ! maxExponent: 999 ! minExponent: -999 ! ! intx001 tointegral 0 -> 0 ! intx002 tointegral 0.0 -> 0 ! intx003 tointegral 0.1 -> 0 ! intx004 tointegral 0.2 -> 0 ! intx005 tointegral 0.3 -> 0 ! intx006 tointegral 0.4 -> 0 ! intx007 tointegral 0.5 -> 1 ! intx008 tointegral 0.6 -> 1 ! intx009 tointegral 0.7 -> 1 ! intx010 tointegral 0.8 -> 1 ! intx011 tointegral 0.9 -> 1 ! intx012 tointegral 1 -> 1 ! intx013 tointegral 1.0 -> 1 ! intx014 tointegral 1.1 -> 1 ! intx015 tointegral 1.2 -> 1 ! intx016 tointegral 1.3 -> 1 ! intx017 tointegral 1.4 -> 1 ! intx018 tointegral 1.5 -> 2 ! intx019 tointegral 1.6 -> 2 ! intx020 tointegral 1.7 -> 2 ! intx021 tointegral 1.8 -> 2 ! intx022 tointegral 1.9 -> 2 ! -- negatives ! intx031 tointegral -0 -> -0 ! intx032 tointegral -0.0 -> -0 ! intx033 tointegral -0.1 -> -0 ! intx034 tointegral -0.2 -> -0 ! intx035 tointegral -0.3 -> -0 ! intx036 tointegral -0.4 -> -0 ! intx037 tointegral -0.5 -> -1 ! intx038 tointegral -0.6 -> -1 ! intx039 tointegral -0.7 -> -1 ! intx040 tointegral -0.8 -> -1 ! intx041 tointegral -0.9 -> -1 ! intx042 tointegral -1 -> -1 ! intx043 tointegral -1.0 -> -1 ! intx044 tointegral -1.1 -> -1 ! intx045 tointegral -1.2 -> -1 ! intx046 tointegral -1.3 -> -1 ! intx047 tointegral -1.4 -> -1 ! intx048 tointegral -1.5 -> -2 ! intx049 tointegral -1.6 -> -2 ! intx050 tointegral -1.7 -> -2 ! intx051 tointegral -1.8 -> -2 ! intx052 tointegral -1.9 -> -2 ! -- next two would be NaN using quantize(x, 0) ! intx053 tointegral 10E+30 -> 1.0E+31 ! intx054 tointegral -10E+30 -> -1.0E+31 ! ! -- numbers around precision ! precision: 9 ! intx060 tointegral '56267E-10' -> '0' ! intx061 tointegral '56267E-5' -> '1' ! intx062 tointegral '56267E-2' -> '563' ! intx063 tointegral '56267E-1' -> '5627' ! intx065 tointegral '56267E-0' -> '56267' ! intx066 tointegral '56267E+0' -> '56267' ! intx067 tointegral '56267E+1' -> '5.6267E+5' ! intx068 tointegral '56267E+2' -> '5.6267E+6' ! intx069 tointegral '56267E+3' -> '5.6267E+7' ! intx070 tointegral '56267E+4' -> '5.6267E+8' ! intx071 tointegral '56267E+5' -> '5.6267E+9' ! intx072 tointegral '56267E+6' -> '5.6267E+10' ! intx073 tointegral '1.23E+96' -> '1.23E+96' ! intx074 tointegral '1.23E+384' -> '1.23E+384' ! intx075 tointegral '1.23E+999' -> '1.23E+999' ! ! intx080 tointegral '-56267E-10' -> '-0' ! intx081 tointegral '-56267E-5' -> '-1' ! intx082 tointegral '-56267E-2' -> '-563' ! intx083 tointegral '-56267E-1' -> '-5627' ! intx085 tointegral '-56267E-0' -> '-56267' ! intx086 tointegral '-56267E+0' -> '-56267' ! intx087 tointegral '-56267E+1' -> '-5.6267E+5' ! intx088 tointegral '-56267E+2' -> '-5.6267E+6' ! intx089 tointegral '-56267E+3' -> '-5.6267E+7' ! intx090 tointegral '-56267E+4' -> '-5.6267E+8' ! intx091 tointegral '-56267E+5' -> '-5.6267E+9' ! intx092 tointegral '-56267E+6' -> '-5.6267E+10' ! intx093 tointegral '-1.23E+96' -> '-1.23E+96' ! intx094 tointegral '-1.23E+384' -> '-1.23E+384' ! intx095 tointegral '-1.23E+999' -> '-1.23E+999' ! ! -- subnormal inputs ! intx100 tointegral 1E-999 -> 0 ! intx101 tointegral 0.1E-999 -> 0 ! intx102 tointegral 0.01E-999 -> 0 ! intx103 tointegral 0E-999 -> 0 ! ! -- specials and zeros ! intx120 tointegral 'Inf' -> Infinity ! intx121 tointegral '-Inf' -> -Infinity ! intx122 tointegral NaN -> NaN ! intx123 tointegral sNaN -> NaN Invalid_operation ! intx124 tointegral 0 -> 0 ! intx125 tointegral -0 -> -0 ! intx126 tointegral 0.000 -> 0 ! intx127 tointegral 0.00 -> 0 ! intx128 tointegral 0.0 -> 0 ! intx129 tointegral 0 -> 0 ! intx130 tointegral 0E-3 -> 0 ! intx131 tointegral 0E-2 -> 0 ! intx132 tointegral 0E-1 -> 0 ! intx133 tointegral 0E-0 -> 0 ! intx134 tointegral 0E+1 -> 0E+1 ! intx135 tointegral 0E+2 -> 0E+2 ! intx136 tointegral 0E+3 -> 0E+3 ! intx137 tointegral 0E+4 -> 0E+4 ! intx138 tointegral 0E+5 -> 0E+5 ! intx139 tointegral -0.000 -> -0 ! intx140 tointegral -0.00 -> -0 ! intx141 tointegral -0.0 -> -0 ! intx142 tointegral -0 -> -0 ! intx143 tointegral -0E-3 -> -0 ! intx144 tointegral -0E-2 -> -0 ! intx145 tointegral -0E-1 -> -0 ! intx146 tointegral -0E-0 -> -0 ! intx147 tointegral -0E+1 -> -0E+1 ! intx148 tointegral -0E+2 -> -0E+2 ! intx149 tointegral -0E+3 -> -0E+3 ! intx150 tointegral -0E+4 -> -0E+4 ! intx151 tointegral -0E+5 -> -0E+5 ! -- propagating NaNs ! intx152 tointegral NaN808 -> NaN808 ! intx153 tointegral sNaN080 -> NaN80 Invalid_operation ! intx154 tointegral -NaN808 -> -NaN808 ! intx155 tointegral -sNaN080 -> -NaN80 Invalid_operation ! intx156 tointegral -NaN -> -NaN ! intx157 tointegral -sNaN -> -NaN Invalid_operation ! ! -- examples ! rounding: half_up ! precision: 9 ! intx200 tointegral 2.1 -> 2 ! intx201 tointegral 100 -> 100 ! intx202 tointegral 100.0 -> 100 ! intx203 tointegral 101.5 -> 102 ! intx204 tointegral -101.5 -> -102 ! intx205 tointegral 10E+5 -> 1.0E+6 ! intx206 tointegral 7.89E+77 -> 7.89E+77 ! intx207 tointegral -Inf -> -Infinity ! From mondragon at users.sourceforge.net Mon Jun 21 23:51:41 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Jun 21 23:53:20 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.401,2.402 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12985/Python Modified Files: ceval.c Log Message: Making C profiling a configure option (at least temporarily) Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.401 retrieving revision 2.402 diff -C2 -d -r2.401 -r2.402 *** ceval.c 21 Jun 2004 16:31:14 -0000 2.401 --- ceval.c 22 Jun 2004 03:51:38 -0000 2.402 *************** *** 3503,3515 **** --- 3503,3523 ---- PyObject *self = PyCFunction_GET_SELF(func); if (flags & METH_NOARGS && na == 0) { + #ifdef WITH_C_PROF BEGIN_C_TRACE + #endif x = (*meth)(self, NULL); + #ifdef WITH_C_PROF END_C_TRACE + #endif } else if (flags & METH_O && na == 1) { PyObject *arg = EXT_POP(*pp_stack); + #ifdef WITH_C_PROF BEGIN_C_TRACE + #endif x = (*meth)(self, arg); + #ifdef WITH_C_PROF END_C_TRACE + #endif Py_DECREF(arg); } *************** *** 3522,3526 **** --- 3530,3536 ---- PyObject *callargs; callargs = load_args(pp_stack, na); + #ifdef WITH_C_PROF BEGIN_C_TRACE + #endif #ifdef WITH_TSC rdtscll(*pintr0); *************** *** 3530,3534 **** --- 3540,3546 ---- rdtscll(*pintr1); #endif + #ifdef WITH_C_PROF END_C_TRACE + #endif Py_XDECREF(callargs); } From mondragon at users.sourceforge.net Mon Jun 21 23:51:42 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Mon Jun 21 23:54:59 2004 Subject: [Python-checkins] python/dist/src pyconfig.h.in, 1.97, 1.98 configure, 1.447, 1.448 configure.in, 1.458, 1.459 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12985 Modified Files: pyconfig.h.in configure configure.in Log Message: Making C profiling a configure option (at least temporarily) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** pyconfig.h.in 8 Jun 2004 08:17:41 -0000 1.97 --- pyconfig.h.in 22 Jun 2004 03:51:31 -0000 1.98 *************** *** 760,763 **** --- 760,766 ---- #undef WINDOW_HAS_FLAGS + /* Define to enable profile hooks for C extension functions and builtins */ + #undef WITH_C_PROF + /* Define if you want documentation strings in extension modules */ #undef WITH_DOC_STRINGS Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.447 retrieving revision 1.448 diff -C2 -d -r1.447 -r1.448 *** configure 18 Jun 2004 02:47:15 -0000 1.447 --- configure 22 Jun 2004 03:51:32 -0000 1.448 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.457 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.4. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.458 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.4. *************** *** 870,873 **** --- 870,874 ---- --with-pth use GNU pth threading libraries --with(out)-doc-strings disable/enable documentation strings + --with-c-profiling Enable profiling of builtins and C extension functions --with(out)-tsc enable/disable timestamp counter profile --with(out)-pymalloc disable/enable specialized mallocs *************** *** 13030,13033 **** --- 13031,13059 ---- echo "${ECHO_T}$with_doc_strings" >&6 + # Check for C call profiling support + echo "$as_me:$LINENO: checking for --with-c-profiling" >&5 + echo $ECHO_N "checking for --with-c-profiling... $ECHO_C" >&6 + + # Check whether --with-c-profiling or --without-c-profiling was given. + if test "${with_c_profiling+set}" = set; then + withval="$with_c_profiling" + + if test "$withval" != no + then + + cat >>confdefs.h <<\_ACEOF + #define WITH_C_PROF 1 + _ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6 + else echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + fi + else + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + fi; + # Check for Python-specific malloc support echo "$as_me:$LINENO: checking for --with-tsc" >&5 Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.458 retrieving revision 1.459 diff -C2 -d -r1.458 -r1.459 *** configure.in 18 Jun 2004 02:47:21 -0000 1.458 --- configure.in 22 Jun 2004 03:51:37 -0000 1.459 *************** *** 1947,1950 **** --- 1947,1963 ---- AC_MSG_RESULT($with_doc_strings) + # Check for C call profiling support + AC_MSG_CHECKING(for --with-c-profiling) + AC_ARG_WITH(c-profiling, + [ --with-c-profiling Enable profiling of builtins and C extension functions], [ + if test "$withval" != no + then + AC_DEFINE(WITH_C_PROF, 1, + [Define to enable profile hooks for C extension functions and builtins]) + AC_MSG_RESULT(yes) + else AC_MSG_RESULT(no) + fi], + [AC_MSG_RESULT(no)]) + # Check for Python-specific malloc support AC_MSG_CHECKING(for --with-tsc) From mondragon at users.sourceforge.net Tue Jun 22 00:18:53 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Tue Jun 22 00:19:02 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.402,2.403 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv934/Python Modified Files: ceval.c Log Message: One forgotten C profiling #ifdef Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.402 retrieving revision 2.403 diff -C2 -d -r2.402 -r2.403 *** ceval.c 22 Jun 2004 03:51:38 -0000 2.402 --- ceval.c 22 Jun 2004 04:18:47 -0000 2.403 *************** *** 3489,3495 **** PyObject *x, *w; int are_tracing = 0; - PyThreadState *tstate = PyThreadState_GET(); /* Always dispatch PyCFunction first, because these are --- 3489,3496 ---- PyObject *x, *w; + #ifdef WITH_C_PROF int are_tracing = 0; PyThreadState *tstate = PyThreadState_GET(); + #endif /* Always dispatch PyCFunction first, because these are From collectvie at videotron.ca Tue Jun 22 01:19:27 2004 From: collectvie at videotron.ca (Carmen Erwin) Date: Tue Jun 22 01:59:14 2004 Subject: [Python-checkins] Your account has been created Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040622/9c4ddba8/attachment.html From mondragon at users.sourceforge.net Tue Jun 22 11:37:55 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Tue Jun 22 11:38:08 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.403,2.404 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28908/Python Modified Files: ceval.c Log Message: Less ugly #ifdefs for C profiling fix Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.403 retrieving revision 2.404 diff -C2 -d -r2.403 -r2.404 *** ceval.c 22 Jun 2004 04:18:47 -0000 2.403 --- ceval.c 22 Jun 2004 15:37:51 -0000 2.404 *************** *** 3439,3442 **** --- 3439,3443 ---- } + #ifdef WITH_C_PROF #define BEGIN_C_TRACE \ if (tstate->use_tracing) { \ *************** *** 3473,3476 **** --- 3474,3481 ---- } \ } + #else + #define BEGIN_C_TRACE + #define END_C_TRACE + #endif *************** *** 3504,3524 **** PyObject *self = PyCFunction_GET_SELF(func); if (flags & METH_NOARGS && na == 0) { - #ifdef WITH_C_PROF BEGIN_C_TRACE - #endif x = (*meth)(self, NULL); - #ifdef WITH_C_PROF END_C_TRACE - #endif } else if (flags & METH_O && na == 1) { PyObject *arg = EXT_POP(*pp_stack); - #ifdef WITH_C_PROF BEGIN_C_TRACE - #endif x = (*meth)(self, arg); - #ifdef WITH_C_PROF END_C_TRACE - #endif Py_DECREF(arg); } --- 3509,3521 ---- *************** *** 3531,3537 **** PyObject *callargs; callargs = load_args(pp_stack, na); - #ifdef WITH_C_PROF BEGIN_C_TRACE - #endif #ifdef WITH_TSC rdtscll(*pintr0); --- 3528,3532 ---- *************** *** 3541,3547 **** rdtscll(*pintr1); #endif - #ifdef WITH_C_PROF END_C_TRACE - #endif Py_XDECREF(callargs); } --- 3536,3540 ---- From qgtfhjzargzvjx at hotmail.com Wed Jun 23 17:53:55 2004 From: qgtfhjzargzvjx at hotmail.com (Angelina Yeager) Date: Wed Jun 23 17:03:22 2004 Subject: [Python-checkins] Mortgage Quotes on the Web Message-ID: <1080289760.31398@paypal.com> Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/gif Size: 3943 bytes Desc: not available Url : http://mail.python.org/pipermail/python-checkins/attachments/20040623/d7e3be4f/attachment.gif From bcannon at users.sourceforge.net Wed Jun 23 20:48:47 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed Jun 23 20:48:52 2004 Subject: [Python-checkins] python/dist/src/Modules getpath.c,1.47,1.48 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14966/Modules Modified Files: getpath.c Log Message: Change comment from C++ style to C. Index: getpath.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/getpath.c,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** getpath.c 3 Jun 2004 14:33:03 -0000 1.47 --- getpath.c 24 Jun 2004 00:48:44 -0000 1.48 *************** *** 399,403 **** else if(0 == _NSGetExecutablePath(progpath, &nsexeclength) && progpath[0] == SEP) ; ! #endif // __APPLE__ else if (path) { while (1) { --- 399,403 ---- else if(0 == _NSGetExecutablePath(progpath, &nsexeclength) && progpath[0] == SEP) ; ! #endif /* __APPLE__ */ else if (path) { while (1) { From bcannon at users.sourceforge.net Wed Jun 23 21:38:50 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed Jun 23 21:38:53 2004 Subject: [Python-checkins] python/dist/src setup.py,1.188,1.189 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24270 Modified Files: setup.py Log Message: Add compilation of timemodule.c with datetimemodule.c to get __PyTime_DoubleToTimet(). Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.188 retrieving revision 1.189 diff -C2 -d -r1.188 -r1.189 *** setup.py 4 Jun 2004 13:55:13 -0000 1.188 --- setup.py 24 Jun 2004 01:38:47 -0000 1.189 *************** *** 316,320 **** exts.append( Extension('time', ['timemodule.c'], libraries=math_libs) ) ! exts.append( Extension('datetime', ['datetimemodule.c'], libraries=math_libs) ) # random number generator implemented in C --- 316,320 ---- exts.append( Extension('time', ['timemodule.c'], libraries=math_libs) ) ! exts.append( Extension('datetime', ['datetimemodule.c', 'timemodule.c'], libraries=math_libs) ) # random number generator implemented in C From fdrake at users.sourceforge.net Thu Jun 24 02:04:02 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Jun 24 02:04:09 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libbsddb.tex,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29720 Modified Files: libbsddb.tex Log Message: move the note about the bsddb185 module above the "See also" box; that should always go last in the relevant section's main content, but before child sections Index: libbsddb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbsddb.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libbsddb.tex 7 Dec 2003 13:00:23 -0000 1.15 --- libbsddb.tex 24 Jun 2004 06:03:59 -0000 1.16 *************** *** 88,95 **** - \begin{seealso} - \seemodule{dbhash}{DBM-style interface to the \module{bsddb}} - \end{seealso} - \begin{notice} Beginning in 2.3 some Unix versions of Python may have a \module{bsddb185} --- 88,91 ---- *************** *** 99,102 **** --- 95,103 ---- \end{notice} + + \begin{seealso} + \seemodule{dbhash}{DBM-style interface to the \module{bsddb}} + \end{seealso} + \subsection{Hash, BTree and Record Objects \label{bsddb-objects}} From rhettinger at users.sourceforge.net Thu Jun 24 05:25:42 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Jun 24 05:25:51 2004 Subject: [Python-checkins] python/dist/src/Python compile.c,2.304,2.305 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3806 Modified Files: compile.c Log Message: Move NOP to end of code transformation. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.304 retrieving revision 2.305 diff -C2 -d -r2.304 -r2.305 *** compile.c 21 Jun 2004 16:31:15 -0000 2.304 --- compile.c 24 Jun 2004 09:25:39 -0000 2.305 *************** *** 393,397 **** switch (opcode) { ! /* Replace UNARY_NOT JUMP_IF_FALSE with NOP JUMP_IF_TRUE */ case UNARY_NOT: if (codestr[i+1] != JUMP_IF_FALSE || --- 393,398 ---- switch (opcode) { ! /* Replace UNARY_NOT JUMP_IF_FALSE POP_TOP with ! with JUMP_IF_TRUE POP_TOP NOP */ case UNARY_NOT: if (codestr[i+1] != JUMP_IF_FALSE || *************** *** 402,407 **** if (codestr[tgt] != POP_TOP) continue; ! codestr[i] = NOP; ! codestr[i+1] = JUMP_IF_TRUE; break; --- 403,411 ---- if (codestr[tgt] != POP_TOP) continue; ! j = GETARG(codestr, i+1) + 1; ! codestr[i] = JUMP_IF_TRUE; ! SETARG(codestr, i, j); ! codestr[i+3] = POP_TOP; ! codestr[i+4] = NOP; break; From agatha.Xiong at msn.com Thu Jun 24 15:21:00 2004 From: agatha.Xiong at msn.com (Leonel Fischer) Date: Thu Jun 24 14:49:06 2004 Subject: [Python-checkins] FW: M(o)rtgage Application Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040624/80d504cd/attachment.html From agatha.Xiong at msn.com Thu Jun 24 15:21:00 2004 From: agatha.Xiong at msn.com (Leonel Fischer) Date: Thu Jun 24 16:18:17 2004 Subject: [Python-checkins] FW: M(o)rtgage Application Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040624/48873d31/attachment.html From facundobatista at users.sourceforge.net Thu Jun 24 21:29:32 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Thu Jun 24 21:29:39 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.21, 1.22 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10118 Modified Files: Decimal.py Log Message: Made near immutable. Lot of clean-ups. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Decimal.py 21 Jun 2004 21:50:51 -0000 1.21 --- Decimal.py 25 Jun 2004 01:29:29 -0000 1.22 *************** *** 96,99 **** --- 96,101 ---- # facundobatista: + # 0.8.2 2004.06.24 Lot of small clean-ups from Raymond Hettinger. + # 0.8.1 2004.06.23 Complies with immutability-near as discussed in c.l.py. # 0.8.0 2004.06.21 Using the updated Spec (and complies with new test cases) from # Cowlishaw. Deprecated trim and rescale. Changed __str__ and *************** *** 131,135 **** import copy import math - import time from operator import xor --- 133,136 ---- *************** *** 351,360 **** return Infsign[sign] if sign == 0: ! if context.rounding in (ROUND_CEILING,): return Infsign[sign] return Decimal((sign, (9,)*context.prec, context.Emax-context.prec+1)) if sign == 1: ! if context.rounding in (ROUND_FLOOR,): return Infsign[sign] return Decimal( (sign, (9,)*context.prec, --- 352,361 ---- return Infsign[sign] if sign == 0: ! if context.rounding == ROUND_CEILING: return Infsign[sign] return Decimal((sign, (9,)*context.prec, context.Emax-context.prec+1)) if sign == 1: ! if context.rounding == ROUND_FLOOR: return Infsign[sign] return Decimal( (sign, (9,)*context.prec, *************** *** 441,445 **** self._exp = 'N' #sNaN self._sign = sign ! self._int = tuple(map(int, tuple(diag))) #Diagnostic info return self._convertString(value, context) --- 442,446 ---- self._exp = 'N' #sNaN self._sign = sign ! self._int = tuple(map(int, diag)) #Diagnostic info return self._convertString(value, context) *************** *** 489,493 **** return ! raise TypeError("Can't convert " + `value`) def from_float(cls, value, positions=None): --- 490,494 ---- return ! raise TypeError("Can't convert %r" % value) def from_float(cls, value, positions=None): *************** *** 818,822 **** else: sign = 1 ! if context._rounding_decision in (ALWAYS_ROUND,): return Decimal((sign, self._int, self._exp))._fix(context=context) return Decimal( (sign, self._int, self._exp)) --- 819,823 ---- else: sign = 1 ! if context._rounding_decision == ALWAYS_ROUND: return Decimal((sign, self._int, self._exp))._fix(context=context) return Decimal( (sign, self._int, self._exp)) *************** *** 838,842 **** sign = 0 ! if context._rounding_decision in (ALWAYS_ROUND,): ans = self._fix(context=context) else: --- 839,843 ---- sign = 0 ! if context._rounding_decision == ALWAYS_ROUND: ans = self._fix(context=context) else: *************** *** 888,892 **** return Decimal(other) #Can't both be infinity here ! shouldround = context._rounding_decision in (ALWAYS_ROUND,) exp = min(self._exp, other._exp) --- 889,893 ---- return Decimal(other) #Can't both be infinity here ! shouldround = context._rounding_decision == ALWAYS_ROUND exp = min(self._exp, other._exp) *************** *** 1030,1034 **** ans = Decimal((self._sign, L, self._exp)) ! if round and context._rounding_decision in (ALWAYS_ROUND,): ans = ans._fix(context=context) return ans --- 1031,1035 ---- ans = Decimal((self._sign, L, self._exp)) ! if round and context._rounding_decision == ALWAYS_ROUND: ans = ans._fix(context=context) return ans *************** *** 1059,1063 **** resultexp = self._exp + other._exp ! shouldround = context._rounding_decision in (ALWAYS_ROUND,) # Special case for multiplying by zero --- 1060,1064 ---- resultexp = self._exp + other._exp ! shouldround = context._rounding_decision == ALWAYS_ROUND # Special case for multiplying by zero *************** *** 1090,1099 **** accumulator = [0]*(len(self._int) + len(other._int)) ! for i in range(len(op2)): if op2[i] == 0: continue mult = op2[i] carry = 0 ! for j in range(len(op1)): carry, accumulator[i+j] = divmod( mult * op1[j] + carry + accumulator[i+j], 10) --- 1091,1100 ---- accumulator = [0]*(len(self._int) + len(other._int)) ! for i in xrange(len(op2)): if op2[i] == 0: continue mult = op2[i] carry = 0 ! for j in xrange(len(op1)): carry, accumulator[i+j] = divmod( mult * op1[j] + carry + accumulator[i+j], 10) *************** *** 1196,1200 **** #OK, so neither = 0, INF ! shouldround = context._rounding_decision in (ALWAYS_ROUND,) #If we're dividing into ints, and self < other, stop. --- 1197,1201 ---- #OK, so neither = 0, INF ! shouldround = context._rounding_decision == ALWAYS_ROUND #If we're dividing into ints, and self < other, stop. *************** *** 1748,1752 **** mul = Decimal(1).__div__(mul, context=context) ! shouldround = context._rounding_decision in (ALWAYS_ROUND,) spot = 1 --- 1749,1753 ---- mul = Decimal(1).__div__(mul, context=context) ! shouldround = context._rounding_decision == ALWAYS_ROUND spot = 1 *************** *** 1825,1835 **** """ if self._isnan() or other._isnan(): ! if self._isnan() and other._isnan(): ! return True ! return False if self._isinfinity() or other._isinfinity(): ! if self._isinfinity() and other._isinfinity(): ! return True ! return False return self._exp == other._exp --- 1826,1832 ---- """ if self._isnan() or other._isnan(): ! return self._isnan() and other._isnan() and True if self._isinfinity() or other._isinfinity(): ! return self._isinfinity() and other._isinfinity() and True return self._exp == other._exp *************** *** 2044,2048 **** if self < other: ans = other ! shouldround = context._rounding_decision in (ALWAYS_ROUND,) if shouldround: ans = ans._fix(context=context) --- 2041,2045 ---- if self < other: ans = other ! shouldround = context._rounding_decision == ALWAYS_ROUND if shouldround: ans = ans._fix(context=context) *************** *** 2068,2072 **** ans = other ! if context._rounding_decision in (ALWAYS_ROUND,): ans = ans._fix(context=context) --- 2065,2069 ---- ans = other ! if context._rounding_decision == ALWAYS_ROUND: ans = ans._fix(context=context) *************** *** 2078,2084 **** return True rest = self._int[self._exp:] ! if rest == (0,)*len(rest): ! return True ! return False def _iseven(self): --- 2075,2079 ---- return True rest = self._int[self._exp:] ! return rest == (0,)*len(rest) def _iseven(self): *************** *** 2096,2099 **** --- 2091,2105 ---- return 0 + #properties to immutability-near feature + def _get_sign(self): + return self._sign + def _get_int(self): + return self._int + def _get_exp(self): + return self._exp + sign = property(_get_sign) + int = property(_get_int) + exp = property(_get_exp) + # get rounding method function: *************** *** 2309,2313 **** def __repr__(self): ! return "(" + `self.sign` + ", " + `self.int` + ", " + `self.exp` + ")" __str__ = __repr__ --- 2315,2319 ---- def __repr__(self): ! return "(%r, %r, %r)" % (self.sign, self.int, self.exp) __str__ = __repr__ *************** *** 2327,2332 **** def __cmp__(self, other): if self.exp != other.exp: ! raise ValueError("Operands not normalized: " + `self` + ! ", " + `other`) if self.sign != other.sign: if self.sign == -1: --- 2333,2337 ---- def __cmp__(self, other): if self.exp != other.exp: ! raise ValueError("Operands not normalized: %r, %r" % (self, other)) if self.sign != other.sign: if self.sign == -1: *************** *** 2344,2348 **** if len(int1) < len(int2): return direction * -1 ! for i in range(len(int1)): if int1[i] > int2[i]: return direction * 1 --- 2349,2353 ---- if len(int1) < len(int2): return direction * -1 ! for i in xrange(len(int1)): if int1[i] > int2[i]: return direction * 1 *************** *** 2374,2378 **** carry = 0 ! for x in range(len(list)): self.int[x] -= list[x] + carry if self.int[x] < 0: --- 2379,2383 ---- carry = 0 ! for x in xrange(len(list)): self.int[x] -= list[x] + carry if self.int[x] < 0: *************** *** 2631,2635 **** m = _parser(s) if m is None: ! raise ValueError("Can't parse as number: " + `s`) if m.group('sign') == "-": --- 2636,2640 ---- m = _parser(s) if m is None: ! raise ValueError("Can't parse as number: %r" % s) if m.group('sign') == "-": *************** *** 2653,2663 **** fracpart = "" ! nfrac = len(fracpart) ! exp = exp - nfrac mantissa = intpart + fracpart ! tmp = [] ! for digit in mantissa: ! tmp.append(int(digit)) backup = tmp while tmp and tmp[0] == 0: --- 2658,2665 ---- fracpart = "" ! exp -= len(fracpart) mantissa = intpart + fracpart ! tmp = map(int, mantissa) backup = tmp while tmp and tmp[0] == 0: *************** *** 2709,2715 **** assert digit >> CHUNK == 0 top = (top << CHUNK) | digit ! f = f - digit assert 0.0 <= f < 1.0 ! e = e - CHUNK assert top > 0 --- 2711,2717 ---- assert digit >> CHUNK == 0 top = (top << CHUNK) | digit ! f -= digit assert 0.0 <= f < 1.0 ! e -= CHUNK assert top > 0 *************** *** 2719,2728 **** # be removed without changing the result). while e < 0 and top & 1 == 0: ! top = top >> 1 ! e = e + 1 # Transform this into an equal value top' * 10**e'. if e > 0: ! top = top << e e = 0 elif e < 0: --- 2721,2730 ---- # be removed without changing the result). while e < 0 and top & 1 == 0: ! top >>= 1 ! e += 1 # Transform this into an equal value top' * 10**e'. if e > 0: ! top <<= e e = 0 elif e < 0: *************** *** 2738,2742 **** break top = newtop ! e = e + 1 return "%s%se%d" % (sign, str(top), e) --- 2740,2744 ---- break top = newtop ! e += 1 return "%s%se%d" % (sign, str(top), e) From facundobatista at users.sourceforge.net Thu Jun 24 21:30:51 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Thu Jun 24 21:30:54 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal test_Decimal.py, 1.18, 1.19 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10573 Modified Files: test_Decimal.py Log Message: Tests to check near-immutable Decimal. Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_Decimal.py 21 Jun 2004 21:52:52 -0000 1.18 --- test_Decimal.py 25 Jun 2004 01:30:49 -0000 1.19 *************** *** 15,18 **** --- 15,19 ---- """ + # 0.2.1 2004.06.23 fb: Added immutability test for operations. # 0.2.0 2004.06.21 fb: Using the new test cases from Cowlishaw. Deprecated trim # test case and use of result in inexact test case. Added *************** *** 1190,1220 **** self.assertEqual(d.as_tuple(), (0, (0,), 'F') ) ! ## ! ## As is impossible to make a real immutable instance in Python, ! ## I'm delaying this feature to some future. Facundo Batista 19-Jun-2004 ! ## ! ## def test_immutability(self): ! ## '''Try to change internal objects and see if immutable.''' ! ## ! ## d = Decimal(42) ! ## ! ## #the used attributes ! ## try: ! ## d._exp = 20 ! ## d._int = 3 ! ## d._sign = 1 ! ## except AttributeError: ! ## pass ! ## else: ! ## self.fail('Did not raised an error!') ! ## ! ## #some new attribute ! ## try: ! ## d.newone = None ! ## except AttributeError: ! ## pass ! ## else: ! ## self.fail('Did not raised an error!') ! ## --- 1191,1292 ---- self.assertEqual(d.as_tuple(), (0, (0,), 'F') ) ! def test_immutability_onpurpose(self): ! '''Try to change internal objects and see if immutable.''' ! ! d = Decimal(42) ! ! #you can get the attributes... ! d.exp ! d.int ! d.sign ! ! #...but not change them! ! try: ! d.exp = 20 ! d.int = 3 ! d.sign = 1 ! except AttributeError: ! pass ! else: ! self.fail('Did not raised an error!') ! ! #some new attribute ! try: ! d.newone = None ! except AttributeError: ! pass ! else: ! self.fail('Did not raised an error!') ! ! def test_immutability_operations(self): ! '''Do operations and check that it didn't change change internal objects.''' ! ! d1 = Decimal('-25e55') ! b1 = Decimal('-25e55') ! d2 = Decimal('33e-33') ! b2 = Decimal('33e-33') ! ! def checkSameDec(operation, useOther=False): ! if useOther: ! eval("d1." + operation + "(d2)") ! self.assertEqual(d1._sign, b1._sign) ! self.assertEqual(d1._int, b1._int) ! self.assertEqual(d1._exp, b1._exp) ! self.assertEqual(d2._sign, b2._sign) ! self.assertEqual(d2._int, b2._int) ! self.assertEqual(d2._exp, b2._exp) ! else: ! eval("d1." + operation + "()") ! self.assertEqual(d1._sign, b1._sign) ! self.assertEqual(d1._int, b1._int) ! self.assertEqual(d1._exp, b1._exp) ! return ! ! Decimal(d1) ! self.assertEqual(d1._sign, b1._sign) ! self.assertEqual(d1._int, b1._int) ! self.assertEqual(d1._exp, b1._exp) ! ! checkSameDec("__abs__") ! checkSameDec("__add__", True) ! checkSameDec("__div__", True) ! checkSameDec("__divmod__", True) ! checkSameDec("__cmp__", True) ! checkSameDec("__float__") ! checkSameDec("__floordiv__", True) ! checkSameDec("__hash__") ! checkSameDec("__int__") ! checkSameDec("__long__") ! checkSameDec("__mod__", True) ! checkSameDec("__mul__", True) ! checkSameDec("__neg__") ! checkSameDec("__nonzero__") ! checkSameDec("__pos__") ! checkSameDec("__pow__", True) ! checkSameDec("__radd__", True) ! checkSameDec("__rdiv__", True) ! checkSameDec("__rdivmod__", True) ! checkSameDec("__repr__") ! checkSameDec("__rfloordiv__", True) ! checkSameDec("__rmod__", True) ! checkSameDec("__rmul__", True) ! checkSameDec("__rpow__", True) ! checkSameDec("__rsub__", True) ! checkSameDec("__str__") ! checkSameDec("__sub__", True) ! checkSameDec("__truediv__", True) ! checkSameDec("adjusted") ! checkSameDec("as_tuple") ! checkSameDec("compare", True) ! checkSameDec("max", True) ! checkSameDec("min", True) ! checkSameDec("normalize") ! checkSameDec("quantize", True) ! checkSameDec("remainder_near", True) ! checkSameDec("same_quantum", True) ! checkSameDec("sqrt") ! checkSameDec("to_eng_string") ! checkSameDec("to_integral") ! From rhettinger at users.sourceforge.net Fri Jun 25 02:17:05 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Jun 25 02:53:11 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.22, 1.23 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29145 Modified Files: Decimal.py Log Message: Touchups (round 1): * Normalize whitespace * Fixup broken doctest in the module docstring * Add a more informative error message for Decimal(3.14) * Document from_float as a class method * Rework the addition logic for speed/clarity * Simplify and speedup zero checks Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Decimal.py 25 Jun 2004 01:29:29 -0000 1.22 --- Decimal.py 25 Jun 2004 06:17:02 -0000 1.23 *************** *** 26,30 **** Decimal("1") >>> Decimal("-.0123") ! Decimal("-.0123") >>> Decimal(123456) Decimal("123456") --- 26,30 ---- Decimal("1") >>> Decimal("-.0123") ! Decimal("-0.0123") >>> Decimal(123456) Decimal("123456") *************** *** 133,137 **** import copy import math ! from operator import xor #Capitals: 1E+10, not 1e10 --- 133,138 ---- import copy import math ! import operator ! xor = operator.xor #Capitals: 1E+10, not 1e10 *************** *** 490,497 **** return raise TypeError("Can't convert %r" % value) def from_float(cls, value, positions=None): ! """Static function that creates Decimal from float value must be float --- 491,502 ---- return + if isinstance(value, float): + raise TypeError("Can't convert " + repr(value) + + ". Try Decimal.from_float() instead.") + raise TypeError("Can't convert %r" % value) def from_float(cls, value, positions=None): ! """Class method that creates Decimal from float value must be float *************** *** 605,612 **** if isinstance(self._exp, str): return 1 ! for digit in self._int: ! if digit != 0: ! return 1 ! return 0 def __cmp__(self, other, context=None): --- 610,614 ---- if isinstance(self._exp, str): return 1 ! return self._int != (0,)*len(self._int) def __cmp__(self, other, context=None): *************** *** 947,971 **** #Now, op1 > abs(op2) > 0 - carry, loan = 0, 0 op1.int.reverse() op2.int.reverse() ! result.int = [0]*len(op1.int) ! for i in range(len(op1.int)): ! tmp = op1.int[i] + (op2.sign * op2.int[i]) + carry - loan ! carry, loan = (0, 0) ! if tmp > 9: ! carry = 1 ! tmp = tmp - 10 ! if tmp < 0: ! loan = 1 ! tmp = tmp + 10 ! result.int[i] = tmp ! if carry: ! result.int.append(1) ! if loan: ! raise "What are we doing here?" ! while result.int[-1] == 0: ! result.int.pop() ! result.int.reverse() result.exp = op1.exp ans = Decimal(result) --- 949,983 ---- #Now, op1 > abs(op2) > 0 op1.int.reverse() op2.int.reverse() ! ! if op2.sign == 1: ! result.int = resultint = map(operator.add, op1.int, op2.int) ! carry = 0 ! for i in xrange(len(op1.int)): ! tmp = resultint[i] + carry ! carry = 0 ! if tmp > 9: ! carry = 1 ! tmp -= 10 ! resultint[i] = tmp ! if carry: ! resultint.append(1) ! else: ! result.int = resultint = map(operator.sub, op1.int, op2.int) ! loan = 0 ! for i in xrange(len(op1.int)): ! tmp = resultint[i] - loan ! loan = 0 ! if tmp < 0: ! loan = 1 ! tmp += 10 ! resultint[i] = tmp ! assert not loan ! ! while resultint[-1] == 0: ! resultint.pop() ! resultint.reverse() ! result.exp = op1.exp ans = Decimal(result) *************** *** 1573,1582 **** #OK, but maybe all the lost digits are 0. ! all0 = 1 ! for digit in self._int[expdiff:]: ! if digit != 0: ! all0 = 0 ! break ! if all0: ans = Decimal( (temp._sign, temp._int[:prec], temp._exp - expdiff)) #Rounded, but not Inexact --- 1585,1590 ---- #OK, but maybe all the lost digits are 0. ! lostdigits = self._int[expdiff:] ! if lostdigits == (0,) * len(lostdigits): ans = Decimal( (temp._sign, temp._int[:prec], temp._exp - expdiff)) #Rounded, but not Inexact From rhettinger at users.sourceforge.net Fri Jun 25 13:46:23 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Jun 25 13:46:28 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.23, 1.24 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16613 Modified Files: Decimal.py Log Message: Touchup isinfinity() and isnan(). Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Decimal.py 25 Jun 2004 06:17:02 -0000 1.23 --- Decimal.py 25 Jun 2004 17:46:20 -0000 1.24 *************** *** 99,103 **** # 0.8.1 2004.06.23 Complies with immutability-near as discussed in c.l.py. # 0.8.0 2004.06.21 Using the updated Spec (and complies with new test cases) from ! # Cowlishaw. Deprecated trim and rescale. Changed __str__ and # __repr__ to return in sci format, added as_tuple(). Fixed the # initial examples. Extracted lt, gt and eq methods from context. --- 99,103 ---- # 0.8.1 2004.06.23 Complies with immutability-near as discussed in c.l.py. # 0.8.0 2004.06.21 Using the updated Spec (and complies with new test cases) from ! # Cowlishaw. Deprecated trim and rescale. Changed __str__ and # __repr__ to return in sci format, added as_tuple(). Fixed the # initial examples. Extracted lt, gt and eq methods from context. *************** *** 466,470 **** if not isinstance(digit, (int,long)) or digit < 0: raise ValueError, "The second value in the tuple must be composed of non negative integer elements." ! self._sign = value[0] self._int = tuple(value[1]) --- 466,470 ---- if not isinstance(digit, (int,long)) or digit < 0: raise ValueError, "The second value in the tuple must be composed of non negative integer elements." ! self._sign = value[0] self._int = tuple(value[1]) *************** *** 521,525 **** real_decimal_positions = positions + int_positions d = d._round(real_decimal_positions, ROUND_HALF_UP) ! return d from_float = classmethod(from_float) --- 521,525 ---- real_decimal_positions = positions + int_positions d = d._round(real_decimal_positions, ROUND_HALF_UP) ! return d from_float = classmethod(from_float) *************** *** 741,745 **** #exp is closest mult. of 3 >= self._exp exp = ((self._exp - 1)// 3 + 1) * 3 ! if exp != self._exp: s = '0.'+'0'*(exp - self._exp) else: --- 741,745 ---- #exp is closest mult. of 3 >= self._exp exp = ((self._exp - 1)// 3 + 1) * 3 ! if exp != self._exp: s = '0.'+'0'*(exp - self._exp) else: *************** *** 955,959 **** result.int = resultint = map(operator.add, op1.int, op2.int) carry = 0 ! for i in xrange(len(op1.int)): tmp = resultint[i] + carry carry = 0 --- 955,959 ---- result.int = resultint = map(operator.add, op1.int, op2.int) carry = 0 ! for i in xrange(len(op1.int)): tmp = resultint[i] + carry carry = 0 *************** *** 963,967 **** resultint[i] = tmp if carry: ! resultint.append(1) else: result.int = resultint = map(operator.sub, op1.int, op2.int) --- 963,967 ---- resultint[i] = tmp if carry: ! resultint.append(1) else: result.int = resultint = map(operator.sub, op1.int, op2.int) *************** *** 975,979 **** resultint[i] = tmp assert not loan ! while resultint[-1] == 0: resultint.pop() --- 975,979 ---- resultint[i] = tmp assert not loan ! while resultint[-1] == 0: resultint.pop() *************** *** 1733,1737 **** if not modulo and n > 0 and (self._exp + len(self._int) - 1) * n > context.Emax \ and self: ! tmp = Decimal('inf') tmp._sign = sign --- 1733,1737 ---- if not modulo and n > 0 and (self._exp + len(self._int) - 1) * n > context.Emax \ and self: ! tmp = Decimal('inf') tmp._sign = sign *************** *** 1838,1842 **** return self._isinfinity() and other._isinfinity() and True return self._exp == other._exp ! def _rescale(self, exp, rounding = None, context=None, watchexp = 1): """Rescales so that the exponent is exp. --- 1838,1842 ---- return self._isinfinity() and other._isinfinity() and True return self._exp == other._exp ! def _rescale(self, exp, rounding = None, context=None, watchexp = 1): """Rescales so that the exponent is exp. *************** *** 1873,1877 **** if watchexp and digits > context.prec: return context._raise_error(InvalidOperation, 'Rescale > prec') ! tmp = Decimal(self) tmp._int = (0,)+tmp._int --- 1873,1877 ---- if watchexp and digits > context.prec: return context._raise_error(InvalidOperation, 'Rescale > prec') ! tmp = Decimal(self) tmp._int = (0,)+tmp._int *************** *** 1968,1972 **** Emax, Emin = context.Emax, context.Emin context.Emax, context.Emin = DEFAULT_MAX_EXPONENT, DEFAULT_MIN_EXPONENT ! half = Decimal('0.5') --- 1968,1972 ---- Emax, Emin = context.Emax, context.Emin context.Emax, context.Emin = DEFAULT_MAX_EXPONENT, DEFAULT_MIN_EXPONENT ! half = Decimal('0.5') *************** *** 2109,2113 **** int = property(_get_int) exp = property(_get_exp) ! # get rounding method function: --- 2109,2113 ---- int = property(_get_int) exp = property(_get_exp) ! # get rounding method function: *************** *** 2558,2574 **** SetDefaultContext(DEFAULT_CONTEXT) def isinfinity(num): ! """Determines whether a string or float is infinity.""" ! try: ! if isinstance(num, float): ! num = str(num) ! num = num.lower() ! if num in ['inf', 'infinity', '+inf', '+infinity']: ! return 1 ! if num in ['-inf', '-infinity']: ! return -1 ! except AttributeError: ! pass ! return 0 def isnan(num): --- 2558,2577 ---- SetDefaultContext(DEFAULT_CONTEXT) + _infinity_map = { + 'inf' : 1, + 'infinity' : 1, + '+inf' : 1, + '+infinity' : 1, + '-inf' : -1, + '-infinity' : -1 + } + def isinfinity(num): ! """Determines whether a string or float is infinity. ! ! +1 for positive infinity; 0 for finite ; +1 for positive infinity ! """ ! num = str(num).lower() ! return _infinity_map.get(num, 0) def isnan(num): *************** *** 2579,2591 **** 0 => not a NaN """ ! if isinstance(num, float): ! num = str(num) ! if len(num) == 0: return 0 ! num = num.lower() ! #get the sign, get rid of trailing [+-] sign = 0 ! if num[0] == '+': num = num[1:] elif num[0] == '-': #elif avoids '+-nan' --- 2582,2592 ---- 0 => not a NaN """ ! num = str(num).lower() ! if not num: return 0 ! #get the sign, get rid of trailing [+-] sign = 0 ! if num[0] == '+': num = num[1:] elif num[0] == '-': #elif avoids '+-nan' From fdrake at users.sourceforge.net Fri Jun 25 15:04:24 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Jun 25 15:04:29 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/tests test_build_py.py, 1.1, 1.2 test_build_scripts.py, 1.1, 1.2 test_install_scripts.py, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1190 Modified Files: test_build_py.py test_build_scripts.py test_install_scripts.py Log Message: add boilerplate so the test modules can be run as scripts Index: test_build_py.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/tests/test_build_py.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_build_py.py 17 Jun 2004 20:16:19 -0000 1.1 --- test_build_py.py 25 Jun 2004 19:04:20 -0000 1.2 *************** *** 49,50 **** --- 49,53 ---- def test_suite(): return unittest.makeSuite(BuildPyTestCase) + + if __name__ == "__main__": + unittest.main(defaultTest="test_suite") Index: test_build_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/tests/test_build_scripts.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_build_scripts.py 21 Jun 2004 16:15:22 -0000 1.1 --- test_build_scripts.py 25 Jun 2004 19:04:21 -0000 1.2 *************** *** 73,74 **** --- 73,77 ---- def test_suite(): return unittest.makeSuite(BuildScriptsTestCase) + + if __name__ == "__main__": + unittest.main(defaultTest="test_suite") Index: test_install_scripts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/tests/test_install_scripts.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_install_scripts.py 17 Jun 2004 20:14:50 -0000 1.3 --- test_install_scripts.py 25 Jun 2004 19:04:21 -0000 1.4 *************** *** 71,75 **** - def test_suite(): return unittest.makeSuite(InstallScriptsTestCase) --- 71,77 ---- def test_suite(): return unittest.makeSuite(InstallScriptsTestCase) + + if __name__ == "__main__": + unittest.main(defaultTest="test_suite") From rhettinger at users.sourceforge.net Fri Jun 25 18:17:41 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Jun 25 18:17:54 2004 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.259,2.260 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10121 Modified Files: typeobject.c Log Message: Fix leak found by Eric Huss. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.259 retrieving revision 2.260 diff -C2 -d -r2.259 -r2.260 *** typeobject.c 11 Jun 2004 14:41:17 -0000 2.259 --- typeobject.c 25 Jun 2004 22:17:39 -0000 2.260 *************** *** 3955,3959 **** if (func == NULL) return -1; ! return PyDict_SetItemString(type->tp_dict, "__new__", func); } --- 3955,3964 ---- if (func == NULL) return -1; ! if(PyDict_SetItemString(type->tp_dict, "__new__", func)) { ! Py_DECREF(func); ! return -1; ! } ! Py_DECREF(func); ! return 0; } From rhettinger at users.sourceforge.net Fri Jun 25 18:19:04 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Jun 25 18:19:07 2004 Subject: [Python-checkins] python/dist/src/Objects typeobject.c, 2.241.6.10, 2.241.6.11 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10348 Modified Files: Tag: release23-maint typeobject.c Log Message: Fix leak found by Eric Huss. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.241.6.10 retrieving revision 2.241.6.11 diff -C2 -d -r2.241.6.10 -r2.241.6.11 *** typeobject.c 11 Jun 2004 15:09:41 -0000 2.241.6.10 --- typeobject.c 25 Jun 2004 22:18:46 -0000 2.241.6.11 *************** *** 3914,3918 **** if (func == NULL) return -1; ! return PyDict_SetItemString(type->tp_dict, "__new__", func); } --- 3914,3923 ---- if (func == NULL) return -1; ! if(PyDict_SetItemString(type->tp_dict, "__new__", func)) { ! Py_DECREF(func); ! return -1; ! } ! Py_DECREF(func); ! return 0; } From rhettinger at users.sourceforge.net Fri Jun 25 18:20:37 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Jun 25 18:20:45 2004 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.267,1.268 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10828 Modified Files: ACKS Log Message: Fix leak found by Eric Huss. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.267 retrieving revision 1.268 diff -C2 -d -r1.267 -r1.268 *** ACKS 20 Jun 2004 22:41:32 -0000 1.267 --- ACKS 25 Jun 2004 22:20:33 -0000 1.268 *************** *** 273,276 **** --- 273,277 ---- Jim Hugunin Greg Humphreys + Eric Huss Jeremy Hylton Mihai Ibanescu From rhettinger at users.sourceforge.net Fri Jun 25 18:24:38 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Jun 25 18:24:42 2004 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.260,2.261 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11852 Modified Files: typeobject.c Log Message: Cosmetic spacing fix. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.260 retrieving revision 2.261 diff -C2 -d -r2.260 -r2.261 *** typeobject.c 25 Jun 2004 22:17:39 -0000 2.260 --- typeobject.c 25 Jun 2004 22:24:35 -0000 2.261 *************** *** 3955,3959 **** if (func == NULL) return -1; ! if(PyDict_SetItemString(type->tp_dict, "__new__", func)) { Py_DECREF(func); return -1; --- 3955,3959 ---- if (func == NULL) return -1; ! if (PyDict_SetItemString(type->tp_dict, "__new__", func)) { Py_DECREF(func); return -1; From fdrake at users.sourceforge.net Fri Jun 25 19:03:01 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Jun 25 19:03:04 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/tests test_install.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18122/Lib/distutils/tests Added Files: test_install.py Log Message: Make distutils "install --home" support all platforms. --- NEW FILE: test_install.py --- """Tests for distutils.command.install.""" import os import unittest from distutils.command.install import install from distutils.core import Distribution from distutils.tests import support class InstallTestCase(support.TempdirManager, unittest.TestCase): def test_home_installation_scheme(self): # This ensure two things: # - that --home generates the desired set of directory names # - test --home is supported on all platforms builddir = self.mkdtemp() destination = os.path.join(builddir, "installation") dist = Distribution({"name": "foopkg"}) # script_name need not exist, it just need to be initialized dist.script_name = os.path.join(builddir, "setup.py") dist.command_obj["build"] = support.DummyCommand( build_base=builddir, build_lib=os.path.join(builddir, "lib"), ) cmd = install(dist) cmd.home = destination cmd.ensure_finalized() self.assertEqual(cmd.install_base, destination) self.assertEqual(cmd.install_platbase, destination) def check_path(got, expected): got = os.path.normpath(got) expected = os.path.normpath(expected) self.assertEqual(got, expected) libdir = os.path.join(destination, "lib", "python") check_path(cmd.install_lib, libdir) check_path(cmd.install_platlib, libdir) check_path(cmd.install_purelib, libdir) check_path(cmd.install_headers, os.path.join(destination, "include", "python", "foopkg")) check_path(cmd.install_scripts, os.path.join(destination, "bin")) check_path(cmd.install_data, destination) def test_suite(): return unittest.makeSuite(InstallTestCase) if __name__ == "__main__": unittest.main(defaultTest="test_suite") From fdrake at users.sourceforge.net Fri Jun 25 19:03:15 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Jun 25 19:03:21 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1008,1.1009 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18122/Misc Modified Files: NEWS Log Message: Make distutils "install --home" support all platforms. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1008 retrieving revision 1.1009 diff -C2 -d -r1.1008 -r1.1009 *** NEWS 20 Jun 2004 22:41:32 -0000 1.1008 --- NEWS 25 Jun 2004 23:02:39 -0000 1.1009 *************** *** 366,369 **** --- 366,372 ---- module. + - The distutils install command now supports the --home option and + installation scheme for all platforms. + - The distutils sdist command now ignores all .svn directories, in addition to CVS and RCS directories. .svn directories hold From fdrake at users.sourceforge.net Fri Jun 25 19:03:16 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Jun 25 19:03:27 2004 Subject: [Python-checkins] python/dist/src/Lib/distutils/command install.py, 1.68, 1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18122/Lib/distutils/command Modified Files: install.py Log Message: Make distutils "install --home" support all platforms. Index: install.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/install.py,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** install.py 22 Mar 2004 22:22:05 -0000 1.68 --- install.py 25 Jun 2004 23:02:43 -0000 1.69 *************** *** 243,259 **** "install-base/install-platbase -- not both") # Next, stuff that's wrong (or dubious) only on certain platforms. ! if os.name == 'posix': ! if self.home and (self.prefix or self.exec_prefix): ! raise DistutilsOptionError, \ ! ("must supply either home or prefix/exec-prefix -- " + ! "not both") ! else: if self.exec_prefix: self.warn("exec-prefix option ignored on this platform") self.exec_prefix = None - if self.home: - self.warn("home option ignored on this platform") - self.home = None # Now the interesting logic -- so interesting that we farm it out --- 243,255 ---- "install-base/install-platbase -- not both") + if self.home and (self.prefix or self.exec_prefix): + raise DistutilsOptionError, \ + "must supply either home or prefix/exec-prefix -- not both" + # Next, stuff that's wrong (or dubious) only on certain platforms. ! if os.name != "posix": if self.exec_prefix: self.warn("exec-prefix option ignored on this platform") self.exec_prefix = None # Now the interesting logic -- so interesting that we farm it out *************** *** 406,418 **** def finalize_other (self): # Windows and Mac OS for now ! if self.prefix is None: ! self.prefix = os.path.normpath(sys.prefix) ! self.install_base = self.install_platbase = self.prefix ! try: ! self.select_scheme(os.name) ! except KeyError: ! raise DistutilsPlatformError, \ ! "I don't know how to install stuff on '%s'" % os.name # finalize_other () --- 402,418 ---- def finalize_other (self): # Windows and Mac OS for now ! if self.home is not None: ! self.install_base = self.install_platbase = self.home ! self.select_scheme("unix_home") ! else: ! if self.prefix is None: ! self.prefix = os.path.normpath(sys.prefix) ! self.install_base = self.install_platbase = self.prefix ! try: ! self.select_scheme(os.name) ! except KeyError: ! raise DistutilsPlatformError, \ ! "I don't know how to install stuff on '%s'" % os.name # finalize_other () From fdrake at users.sourceforge.net Fri Jun 25 19:03:16 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Jun 25 19:03:31 2004 Subject: [Python-checkins] python/dist/src/Doc/inst inst.tex,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/inst In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18122/Doc/inst Modified Files: inst.tex Log Message: Make distutils "install --home" support all platforms. Index: inst.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/inst/inst.tex,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** inst.tex 26 Jan 2004 15:07:31 -0000 1.53 --- inst.tex 25 Jun 2004 23:02:42 -0000 1.54 *************** *** 385,399 **** ! \subsection{Alternate installation: \UNIX{} (the home scheme)} \label{alt-install-prefix} - Under \UNIX, there are two ways to perform an alternate installation. - The ``prefix scheme'' is similar to how alternate installation works - under Windows and Mac OS, but is not necessarily the most useful way to - maintain a personal Python library. Hence, we document the more - convenient and commonly useful ``home scheme'' first. - The idea behind the ``home scheme'' is that you build and maintain a ! personal stash of Python modules, probably under your home directory. Installing a new module distribution is as simple as --- 385,398 ---- ! \subsection{Alternate installation: the home scheme} \label{alt-install-prefix} The idea behind the ``home scheme'' is that you build and maintain a ! personal stash of Python modules. This scheme's name is derived from ! the idea of a ``home'' directory on \UNIX, since it's not unusual for ! a \UNIX{} user to make their home directory have a layout similar to ! \file{/usr/} or \file{/usr/local/}. This scheme can be used by ! anyone, regardless of the operating system their installing for. ! Installing a new module distribution is as simple as *************** *** 402,408 **** \end{verbatim} ! where you can supply any directory you like for the \longprogramopt{home} ! option. Lazy typists can just type a tilde (\code{\textasciitilde}); the ! \command{install} command will expand this to your home directory: \begin{verbatim} --- 401,408 ---- \end{verbatim} ! where you can supply any directory you like for the ! \longprogramopt{home} option. On \UNIX, lazy typists can just type a ! tilde (\code{\textasciitilde}); the \command{install} command will ! expand this to your home directory: \begin{verbatim} *************** *** 418,421 **** --- 418,426 ---- {home}{/share} + + \versionchanged[The \longprogramopt{home} option used to be supported + only on \UNIX]{2.4} + + \subsection{Alternate installation: \UNIX{} (the prefix scheme)} \label{alt-install-home} *************** *** 492,503 **** ! \subsection{Alternate installation: Windows} \label{alt-install-windows} ! Since Windows has no conception of a user's home directory, and since ! the standard Python installation under Windows is simpler than that ! under \UNIX, there's no point in having separate \longprogramopt{prefix} ! and \longprogramopt{home} options. Just use the \longprogramopt{prefix} ! option to specify a base directory, e.g. \begin{verbatim} --- 497,507 ---- ! \subsection{Alternate installation: Windows (the prefix scheme)} \label{alt-install-windows} ! Windows has no concept of a user's home directory, and since the ! standard Python installation under Windows is simpler than under ! \UNIX, the \longprogramopt{prefix} option has traditionally been used ! to install additional packages in separate locations on Windows. \begin{verbatim} From mondragon at users.sourceforge.net Fri Jun 25 19:31:09 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Fri Jun 25 19:31:16 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.404,2.405 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23805/Python Modified Files: ceval.c Log Message: Massive performance improvement for C extension and builtin tracing code Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.404 retrieving revision 2.405 diff -C2 -d -r2.404 -r2.405 *** ceval.c 22 Jun 2004 15:37:51 -0000 2.404 --- ceval.c 25 Jun 2004 23:31:06 -0000 2.405 *************** *** 3439,3482 **** } ! #ifdef WITH_C_PROF ! #define BEGIN_C_TRACE \ ! if (tstate->use_tracing) { \ if (tstate->c_profilefunc != NULL) { \ ! PyObject *func_name = \ ! PyString_FromString (((PyCFunctionObject *) \ ! func)->m_ml->ml_name); \ ! are_tracing = 1; \ ! if (call_trace(tstate->c_profilefunc, \ ! tstate->c_profileobj, \ ! tstate->frame, PyTrace_C_CALL, \ ! func_name)) \ ! { return NULL; } \ ! Py_DECREF (func_name); \ ! } \ ! } ! ! #define END_C_TRACE \ ! if (tstate->use_tracing && are_tracing) { \ ! if (tstate->c_profilefunc != NULL) { \ ! if (x == NULL) { \ ! if (call_trace (tstate->c_profilefunc, \ ! tstate->c_profileobj, \ ! tstate->frame, PyTrace_C_EXCEPTION, \ ! NULL)) \ ! { return NULL; } \ ! } else { \ ! if (call_trace(tstate->c_profilefunc, \ ! tstate->c_profileobj, \ ! tstate->frame, PyTrace_C_RETURN, \ ! NULL)) \ ! { return NULL; } \ ! } \ } \ } - #else - #define BEGIN_C_TRACE - #define END_C_TRACE - #endif - static PyObject * --- 3439,3468 ---- } ! #define C_TRACE(call) \ ! if (tstate->use_tracing && tstate->c_profilefunc) { \ ! if (call_trace(tstate->c_profilefunc, \ ! tstate->c_profileobj, \ ! tstate->frame, PyTrace_C_CALL, \ ! func)) \ ! { return NULL; } \ ! call; \ if (tstate->c_profilefunc != NULL) { \ ! if (x == NULL) { \ ! if (call_trace (tstate->c_profilefunc, \ ! tstate->c_profileobj, \ ! tstate->frame, PyTrace_C_EXCEPTION, \ ! func)) \ ! { return NULL; } \ ! } else { \ ! if (call_trace(tstate->c_profilefunc, \ ! tstate->c_profileobj, \ ! tstate->frame, PyTrace_C_RETURN, \ ! func)) \ ! { return NULL; } \ } \ + } \ + } else { \ + call; \ } static PyObject * *************** *** 3494,3502 **** PyObject *x, *w; - #ifdef WITH_C_PROF - int are_tracing = 0; - PyThreadState *tstate = PyThreadState_GET(); - #endif - /* Always dispatch PyCFunction first, because these are presumed to be the most frequent callable object. --- 3480,3483 ---- *************** *** 3505,3521 **** int flags = PyCFunction_GET_FLAGS(func); PCALL(PCALL_CFUNCTION); if (flags & (METH_NOARGS | METH_O)) { PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); if (flags & METH_NOARGS && na == 0) { ! BEGIN_C_TRACE ! x = (*meth)(self, NULL); ! END_C_TRACE } else if (flags & METH_O && na == 1) { PyObject *arg = EXT_POP(*pp_stack); ! BEGIN_C_TRACE ! x = (*meth)(self, arg); ! END_C_TRACE Py_DECREF(arg); } --- 3486,3499 ---- int flags = PyCFunction_GET_FLAGS(func); PCALL(PCALL_CFUNCTION); + PyThreadState *tstate = PyThreadState_GET(); if (flags & (METH_NOARGS | METH_O)) { PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); if (flags & METH_NOARGS && na == 0) { ! C_TRACE(x=(*meth)(self,NULL)); } else if (flags & METH_O && na == 1) { PyObject *arg = EXT_POP(*pp_stack); ! C_TRACE(x=(*meth)(self,arg)); Py_DECREF(arg); } *************** *** 3528,3540 **** PyObject *callargs; callargs = load_args(pp_stack, na); - BEGIN_C_TRACE #ifdef WITH_TSC rdtscll(*pintr0); #endif ! x = PyCFunction_Call(func, callargs, NULL); #ifdef WITH_TSC rdtscll(*pintr1); #endif - END_C_TRACE Py_XDECREF(callargs); } --- 3506,3516 ---- PyObject *callargs; callargs = load_args(pp_stack, na); #ifdef WITH_TSC rdtscll(*pintr0); #endif ! C_TRACE(x=PyCFunction_Call(func,callargs,NULL)); #ifdef WITH_TSC rdtscll(*pintr1); #endif Py_XDECREF(callargs); } From mondragon at users.sourceforge.net Fri Jun 25 19:31:09 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Fri Jun 25 19:31:25 2004 Subject: [Python-checkins] python/dist/src/Lib/test/output test_profile, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23805/Lib/test/output Modified Files: test_profile Log Message: Massive performance improvement for C extension and builtin tracing code Index: test_profile =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_profile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_profile 24 Mar 2004 21:57:09 -0000 1.3 --- test_profile 25 Jun 2004 23:31:05 -0000 1.4 *************** *** 5,11 **** ncalls tottime percall cumtime percall filename:lineno(function) ! 12 0.000 0.000 0.012 0.001 :0(hasattr) ! 8 0.000 0.000 0.000 0.000 :0(range) ! 1 0.000 0.000 0.000 0.000 :0(setprofile) 1 0.000 0.000 1.000 1.000 :1(?) 0 0.000 0.000 profile:0(profiler) --- 5,11 ---- ncalls tottime percall cumtime percall filename:lineno(function) ! 12 0.000 0.000 0.012 0.001 :0() ! 8 0.000 0.000 0.000 0.000 :0() ! 1 0.000 0.000 0.000 0.000 :0() 1 0.000 0.000 1.000 1.000 :1(?) 0 0.000 0.000 profile:0(profiler) From mondragon at users.sourceforge.net Fri Jun 25 19:31:09 2004 From: mondragon at users.sourceforge.net (mondragon@users.sourceforge.net) Date: Fri Jun 25 19:31:32 2004 Subject: [Python-checkins] python/dist/src configure, 1.448, 1.449 configure.in, 1.459, 1.460 pyconfig.h.in, 1.98, 1.99 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23805 Modified Files: configure configure.in pyconfig.h.in Log Message: Massive performance improvement for C extension and builtin tracing code Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.448 retrieving revision 1.449 diff -C2 -d -r1.448 -r1.449 *** configure 22 Jun 2004 03:51:32 -0000 1.448 --- configure 25 Jun 2004 23:30:56 -0000 1.449 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.458 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.4. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.459 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for python 2.4. *************** *** 870,874 **** --with-pth use GNU pth threading libraries --with(out)-doc-strings disable/enable documentation strings - --with-c-profiling Enable profiling of builtins and C extension functions --with(out)-tsc enable/disable timestamp counter profile --with(out)-pymalloc disable/enable specialized mallocs --- 870,873 ---- *************** *** 13031,13059 **** echo "${ECHO_T}$with_doc_strings" >&6 - # Check for C call profiling support - echo "$as_me:$LINENO: checking for --with-c-profiling" >&5 - echo $ECHO_N "checking for --with-c-profiling... $ECHO_C" >&6 - - # Check whether --with-c-profiling or --without-c-profiling was given. - if test "${with_c_profiling+set}" = set; then - withval="$with_c_profiling" - - if test "$withval" != no - then - - cat >>confdefs.h <<\_ACEOF - #define WITH_C_PROF 1 - _ACEOF - - echo "$as_me:$LINENO: result: yes" >&5 - echo "${ECHO_T}yes" >&6 - else echo "$as_me:$LINENO: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi - else - echo "$as_me:$LINENO: result: no" >&5 - echo "${ECHO_T}no" >&6 - fi; - # Check for Python-specific malloc support echo "$as_me:$LINENO: checking for --with-tsc" >&5 --- 13030,13033 ---- Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.459 retrieving revision 1.460 diff -C2 -d -r1.459 -r1.460 *** configure.in 22 Jun 2004 03:51:37 -0000 1.459 --- configure.in 25 Jun 2004 23:31:05 -0000 1.460 *************** *** 1947,1963 **** AC_MSG_RESULT($with_doc_strings) - # Check for C call profiling support - AC_MSG_CHECKING(for --with-c-profiling) - AC_ARG_WITH(c-profiling, - [ --with-c-profiling Enable profiling of builtins and C extension functions], [ - if test "$withval" != no - then - AC_DEFINE(WITH_C_PROF, 1, - [Define to enable profile hooks for C extension functions and builtins]) - AC_MSG_RESULT(yes) - else AC_MSG_RESULT(no) - fi], - [AC_MSG_RESULT(no)]) - # Check for Python-specific malloc support AC_MSG_CHECKING(for --with-tsc) --- 1947,1950 ---- Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** pyconfig.h.in 22 Jun 2004 03:51:31 -0000 1.98 --- pyconfig.h.in 25 Jun 2004 23:31:05 -0000 1.99 *************** *** 760,766 **** #undef WINDOW_HAS_FLAGS - /* Define to enable profile hooks for C extension functions and builtins */ - #undef WITH_C_PROF - /* Define if you want documentation strings in extension modules */ #undef WITH_DOC_STRINGS --- 760,763 ---- From bcannon at users.sourceforge.net Sat Jun 26 00:03:08 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Jun 26 00:03:13 2004 Subject: [Python-checkins] python/dist/src/Modules getpath.c,1.48,1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31708/Modules Modified Files: getpath.c Log Message: Modules/getpath.c now compiles properly under OS X when using the --disable-framework build; header file was protected in an #if using the wrong macro to check. Closes bug #978645. Index: getpath.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/getpath.c,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** getpath.c 24 Jun 2004 00:48:44 -0000 1.48 --- getpath.c 26 Jun 2004 04:03:05 -0000 1.49 *************** *** 7,11 **** #include ! #ifdef WITH_NEXT_FRAMEWORK #include #endif --- 7,11 ---- #include ! #ifdef __APPLE__ #include #endif From bcannon at users.sourceforge.net Sat Jun 26 00:03:09 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Jun 26 00:03:18 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1009,1.1010 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31708/Misc Modified Files: NEWS Log Message: Modules/getpath.c now compiles properly under OS X when using the --disable-framework build; header file was protected in an #if using the wrong macro to check. Closes bug #978645. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1009 retrieving revision 1.1010 diff -C2 -d -r1.1009 -r1.1010 *** NEWS 25 Jun 2004 23:02:39 -0000 1.1009 --- NEWS 26 Jun 2004 04:03:06 -0000 1.1010 *************** *** 532,535 **** --- 532,538 ---- ----- + - Bug #978645: Modules/getpath.c now builds properly in --disable-framework + build under OS X. + - Profiling using gprof is now available if Python is configured with --enable-profiling. From bcannon at users.sourceforge.net Sat Jun 26 00:10:16 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Jun 26 00:10:21 2004 Subject: [Python-checkins] python/dist/src/Modules getpath.c, 1.46.14.1, 1.46.14.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv709/Modules Modified Files: Tag: release23-maint getpath.c Log Message: Allow Modules/getpath.c to compile on OS X in a --disable-framework build. Closes bug #978645. Index: getpath.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/getpath.c,v retrieving revision 1.46.14.1 retrieving revision 1.46.14.2 diff -C2 -d -r1.46.14.1 -r1.46.14.2 *** getpath.c 3 Jun 2004 14:38:38 -0000 1.46.14.1 --- getpath.c 26 Jun 2004 04:10:14 -0000 1.46.14.2 *************** *** 7,11 **** #include ! #ifdef WITH_NEXT_FRAMEWORK #include #endif --- 7,11 ---- #include ! #ifdef __APPLE__ #include #endif From bcannon at users.sourceforge.net Sat Jun 26 00:10:17 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Jun 26 00:10:25 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.123, 1.831.4.124 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv709/Misc Modified Files: Tag: release23-maint NEWS Log Message: Allow Modules/getpath.c to compile on OS X in a --disable-framework build. Closes bug #978645. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.123 retrieving revision 1.831.4.124 diff -C2 -d -r1.831.4.123 -r1.831.4.124 *** NEWS 20 Jun 2004 21:03:36 -0000 1.831.4.123 --- NEWS 26 Jun 2004 04:10:14 -0000 1.831.4.124 *************** *** 45,48 **** --- 45,54 ---- - Bug #934282: make pydoc.stripid() be case-insensitive. + Build + ----- + + - Bug #978645: Modules/getpath.c now builds properly under --disable-framework + build under OS X. + What's New in Python 2.3.4 (final)? =================================== From rhettinger at users.sourceforge.net Sat Jun 26 00:34:35 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 26 00:34:39 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.405,2.406 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3782 Modified Files: ceval.c Log Message: Get ceval.c to compile again by moving declarations before other statments. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.405 retrieving revision 2.406 diff -C2 -d -r2.405 -r2.406 *** ceval.c 25 Jun 2004 23:31:06 -0000 2.405 --- ceval.c 26 Jun 2004 04:34:33 -0000 2.406 *************** *** 3485,3490 **** if (PyCFunction_Check(func) && nk == 0) { int flags = PyCFunction_GET_FLAGS(func); - PCALL(PCALL_CFUNCTION); PyThreadState *tstate = PyThreadState_GET(); if (flags & (METH_NOARGS | METH_O)) { PyCFunction meth = PyCFunction_GET_FUNCTION(func); --- 3485,3491 ---- if (PyCFunction_Check(func) && nk == 0) { int flags = PyCFunction_GET_FLAGS(func); PyThreadState *tstate = PyThreadState_GET(); + + PCALL(PCALL_CFUNCTION); if (flags & (METH_NOARGS | METH_O)) { PyCFunction meth = PyCFunction_GET_FUNCTION(func); From rhettinger at users.sourceforge.net Sat Jun 26 00:42:09 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 26 00:42:14 2004 Subject: [Python-checkins] python/dist/src/Modules collectionsmodule.c, 1.17, 1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4683 Modified Files: collectionsmodule.c Log Message: Add a comment with implementation notes. Index: collectionsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/collectionsmodule.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** collectionsmodule.c 17 Jun 2004 18:27:16 -0000 1.17 --- collectionsmodule.c 26 Jun 2004 04:42:06 -0000 1.18 *************** *** 360,363 **** --- 360,370 ---- } + /* delitem() implemented in terms of rotate for simplicity and reasonable + performance near the end points. If for some reason this method becomes + popular, it is not hard to re-implement this using direct data movement + (similar to code in list slice assignment) and achieve a two or threefold + performance boost. + */ + static int deque_del_item(dequeobject *deque, int i) From mgzocrpr at topmail.de Sat Jun 26 04:07:44 2004 From: mgzocrpr at topmail.de (Fdree Cia|1s Sample) Date: Sat Jun 26 03:16:26 2004 Subject: [Python-checkins] Buy direct and save hundreds! sneakypansy Message-ID: An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-checkins/attachments/20040626/0ac895ed/attachment.html From montanaro at users.sourceforge.net Sat Jun 26 15:18:51 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat Jun 26 15:18:55 2004 Subject: [Python-checkins] python/dist/src/Lib smtpd.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16173 Modified Files: smtpd.py Log Message: Allow classes from other modules to be specified at startup. For example, using the postfixproxy module from Spambayes you might start smtpd up like smtpd.py -c spambayes.postfixproxy.SpambayesProxy :8025 :8026 Index: smtpd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/smtpd.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** smtpd.py 14 May 2002 02:13:30 -0000 1.13 --- smtpd.py 26 Jun 2004 19:18:49 -0000 1.14 *************** *** 534,539 **** 'Cannot setuid "nobody"; try running with -n option.' sys.exit(1) ! import __main__ ! class_ = getattr(__main__, options.classname) proxy = class_((options.localhost, options.localport), (options.remotehost, options.remoteport)) --- 534,546 ---- 'Cannot setuid "nobody"; try running with -n option.' sys.exit(1) ! classname = options.classname ! if "." in classname: ! lastdot = classname.rfind(".") ! mod = __import__(classname[:lastdot], globals(), locals(), [""]) ! classname = classname[lastdot+1:] ! else: ! import __main__ as mod ! print mod.__name__, dir(mod) ! class_ = getattr(mod, classname) proxy = class_((options.localhost, options.localport), (options.remotehost, options.remoteport)) From montanaro at users.sourceforge.net Sat Jun 26 15:42:13 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat Jun 26 15:42:17 2004 Subject: [Python-checkins] python/dist/src/Lib smtpd.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20194 Modified Files: smtpd.py Log Message: remove debugging print Index: smtpd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/smtpd.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** smtpd.py 26 Jun 2004 19:18:49 -0000 1.14 --- smtpd.py 26 Jun 2004 19:42:10 -0000 1.15 *************** *** 541,545 **** else: import __main__ as mod - print mod.__name__, dir(mod) class_ = getattr(mod, classname) proxy = class_((options.localhost, options.localport), --- 541,544 ---- From montanaro at users.sourceforge.net Sat Jun 26 18:29:44 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Sat Jun 26 18:29:48 2004 Subject: [Python-checkins] python/dist/src setup.py,1.189,1.190 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14800 Modified Files: setup.py Log Message: Install Barry's smtpd.py daemon. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.189 retrieving revision 1.190 diff -C2 -d -r1.189 -r1.190 *** setup.py 24 Jun 2004 01:38:47 -0000 1.189 --- setup.py 26 Jun 2004 22:29:42 -0000 1.190 *************** *** 1161,1165 **** # Scripts to install ! scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle'] ) --- 1161,1166 ---- # Scripts to install ! scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle', ! 'Lib/smtpd.py'] ) From bcannon at users.sourceforge.net Sat Jun 26 19:10:36 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat Jun 26 19:10:39 2004 Subject: [Python-checkins] python/dist/src/Doc/ext extending.tex,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21688 Modified Files: extending.tex Log Message: Clarify sentence at end of Intermezzo section stating that PyMODINIT_FUNC will be discussed later by saying it is the function return type of the sample code to make spotting it easier. Index: extending.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/extending.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** extending.tex 31 Mar 2004 07:45:46 -0000 1.27 --- extending.tex 26 Jun 2004 23:10:32 -0000 1.28 *************** *** 244,248 **** could cause a core dump or other unintended side effects. ! We discuss the use of PyMODINIT_FUNC later in this sample. \section{Back to the Example --- 244,249 ---- could cause a core dump or other unintended side effects. ! We discuss the use of PyMODINIT_FUNC as a function return type later in this ! sample. \section{Back to the Example From rhettinger at users.sourceforge.net Sat Jun 26 19:22:59 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 26 19:23:02 2004 Subject: [Python-checkins] python/dist/src/Objects intobject.c,2.110,2.111 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24131 Modified Files: intobject.c Log Message: SF bug #980419: int left-shift causes memory leak Index: intobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v retrieving revision 2.110 retrieving revision 2.111 diff -C2 -d -r2.110 -r2.111 *** intobject.c 5 Jun 2004 19:49:12 -0000 2.110 --- intobject.c 26 Jun 2004 23:22:57 -0000 2.111 *************** *** 752,755 **** --- 752,757 ---- { long a, b, c; + PyObject *vv, *ww, *result; + CONVERT_TO_LONG(v, a); CONVERT_TO_LONG(w, b); *************** *** 761,771 **** return int_pos(v); if (b >= LONG_BIT) { ! return PyNumber_Lshift(PyLong_FromLong(PyInt_AS_LONG(v)), ! PyLong_FromLong(PyInt_AS_LONG(w))); } c = a << b; if (a != Py_ARITHMETIC_RIGHT_SHIFT(long, c, b)) { ! return PyNumber_Lshift(PyLong_FromLong(PyInt_AS_LONG(v)), ! PyLong_FromLong(PyInt_AS_LONG(w))); } return PyInt_FromLong(c); --- 763,793 ---- return int_pos(v); if (b >= LONG_BIT) { ! vv = PyLong_FromLong(PyInt_AS_LONG(v)); ! if (vv == NULL) ! return NULL; ! ww = PyLong_FromLong(PyInt_AS_LONG(w)); ! if (ww == NULL) { ! Py_DECREF(vv); ! return NULL; ! } ! result = PyNumber_Lshift(vv, ww); ! Py_DECREF(vv); ! Py_DECREF(ww); ! return result; } c = a << b; if (a != Py_ARITHMETIC_RIGHT_SHIFT(long, c, b)) { ! vv = PyLong_FromLong(PyInt_AS_LONG(v)); ! if (vv == NULL) ! return NULL; ! ww = PyLong_FromLong(PyInt_AS_LONG(w)); ! if (ww == NULL) { ! Py_DECREF(vv); ! return NULL; ! } ! result = PyNumber_Lshift(vv, ww); ! Py_DECREF(vv); ! Py_DECREF(ww); ! return result; } return PyInt_FromLong(c); From rhettinger at users.sourceforge.net Sat Jun 26 23:02:21 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Jun 26 23:02:25 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_site.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23094 Modified Files: test_site.py Log Message: * Silence a test failure that resulted when test_site was run by regrtest.py after it ran test_frozen. This test was really only designed to be run immediately after startup. Afterwards, other modules could be loaded when had not been fixed-up by site.py Took the chicken way out and only tested those modules known to be imported by site.py. * Normalized whitespace. Index: test_site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_site.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_site.py 8 Jun 2004 18:25:48 -0000 1.2 --- test_site.py 27 Jun 2004 03:02:18 -0000 1.3 *************** *** 22,29 **** class HelperFunctionsTests(unittest.TestCase): """Tests for helper functions. ! The setting of the encoding (set using sys.setdefaultencoding) used by the Unicode implementation is not tested. ! """ --- 22,29 ---- class HelperFunctionsTests(unittest.TestCase): """Tests for helper functions. ! The setting of the encoding (set using sys.setdefaultencoding) used by the Unicode implementation is not tested. ! """ *************** *** 35,39 **** """Restore sys.path""" sys.path = self.sys_path ! def test_makepath(self): # Test makepath() have an absolute path for its first return value --- 35,39 ---- """Restore sys.path""" sys.path = self.sys_path ! def test_makepath(self): # Test makepath() have an absolute path for its first return value *************** *** 56,60 **** "%s from sys.path not found in set returned " "by _init_pathinfo(): %s" % (entry, dir_set)) ! def test_addpackage(self): # Make sure addpackage() imports if the line starts with 'import', --- 56,60 ---- "%s from sys.path not found in set returned " "by _init_pathinfo(): %s" % (entry, dir_set)) ! def test_addpackage(self): # Make sure addpackage() imports if the line starts with 'import', *************** *** 68,72 **** finally: cleanuppth(dir_path, file_name, new_dir) ! def test_addsitedir(self): dir_path, file_name, new_dir = createpth() --- 68,72 ---- finally: cleanuppth(dir_path, file_name, new_dir) ! def test_addsitedir(self): dir_path, file_name, new_dir = createpth() *************** *** 121,129 **** # Handled by abs__file__() site.abs__file__() ! for module in sys.modules.values(): try: ! self.failUnless(os.path.isabs(module.__file__)) except AttributeError: continue def test_no_duplicate_paths(self): --- 121,132 ---- # Handled by abs__file__() site.abs__file__() ! for module in (sys, os, __builtin__): try: ! self.failUnless(os.path.isabs(module.__file__), `module`) except AttributeError: continue + # We could try everything in sys.modules; however, when regrtest.py + # runs something like test_frozen before test_site, then we will + # be testing things loaded *after* test_site did path normalization def test_no_duplicate_paths(self): From bcannon at users.sourceforge.net Sun Jun 27 00:28:03 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Jun 27 00:28:07 2004 Subject: [Python-checkins] python/dist/src/Doc/ext extending.tex,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3213/Doc/ext Modified Files: extending.tex Log Message: Mention Py_RETURN_NONE when introducing the idiom of how to have a function return Py_None. Index: extending.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/extending.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** extending.tex 26 Jun 2004 23:10:32 -0000 1.28 --- extending.tex 27 Jun 2004 04:28:00 -0000 1.29 *************** *** 291,295 **** If you have a C function that returns no useful argument (a function returning \ctype{void}), the corresponding Python function must return ! \code{None}. You need this idiom to do so: \begin{verbatim} --- 291,296 ---- If you have a C function that returns no useful argument (a function returning \ctype{void}), the corresponding Python function must return ! \code{None}. You need this idiom to do so (which is implemented by the ! \csimplemacro{Py_RETURN_NONE} macro): \begin{verbatim} From loewis at users.sourceforge.net Sun Jun 27 11:43:15 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun Jun 27 11:43:21 2004 Subject: [Python-checkins] python/dist/src/Objects genobject.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14461/Objects Modified Files: genobject.c Log Message: Patch #966493: Cleanup generator/eval_frame exposure. Index: genobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/genobject.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** genobject.c 12 Jun 2004 05:17:55 -0000 1.2 --- genobject.c 27 Jun 2004 15:43:12 -0000 1.3 *************** *** 45,49 **** gen->gi_running = 1; ! result = PyEval_EvaluateFrame((PyObject *)f); gen->gi_running = 0; --- 45,49 ---- gen->gi_running = 1; ! result = PyEval_EvalFrame(f); gen->gi_running = 0; From loewis at users.sourceforge.net Sun Jun 27 11:43:15 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun Jun 27 11:43:26 2004 Subject: [Python-checkins] python/dist/src/Include Python.h, 2.63, 2.64 ceval.h, 2.51, 2.52 genobject.h, 2.1, 2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14461/Include Modified Files: Python.h ceval.h genobject.h Log Message: Patch #966493: Cleanup generator/eval_frame exposure. Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.63 retrieving revision 2.64 diff -C2 -d -r2.63 -r2.64 *** Python.h 8 Jun 2004 18:52:41 -0000 2.63 --- Python.h 27 Jun 2004 15:43:12 -0000 2.64 *************** *** 100,103 **** --- 100,104 ---- #include "cellobject.h" #include "iterobject.h" + #include "genobject.h" #include "descrobject.h" #include "weakrefobject.h" Index: ceval.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/ceval.h,v retrieving revision 2.51 retrieving revision 2.52 diff -C2 -d -r2.51 -r2.52 *** ceval.h 1 Jun 2004 15:22:40 -0000 2.51 --- ceval.h 27 Jun 2004 15:43:12 -0000 2.52 *************** *** 65,69 **** PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *); ! PyAPI_FUNC(PyObject *) PyEval_EvaluateFrame(PyObject *); /* this used to be handled on a per-thread basis - now just two globals */ --- 65,69 ---- PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *); ! PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *); /* this used to be handled on a per-thread basis - now just two globals */ Index: genobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/genobject.h,v retrieving revision 2.1 retrieving revision 2.2 diff -C2 -d -r2.1 -r2.2 *** genobject.h 1 Jun 2004 15:22:40 -0000 2.1 --- genobject.h 27 Jun 2004 15:43:12 -0000 2.2 *************** *** 8,16 **** #endif typedef struct { PyObject_HEAD /* The gi_ prefix is intended to remind of generator-iterator. */ ! PyFrameObject *gi_frame; /* True if generator is being executed. */ --- 8,18 ---- #endif + struct _frame; /* Avoid including frameobject.h */ + typedef struct { PyObject_HEAD /* The gi_ prefix is intended to remind of generator-iterator. */ ! struct _frame *gi_frame; /* True if generator is being executed. */ *************** *** 26,30 **** #define PyGen_CheckExact(op) ((op)->ob_type == &PyGen_Type) ! PyAPI_FUNC(PyObject *) PyGen_New(PyFrameObject *); #ifdef __cplusplus --- 28,32 ---- #define PyGen_CheckExact(op) ((op)->ob_type == &PyGen_Type) ! PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); #ifdef __cplusplus From loewis at users.sourceforge.net Sun Jun 27 11:43:15 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun Jun 27 11:43:31 2004 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.406,2.407 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14461/Python Modified Files: ceval.c Log Message: Patch #966493: Cleanup generator/eval_frame exposure. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.406 retrieving revision 2.407 diff -C2 -d -r2.406 -r2.407 *** ceval.c 26 Jun 2004 04:34:33 -0000 2.406 --- ceval.c 27 Jun 2004 15:43:12 -0000 2.407 *************** *** 11,15 **** #include "compile.h" #include "frameobject.h" - #include "genobject.h" #include "eval.h" #include "opcode.h" --- 11,14 ---- *************** *** 50,54 **** /* Forward declarations */ - static PyObject *eval_frame(PyFrameObject *); #ifdef WITH_TSC static PyObject *call_function(PyObject ***, int, uint64*, uint64*); --- 49,52 ---- *************** *** 459,464 **** /* Interpreter main loop */ ! static PyObject * ! eval_frame(PyFrameObject *f) { #ifdef DXPAIRS --- 457,462 ---- /* Interpreter main loop */ ! PyObject * ! PyEval_EvalFrame(PyFrameObject *f) { #ifdef DXPAIRS *************** *** 2456,2461 **** /* this is gonna seem *real weird*, but if you put some other code between ! eval_frame() and PyEval_EvalCodeEx() you will need to adjust the test in ! the if statement in Misc/gdbinit:ppystack */ PyObject * --- 2454,2459 ---- /* this is gonna seem *real weird*, but if you put some other code between ! PyEval_EvalFrame() and PyEval_EvalCodeEx() you will need to adjust ! the test in the if statement in Misc/gdbinit:ppystack */ PyObject * *************** *** 2685,2689 **** } ! retval = eval_frame(f); fail: /* Jump here from prelude on failure */ --- 2683,2687 ---- } ! retval = PyEval_EvalFrame(f); fail: /* Jump here from prelude on failure */ *************** *** 3416,3425 **** } - PyObject * - PyEval_EvaluateFrame(PyObject *fo) - { - return eval_frame((PyFrameObject *)fo); - } - #define EXT_POP(STACK_POINTER) (*--(STACK_POINTER)) --- 3414,3417 ---- *************** *** 3598,3602 **** fastlocals[i] = *stack++; } ! retval = eval_frame(f); assert(tstate != NULL); ++tstate->recursion_depth; --- 3590,3594 ---- fastlocals[i] = *stack++; } ! retval = PyEval_EvalFrame(f); assert(tstate != NULL); ++tstate->recursion_depth; From loewis at users.sourceforge.net Sun Jun 27 12:51:47 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun Jun 27 12:51:51 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libmarshal.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25751/Doc/lib Modified Files: libmarshal.tex Log Message: Patch #923098: Share interned strings in marshal. Index: libmarshal.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmarshal.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** libmarshal.tex 14 May 2003 16:51:46 -0000 1.23 --- libmarshal.tex 27 Jun 2004 16:51:45 -0000 1.24 *************** *** 74,77 **** --- 74,80 ---- will also be written to the file. The object will not be properly read back by \function{load()}. + + \versionadded[The \var{version} argument indicates the data + format that \code{dumps} should use.]{2.4} \end{funcdesc} *************** *** 87,95 **** \end{funcdesc} ! \begin{funcdesc}{dumps}{value} Return the string that would be written to a file by \code{dump(\var{value}, \var{file})}. The value must be a supported type. Raise a \exception{ValueError} exception if value has (or contains an object that has) an unsupported type. \end{funcdesc} --- 90,101 ---- \end{funcdesc} ! \begin{funcdesc}{dumps}{value\optional{, version}} Return the string that would be written to a file by \code{dump(\var{value}, \var{file})}. The value must be a supported type. Raise a \exception{ValueError} exception if value has (or contains an object that has) an unsupported type. + + \versionadded[The \var{version} argument indicates the data + format that \code{dumps} should use.]{2.4} \end{funcdesc} *************** *** 99,100 **** --- 105,116 ---- \exception{TypeError}. Extra characters in the string are ignored. \end{funcdesc} + + In addition, the following constants are defined: + + \begin{datadesc}{version} + Indicates the format that the module uses. Version 0 is the + historical format, version 1 (added in Python 2.4) shares + interned strings. The current version is 1. + + \versionadded{2.4} + \end{datadesc} \ No newline at end of file From loewis at users.sourceforge.net Sun Jun 27 12:51:48 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun Jun 27 12:51:56 2004 Subject: [Python-checkins] python/dist/src/Include marshal.h,2.13,2.14 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25751/Include Modified Files: marshal.h Log Message: Patch #923098: Share interned strings in marshal. Index: marshal.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/marshal.h,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** marshal.h 6 Mar 2003 22:04:22 -0000 2.13 --- marshal.h 27 Jun 2004 16:51:45 -0000 2.14 *************** *** 8,14 **** #endif ! PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *); ! PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *); ! PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *); PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); --- 8,16 ---- #endif ! #define Py_MARSHAL_VERSION 1 ! ! PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int); ! PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int); ! PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int); PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); From loewis at users.sourceforge.net Sun Jun 27 12:51:47 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun Jun 27 12:52:00 2004 Subject: [Python-checkins] python/dist/src/Doc/api utilities.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25751/Doc/api Modified Files: utilities.tex Log Message: Patch #923098: Share interned strings in marshal. Index: utilities.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/utilities.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** utilities.tex 3 Jun 2004 09:55:28 -0000 1.13 --- utilities.tex 27 Jun 2004 16:51:45 -0000 1.14 *************** *** 284,301 **** Numeric values are stored with the least significant byte first. ! \begin{cfuncdesc}{void}{PyMarshal_WriteLongToFile}{long value, FILE *file} Marshal a \ctype{long} integer, \var{value}, to \var{file}. This will only write the least-significant 32 bits of \var{value}; regardless of the size of the native \ctype{long} type. \end{cfuncdesc} \begin{cfuncdesc}{void}{PyMarshal_WriteObjectToFile}{PyObject *value, ! FILE *file} Marshal a Python object, \var{value}, to \var{file}. \end{cfuncdesc} ! \begin{cfuncdesc}{PyObject*}{PyMarshal_WriteObjectToString}{PyObject *value} Return a string object containing the marshalled representation of \var{value}. \end{cfuncdesc} --- 284,312 ---- Numeric values are stored with the least significant byte first. ! The module supports two versions of the data format: version 0 is the ! historical version, version 1 (new in Python 2.4) shares interned ! strings in the file, and upon unmarshalling. \var{Py_MARSHAL_VERSION} ! indicates the current file format (currently 1). ! ! \begin{cfuncdesc}{void}{PyMarshal_WriteLongToFile}{long value, FILE *file, int version} Marshal a \ctype{long} integer, \var{value}, to \var{file}. This will only write the least-significant 32 bits of \var{value}; regardless of the size of the native \ctype{long} type. + + \versionchanged[\var{version} indicates the file format]{2.4} \end{cfuncdesc} \begin{cfuncdesc}{void}{PyMarshal_WriteObjectToFile}{PyObject *value, ! FILE *file, int version} Marshal a Python object, \var{value}, to \var{file}. + + \versionchanged[\var{version} indicates the file format]{2.4} \end{cfuncdesc} ! \begin{cfuncdesc}{PyObject*}{PyMarshal_WriteObjectToString}{PyObject *value, int version} Return a string object containing the marshalled representation of \var{value}. + + \versionchanged[\var{version} indicates the file format]{2.4} \end{cfuncdesc} From loewis at users.sourceforge.net Sun Jun 27 12:51:48 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun Jun 27 12:52:04 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1010,1.1011 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25751/Misc Modified Files: NEWS Log Message: Patch #923098: Share interned strings in marshal. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1010 retrieving revision 1.1011 diff -C2 -d -r1.1010 -r1.1011 *** NEWS 26 Jun 2004 04:03:06 -0000 1.1010 --- NEWS 27 Jun 2004 16:51:46 -0000 1.1011 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - marshal now shares interned strings. This change introduces + a new .pyc magic. + - Bug #966623. classes created with type() in an exec(, {}) don't have a __module__, but code in typeobject assumed it would always From loewis at users.sourceforge.net Sun Jun 27 12:51:49 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun Jun 27 12:52:08 2004 Subject: [Python-checkins] python/dist/src/Python import.c, 2.232, 2.233 marshal.c, 1.78, 1.79 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25751/Python Modified Files: import.c marshal.c Log Message: Patch #923098: Share interned strings in marshal. Index: import.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/import.c,v retrieving revision 2.232 retrieving revision 2.233 diff -C2 -d -r2.232 -r2.233 *** import.c 7 Jun 2004 15:04:10 -0000 2.232 --- import.c 27 Jun 2004 16:51:46 -0000 2.233 *************** *** 27,33 **** Apple MPW compiler swaps their values, botching string constants. ! Apparently, there was a distinction made between even and odd ! bytecodes that is related to Unicode. The details aren't clear, ! but the magic number has been odd for a long time. There were a variety of old schemes for setting the magic number. --- 27,33 ---- Apple MPW compiler swaps their values, botching string constants. ! The magic numbers must be spaced apart atleast 2 values, as the ! -U interpeter flag will cause MAGIC+1 being used. They have been ! odd numbers for some time now. There were a variety of old schemes for setting the magic number. *************** *** 48,54 **** Python 2.3a0: 62021 Python 2.3a0: 62011 (!) ! Python 2.4a0: 62031 */ ! #define MAGIC (62031 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the --- 48,54 ---- Python 2.3a0: 62021 Python 2.3a0: 62011 (!) ! Python 2.4a0: 62041 */ ! #define MAGIC (62041 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the *************** *** 798,805 **** return; } ! PyMarshal_WriteLongToFile(pyc_magic, fp); /* First write a 0 for mtime */ ! PyMarshal_WriteLongToFile(0L, fp); ! PyMarshal_WriteObjectToFile((PyObject *)co, fp); if (fflush(fp) != 0 || ferror(fp)) { if (Py_VerboseFlag) --- 798,805 ---- return; } ! PyMarshal_WriteLongToFile(pyc_magic, fp, Py_MARSHAL_VERSION); /* First write a 0 for mtime */ ! PyMarshal_WriteLongToFile(0L, fp, Py_MARSHAL_VERSION); ! PyMarshal_WriteObjectToFile((PyObject *)co, fp, Py_MARSHAL_VERSION); if (fflush(fp) != 0 || ferror(fp)) { if (Py_VerboseFlag) *************** *** 812,816 **** /* Now write the true mtime */ fseek(fp, 4L, 0); ! PyMarshal_WriteLongToFile(mtime, fp); fflush(fp); fclose(fp); --- 812,816 ---- /* Now write the true mtime */ fseek(fp, 4L, 0); ! PyMarshal_WriteLongToFile(mtime, fp, Py_MARSHAL_VERSION); fflush(fp); fclose(fp); Index: marshal.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/marshal.c,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** marshal.c 13 Jun 2004 20:31:49 -0000 1.78 --- marshal.c 27 Jun 2004 16:51:46 -0000 1.79 *************** *** 28,31 **** --- 28,33 ---- #define TYPE_LONG 'l' #define TYPE_STRING 's' + #define TYPE_INTERNED 't' + #define TYPE_STRINGREF 'R' #define TYPE_TUPLE '(' #define TYPE_LIST '[' *************** *** 43,46 **** --- 45,49 ---- char *ptr; char *end; + PyObject *strings; /* dict on marshal, list on unmarshal */ } WFILE; *************** *** 190,194 **** #endif else if (PyString_Check(v)) { ! w_byte(TYPE_STRING, p); n = PyString_GET_SIZE(v); w_long((long)n, p); --- 193,214 ---- #endif else if (PyString_Check(v)) { ! if (p->strings && PyString_CHECK_INTERNED(v)) { ! PyObject *o = PyDict_GetItem(p->strings, v); ! if (o) { ! long w = PyInt_AsLong(o); ! w_byte(TYPE_STRINGREF, p); ! w_long(w, p); ! goto exit; ! } ! else { ! o = PyInt_FromLong(PyDict_Size(p->strings)); ! PyDict_SetItem(p->strings, v, o); ! Py_DECREF(o); ! w_byte(TYPE_INTERNED, p); ! } ! } ! else { ! w_byte(TYPE_STRING, p); ! } n = PyString_GET_SIZE(v); w_long((long)n, p); *************** *** 270,279 **** p->error = 1; } ! p->depth--; } void ! PyMarshal_WriteLongToFile(long x, FILE *fp) { WFILE wf; --- 290,300 ---- p->error = 1; } ! exit: p->depth--; } + /* version currently has no effect for writing longs. */ void ! PyMarshal_WriteLongToFile(long x, FILE *fp, int version) { WFILE wf; *************** *** 281,289 **** wf.error = 0; wf.depth = 0; w_long(x, &wf); } void ! PyMarshal_WriteObjectToFile(PyObject *x, FILE *fp) { WFILE wf; --- 302,311 ---- wf.error = 0; wf.depth = 0; + wf.strings = NULL; w_long(x, &wf); } void ! PyMarshal_WriteObjectToFile(PyObject *x, FILE *fp, int version) { WFILE wf; *************** *** 291,295 **** --- 313,319 ---- wf.error = 0; wf.depth = 0; + wf.strings = (version > 0) ? PyDict_New() : NULL; w_object(x, &wf); + Py_XDECREF(wf.strings); } *************** *** 492,495 **** --- 516,520 ---- #endif + case TYPE_INTERNED: case TYPE_STRING: n = r_long(p); *************** *** 507,510 **** --- 532,545 ---- } } + if (type == TYPE_INTERNED) { + PyString_InternInPlace(&v); + PyList_Append(p->strings, v); + } + return v; + + case TYPE_STRINGREF: + n = r_long(p); + v = PyList_GET_ITEM(p->strings, n); + Py_INCREF(v); return v; *************** *** 674,677 **** --- 709,713 ---- RFILE rf; rf.fp = fp; + rf.strings = NULL; return r_short(&rf); } *************** *** 682,685 **** --- 718,722 ---- RFILE rf; rf.fp = fp; + rf.strings = NULL; return r_long(&rf); } *************** *** 748,753 **** { RFILE rf; rf.fp = fp; ! return read_object(&rf); } --- 785,794 ---- { RFILE rf; + PyObject *result; rf.fp = fp; ! rf.strings = PyList_New(0); ! result = r_object(&rf); ! Py_DECREF(rf.strings); ! return result; } *************** *** 756,767 **** { RFILE rf; rf.fp = NULL; rf.ptr = str; rf.end = str + len; ! return read_object(&rf); } PyObject * ! PyMarshal_WriteObjectToString(PyObject *x) /* wrs_object() */ { WFILE wf; --- 797,812 ---- { RFILE rf; + PyObject *result; rf.fp = NULL; rf.ptr = str; rf.end = str + len; ! rf.strings = PyList_New(0); ! result = r_object(&rf); ! Py_DECREF(rf.strings); ! return result; } PyObject * ! PyMarshal_WriteObjectToString(PyObject *x, int version) { WFILE wf; *************** *** 774,778 **** --- 819,825 ---- wf.error = 0; wf.depth = 0; + wf.strings = (version > 0) ? PyDict_New() : NULL; w_object(x, &wf); + Py_XDECREF(wf.strings); if (wf.str != NULL) _PyString_Resize(&wf.str, *************** *** 797,801 **** PyObject *x; PyObject *f; ! if (!PyArg_ParseTuple(args, "OO:dump", &x, &f)) return NULL; if (!PyFile_Check(f)) { --- 844,849 ---- PyObject *x; PyObject *f; ! int version = Py_MARSHAL_VERSION; ! if (!PyArg_ParseTuple(args, "OO|i:dump", &x, &f, &version)) return NULL; if (!PyFile_Check(f)) { *************** *** 809,813 **** --- 857,863 ---- wf.error = 0; wf.depth = 0; + wf.strings = (version > 0) ? PyDict_New() : 0; w_object(x, &wf); + Py_XDECREF(wf.strings); if (wf.error) { PyErr_SetString(PyExc_ValueError, *************** *** 824,828 **** { RFILE rf; ! PyObject *f; if (!PyArg_ParseTuple(args, "O:load", &f)) return NULL; --- 874,878 ---- { RFILE rf; ! PyObject *f, *result; if (!PyArg_ParseTuple(args, "O:load", &f)) return NULL; *************** *** 833,837 **** } rf.fp = PyFile_AsFile(f); ! return read_object(&rf); } --- 883,890 ---- } rf.fp = PyFile_AsFile(f); ! rf.strings = PyList_New(0); ! result = read_object(&rf); ! Py_DECREF(rf.strings); ! return result; } *************** *** 840,846 **** { PyObject *x; ! if (!PyArg_ParseTuple(args, "O:dumps", &x)) return NULL; ! return PyMarshal_WriteObjectToString(x); } --- 893,900 ---- { PyObject *x; ! int version = Py_MARSHAL_VERSION; ! if (!PyArg_ParseTuple(args, "O|i:dumps", &x, version)) return NULL; ! return PyMarshal_WriteObjectToString(x, version); } *************** *** 851,860 **** char *s; int n; ! if (!PyArg_ParseTuple(args, "s#:loads", &s, &n)) return NULL; rf.fp = NULL; rf.ptr = s; rf.end = s + n; ! return read_object(&rf); } --- 905,918 ---- char *s; int n; ! PyObject* result; ! if (!PyArg_ParseTuple(args, "s#|i:loads", &s, &n)) return NULL; rf.fp = NULL; rf.ptr = s; rf.end = s + n; ! rf.strings = PyList_New(0); ! result = read_object(&rf); ! Py_DECREF(rf.strings); ! return result; } *************** *** 870,873 **** PyMarshal_Init(void) { ! (void) Py_InitModule("marshal", marshal_methods); } --- 928,932 ---- PyMarshal_Init(void) { ! PyObject *mod = Py_InitModule("marshal", marshal_methods); ! PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION); } From cristoenmi at adsl.tie.cl Sun Jun 27 13:00:43 2004 From: cristoenmi at adsl.tie.cl (Fernando A.) Date: Sun Jun 27 13:00:41 2004 Subject: [Python-checkins] =?iso-8859-1?q?Bendiciones_y_un_gran_d=EDa_par?= =?iso-8859-1?q?a_ti_junto_a_Dios?= Message-ID: <40C9A70A002687B7@mta01.tie.cl> (added by postmaster@tie.cl) Si aceptas a Dios y a su hijo Jesús el Cristo, entonces visita esta página www.enelnombredecristo.com Lee su mensaje y que Dios te bendiga. Un abrazo Fernando Areces Pd: esto no es religión, es solo un mensaje real. Gracias From tim_one at users.sourceforge.net Sun Jun 27 13:24:51 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun Jun 27 13:24:56 2004 Subject: [Python-checkins] python/dist/src/Modules cStringIO.c,2.47,2.48 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31535/Modules Modified Files: cStringIO.c Log Message: sizeof(char) is 1, by definition, so get rid of that expression in places it's just noise. Index: cStringIO.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -d -r2.47 -r2.48 *** cStringIO.c 8 Mar 2004 18:17:31 -0000 2.47 --- cStringIO.c 27 Jun 2004 17:24:49 -0000 2.48 *************** *** 337,342 **** self->buf_size*=2; if (self->buf_size <= position) self->buf_size=position+1; ! UNLESS (self->buf=(char*) ! realloc(self->buf,self->buf_size*sizeof(char))) { self->buf_size=self->pos=0; return PyErr_NoMemory(); --- 337,342 ---- self->buf_size*=2; if (self->buf_size <= position) self->buf_size=position+1; ! UNLESS (self->buf = (char*) ! realloc(self->buf,self->buf_size)) { self->buf_size=self->pos=0; return PyErr_NoMemory(); *************** *** 372,377 **** oself->buf_size = newl+1; UNLESS (oself->buf = ! (char*)realloc(oself->buf, ! (oself->buf_size) * sizeof(char))) { PyErr_SetString(PyExc_MemoryError,"out of memory"); oself->buf_size = oself->pos = 0; --- 372,376 ---- oself->buf_size = newl+1; UNLESS (oself->buf = ! (char*)realloc(oself->buf, oself->buf_size)) { PyErr_SetString(PyExc_MemoryError,"out of memory"); oself->buf_size = oself->pos = 0; *************** *** 530,534 **** self->softspace = 0; ! UNLESS (self->buf=malloc(size*sizeof(char))) { PyErr_SetString(PyExc_MemoryError,"out of memory"); self->buf_size = 0; --- 529,533 ---- self->softspace = 0; ! UNLESS (self->buf = (char *)malloc(size)) { PyErr_SetString(PyExc_MemoryError,"out of memory"); self->buf_size = 0; From tim_one at users.sourceforge.net Sun Jun 27 13:24:52 2004 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun Jun 27 13:25:02 2004 Subject: [Python-checkins] python/dist/src/Objects stringobject.c, 2.218, 2.219 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31535/Objects Modified Files: stringobject.c Log Message: sizeof(char) is 1, by definition, so get rid of that expression in places it's just noise. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.218 retrieving revision 2.219 diff -C2 -d -r2.218 -r2.219 *** stringobject.c 8 Jun 2004 18:52:54 -0000 2.218 --- stringobject.c 27 Jun 2004 17:24:49 -0000 2.219 *************** *** 71,76 **** /* Inline PyObject_NewVar */ ! op = (PyStringObject *) ! PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); --- 71,75 ---- /* Inline PyObject_NewVar */ ! op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); if (op == NULL) return PyErr_NoMemory(); *************** *** 127,132 **** /* Inline PyObject_NewVar */ ! op = (PyStringObject *) ! PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); --- 126,130 ---- /* Inline PyObject_NewVar */ ! op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); if (op == NULL) return PyErr_NoMemory(); *************** *** 800,804 **** { register PyStringObject* op = (PyStringObject*) obj; ! size_t newsize = 2 + 4 * op->ob_size * sizeof(char); PyObject *v; if (newsize > INT_MAX) { --- 798,802 ---- { register PyStringObject* op = (PyStringObject*) obj; ! size_t newsize = 2 + 4 * op->ob_size; PyObject *v; if (newsize > INT_MAX) { *************** *** 912,917 **** size = a->ob_size + b->ob_size; /* Inline PyObject_NewVar */ ! op = (PyStringObject *) ! PyObject_MALLOC(sizeof(PyStringObject) + size * sizeof(char)); if (op == NULL) return PyErr_NoMemory(); --- 910,914 ---- size = a->ob_size + b->ob_size; /* Inline PyObject_NewVar */ ! op = (PyStringObject *)PyObject_MALLOC(sizeof(PyStringObject) + size); if (op == NULL) return PyErr_NoMemory(); *************** *** 949,955 **** return (PyObject *)a; } ! nbytes = size * sizeof(char); ! if (nbytes / sizeof(char) != (size_t)size || ! nbytes + sizeof(PyStringObject) <= nbytes) { PyErr_SetString(PyExc_OverflowError, "repeated string is too long"); --- 946,951 ---- return (PyObject *)a; } ! nbytes = (size_t)size; ! if (nbytes + sizeof(PyStringObject) <= nbytes) { PyErr_SetString(PyExc_OverflowError, "repeated string is too long"); *************** *** 3496,3501 **** _Py_ForgetReference(v); *pv = (PyObject *) ! PyObject_REALLOC((char *)v, ! sizeof(PyStringObject) + newsize * sizeof(char)); if (*pv == NULL) { PyObject_Del(v); --- 3492,3496 ---- _Py_ForgetReference(v); *pv = (PyObject *) ! PyObject_REALLOC((char *)v, sizeof(PyStringObject) + newsize); if (*pv == NULL) { PyObject_Del(v); From greg at users.sourceforge.net Sun Jun 27 19:32:36 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Sun Jun 27 19:32:43 2004 Subject: [Python-checkins] python/dist/src/Lib/bsddb/test test_recno.py, 1.7, 1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32305/Lib/bsddb/test Modified Files: test_recno.py Log Message: SF patch / bug #967763 Fix memory leaks revealed by valgrind and ensuing code inspection. In the existing test suite valgrind revealed two memory leaks (DB_get and DBC_set_range). Code inspection revealed that there were many other potential similar leaks (many on odd code error paths such as passing something other than a DBTxn object for a txn= parameter or in the face of an out of memory error). The most common case that would cause a leak was when using recno or queue format databases with integer keys, sometimes only with an exception exit. Index: test_recno.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_recno.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_recno.py 21 Sep 2003 00:08:14 -0000 1.7 --- test_recno.py 27 Jun 2004 23:32:34 -0000 1.8 *************** *** 134,137 **** --- 134,144 ---- print rec + # test that non-existant key lookups work (and that + # DBC_set_range doesn't have a memleak under valgrind) + rec = c.set_range(999999) + assert rec == None + if verbose: + print rec + c.close() d.close() *************** *** 178,181 **** --- 185,190 ---- source = os.path.join(os.path.dirname(sys.argv[0]), 'db_home/test_recno.txt') + if not os.path.isdir('db_home'): + os.mkdir('db_home') f = open(source, 'w') # create the file f.close() From greg at users.sourceforge.net Sun Jun 27 19:32:36 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Sun Jun 27 19:32:58 2004 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32305/Modules Modified Files: _bsddb.c Log Message: SF patch / bug #967763 Fix memory leaks revealed by valgrind and ensuing code inspection. In the existing test suite valgrind revealed two memory leaks (DB_get and DBC_set_range). Code inspection revealed that there were many other potential similar leaks (many on odd code error paths such as passing something other than a DBTxn object for a txn= parameter or in the face of an out of memory error). The most common case that would cause a leak was when using recno or queue format databases with integer keys, sometimes only with an exception exit. Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** _bsddb.c 25 Mar 2004 02:16:22 -0000 1.31 --- _bsddb.c 27 Jun 2004 23:32:33 -0000 1.32 *************** *** 298,302 **** #define FREE_DBT(dbt) if ((dbt.flags & (DB_DBT_MALLOC|DB_DBT_REALLOC)) && \ ! dbt.data != NULL) { free(dbt.data); } --- 298,302 ---- #define FREE_DBT(dbt) if ((dbt.flags & (DB_DBT_MALLOC|DB_DBT_REALLOC)) && \ ! dbt.data != NULL) { free(dbt.data); dbt.data = NULL; } *************** *** 331,335 **** else if (!PyArg_Parse(obj, "s#", &dbt->data, &dbt->size)) { PyErr_SetString(PyExc_TypeError, ! "Key and Data values must be of type string or None."); return 0; } --- 331,335 ---- else if (!PyArg_Parse(obj, "s#", &dbt->data, &dbt->size)) { PyErr_SetString(PyExc_TypeError, ! "Data values must be of type string or None."); return 0; } *************** *** 341,345 **** what's been given, verifies that it's allowed, and then makes the DBT. ! Caller should call FREE_DBT(key) when done. */ static int make_key_dbt(DBObject* self, PyObject* keyobj, DBT* key, int* pflags) --- 341,345 ---- what's been given, verifies that it's allowed, and then makes the DBT. ! Caller MUST call FREE_DBT(key) when done. */ static int make_key_dbt(DBObject* self, PyObject* keyobj, DBT* key, int* pflags) *************** *** 1299,1307 **** if (!make_key_dbt(self, keyobj, &key, NULL)) return NULL; ! if (!checkTxnObj(txnobj, &txn)) return NULL; ! if (-1 == _DB_delete(self, txn, &key, 0)) return NULL; FREE_DBT(key); --- 1299,1311 ---- if (!make_key_dbt(self, keyobj, &key, NULL)) return NULL; ! if (!checkTxnObj(txnobj, &txn)) { ! FREE_DBT(key); return NULL; + } ! if (-1 == _DB_delete(self, txn, &key, 0)) { ! FREE_DBT(key); return NULL; + } FREE_DBT(key); *************** *** 1349,1354 **** if (!make_key_dbt(self, keyobj, &key, &flags)) return NULL; ! if (!checkTxnObj(txnobj, &txn)) return NULL; CLEAR_DBT(data); --- 1353,1360 ---- if (!make_key_dbt(self, keyobj, &key, &flags)) return NULL; ! if (!checkTxnObj(txnobj, &txn)) { ! FREE_DBT(key); return NULL; + } CLEAR_DBT(data); *************** *** 1357,1362 **** data.flags = DB_DBT_MALLOC; } ! if (!add_partial_dbt(&data, dlen, doff)) return NULL; MYDB_BEGIN_ALLOW_THREADS; --- 1363,1370 ---- data.flags = DB_DBT_MALLOC; } ! if (!add_partial_dbt(&data, dlen, doff)) { ! FREE_DBT(key); return NULL; + } MYDB_BEGIN_ALLOW_THREADS; *************** *** 1380,1386 **** else /* return just the data */ retval = PyString_FromStringAndSize((char*)data.data, data.size); - FREE_DBT(key); FREE_DBT(data); } RETURN_IF_ERR(); --- 1388,1394 ---- else /* return just the data */ retval = PyString_FromStringAndSize((char*)data.data, data.size); FREE_DBT(data); } + FREE_DBT(key); RETURN_IF_ERR(); *************** *** 1407,1412 **** if (!make_key_dbt(self, keyobj, &key, &flags)) return NULL; ! if (!checkTxnObj(txnobj, &txn)) return NULL; CLEAR_DBT(data); --- 1415,1422 ---- if (!make_key_dbt(self, keyobj, &key, &flags)) return NULL; ! if (!checkTxnObj(txnobj, &txn)) { ! FREE_DBT(key); return NULL; + } CLEAR_DBT(data); *************** *** 1450,1457 **** if (!make_key_dbt(self, keyobj, &key, NULL)) return NULL; ! if (!make_dbt(dataobj, &data)) ! return NULL; ! if (!checkTxnObj(txnobj, &txn)) return NULL; flags |= DB_GET_BOTH; --- 1460,1469 ---- if (!make_key_dbt(self, keyobj, &key, NULL)) return NULL; ! if ( !make_dbt(dataobj, &data) || ! !checkTxnObj(txnobj, &txn) ) ! { ! FREE_DBT(key); return NULL; + } flags |= DB_GET_BOTH; *************** *** 1720,1727 **** CHECK_DB_NOT_CLOSED(self); ! if (!make_key_dbt(self, keyobj, &key, NULL)) return NULL; ! if (!make_dbt(dataobj, &data)) return NULL; ! if (!add_partial_dbt(&data, dlen, doff)) return NULL; ! if (!checkTxnObj(txnobj, &txn)) return NULL; if (-1 == _DB_put(self, txn, &key, &data, flags)) { --- 1732,1744 ---- CHECK_DB_NOT_CLOSED(self); ! if (!make_key_dbt(self, keyobj, &key, NULL)) ! return NULL; ! if ( !make_dbt(dataobj, &data) || ! !add_partial_dbt(&data, dlen, doff) || ! !checkTxnObj(txnobj, &txn) ) ! { ! FREE_DBT(key); ! return NULL; ! } if (-1 == _DB_put(self, txn, &key, &data, flags)) { *************** *** 2391,2396 **** if (!make_key_dbt(self, keyobj, &key, NULL)) return NULL; ! if (!checkTxnObj(txnobj, &txn)) return NULL; /* This causes ENOMEM to be returned when the db has the key because --- 2408,2415 ---- if (!make_key_dbt(self, keyobj, &key, NULL)) return NULL; ! if (!checkTxnObj(txnobj, &txn)) { ! FREE_DBT(key); return NULL; + } /* This causes ENOMEM to be returned when the db has the key because *************** *** 2693,2704 **** if (keyobj && !make_key_dbt(self->mydb, keyobj, &key, NULL)) return NULL; ! if (dataobj && !make_dbt(dataobj, &data)) ! return NULL; ! if (!add_partial_dbt(&data, dlen, doff)) return NULL; if (CHECK_DBFLAG(self->mydb, DB_THREAD)) { data.flags = DB_DBT_MALLOC; ! key.flags = DB_DBT_MALLOC; } --- 2712,2727 ---- if (keyobj && !make_key_dbt(self->mydb, keyobj, &key, NULL)) return NULL; ! if ( (dataobj && !make_dbt(dataobj, &data)) || ! (!add_partial_dbt(&data, dlen, doff)) ) ! { ! FREE_DBT(key); return NULL; + } if (CHECK_DBFLAG(self->mydb, DB_THREAD)) { data.flags = DB_DBT_MALLOC; ! if (!(key.flags & DB_DBT_REALLOC)) { ! key.flags |= DB_DBT_MALLOC; ! } } *************** *** 2707,2711 **** MYDB_END_ALLOW_THREADS; - if ((err == DB_NOTFOUND) && self->mydb->moduleFlags.getReturnsNone) { Py_INCREF(Py_None); --- 2730,2733 ---- *************** *** 2732,2738 **** break; } - FREE_DBT(key); FREE_DBT(data); } return retval; } --- 2754,2760 ---- break; } FREE_DBT(data); } + FREE_DBT(key); return retval; } *************** *** 2811,2817 **** if (!make_key_dbt(self->mydb, keyobj, &key, NULL)) return NULL; ! if (!make_dbt(dataobj, &data)) return NULL; ! if (!add_partial_dbt(&data, dlen, doff)) return NULL; MYDB_BEGIN_ALLOW_THREADS; --- 2833,2842 ---- if (!make_key_dbt(self->mydb, keyobj, &key, NULL)) return NULL; ! if (!make_dbt(dataobj, &data) || ! !add_partial_dbt(&data, dlen, doff) ) ! { ! FREE_DBT(key); return NULL; ! } MYDB_BEGIN_ALLOW_THREADS; *************** *** 2849,2854 **** data.flags = DB_DBT_MALLOC; } ! if (!add_partial_dbt(&data, dlen, doff)) return NULL; MYDB_BEGIN_ALLOW_THREADS; --- 2874,2881 ---- data.flags = DB_DBT_MALLOC; } ! if (!add_partial_dbt(&data, dlen, doff)) { ! FREE_DBT(key); return NULL; + } MYDB_BEGIN_ALLOW_THREADS; *************** *** 2879,2885 **** break; } - FREE_DBT(key); FREE_DBT(data); } return retval; --- 2906,2912 ---- break; } FREE_DBT(data); } + FREE_DBT(key); return retval; *************** *** 2907,2917 **** CLEAR_DBT(data); if (CHECK_DBFLAG(self->mydb, DB_THREAD)) { /* Tell BerkeleyDB to malloc the return value (thread safe) */ ! data.flags = DB_DBT_MALLOC; ! key.flags = DB_DBT_MALLOC; } - if (!add_partial_dbt(&data, dlen, doff)) - return NULL; MYDB_BEGIN_ALLOW_THREADS; err = self->dbc->c_get(self->dbc, &key, &data, flags|DB_SET_RANGE); --- 2934,2949 ---- CLEAR_DBT(data); + if (!add_partial_dbt(&data, dlen, doff)) { + FREE_DBT(key); + return NULL; + } if (CHECK_DBFLAG(self->mydb, DB_THREAD)) { /* Tell BerkeleyDB to malloc the return value (thread safe) */ ! data.flags |= DB_DBT_MALLOC; ! /* only BTREE databases will return anything in the key */ ! if (!(key.flags & DB_DBT_REALLOC) && _DB_get_type(self->mydb) == DB_BTREE) { ! key.flags |= DB_DBT_MALLOC; ! } } MYDB_BEGIN_ALLOW_THREADS; err = self->dbc->c_get(self->dbc, &key, &data, flags|DB_SET_RANGE); *************** *** 2941,2955 **** break; } ! if (_DB_get_type(self->mydb) == DB_BTREE) { ! /* the only time a malloced key is returned is when we ! * call this on a BTree database because it performs ! * partial matching and needs to return the real key. ! * All others leave key untouched [where calling free() ! * on it would often segfault]. ! */ ! FREE_DBT(key); ! } FREE_DBT(data); } return retval; --- 2973,2984 ---- break; } ! FREE_DBT(key); FREE_DBT(data); } + /* the only time REALLOC should be set is if we used an integer + * key that make_dbt_key malloc'd for us. always free these. */ + if (key.flags & DB_DBT_REALLOC) { + FREE_DBT(key); + } return retval; *************** *** 2967,2972 **** if (!make_key_dbt(self->mydb, keyobj, &key, NULL)) return NULL; ! if (!make_dbt(dataobj, &data)) return NULL; MYDB_BEGIN_ALLOW_THREADS; --- 2996,3003 ---- if (!make_key_dbt(self->mydb, keyobj, &key, NULL)) return NULL; ! if (!make_dbt(dataobj, &data)) { ! FREE_DBT(key); return NULL; + } MYDB_BEGIN_ALLOW_THREADS; *************** *** 3105,3110 **** data.flags = DB_DBT_MALLOC; } ! if (!add_partial_dbt(&data, dlen, doff)) return NULL; MYDB_BEGIN_ALLOW_THREADS; --- 3136,3143 ---- data.flags = DB_DBT_MALLOC; } ! if (!add_partial_dbt(&data, dlen, doff)) { ! FREE_DBT(key); return NULL; + } MYDB_BEGIN_ALLOW_THREADS; *************** *** 3121,3127 **** retval = Py_BuildValue("s#s#", key.data, key.size, data.data, data.size); - FREE_DBT(key); FREE_DBT(data); } return retval; --- 3154,3160 ---- retval = Py_BuildValue("s#s#", key.data, key.size, data.data, data.size); FREE_DBT(data); } + FREE_DBT(key); return retval; From greg at users.sourceforge.net Sun Jun 27 19:36:39 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Sun Jun 27 19:36:44 2004 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1285/Modules Modified Files: _bsddb.c Log Message: raise the module minor version. Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** _bsddb.c 27 Jun 2004 23:32:33 -0000 1.32 --- _bsddb.c 27 Jun 2004 23:36:37 -0000 1.33 *************** *** 98,102 **** #endif ! #define PY_BSDDB_VERSION "4.2.6" static char *rcs_id = "$Id$"; --- 98,102 ---- #endif ! #define PY_BSDDB_VERSION "4.2.7" static char *rcs_id = "$Id$"; From greg at users.sourceforge.net Sun Jun 27 18:56:45 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Sun Jun 27 19:59:47 2004 Subject: [Python-checkins] python/dist/src/Lib/bsddb __init__.py,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26632/Lib/bsddb Modified Files: __init__.py Log Message: Fix SF bug # 897820 - we can no longer use the DB_TRUNCATE flag when opening the DB to implement legacy interface flag='n' support as BerkeleyDB 4.2.52 no longer allows it in transaction protected environments. Do the os.unlink ourselves. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/__init__.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** __init__.py 26 Feb 2004 10:07:12 -0000 1.14 --- __init__.py 27 Jun 2004 22:56:42 -0000 1.15 *************** *** 60,64 **** #---------------------------------------------------------------------- ! import sys # for backwards compatibility with python versions older than 2.3, the --- 60,64 ---- #---------------------------------------------------------------------- ! import sys, os # for backwards compatibility with python versions older than 2.3, the *************** *** 282,286 **** cachesize=None, lorder=None, hflags=0): ! flags = _checkflag(flag) e = _openDBEnv() d = db.DB(e) --- 282,286 ---- cachesize=None, lorder=None, hflags=0): ! flags = _checkflag(flag, file) e = _openDBEnv() d = db.DB(e) *************** *** 300,304 **** pgsize=None, lorder=None): ! flags = _checkflag(flag) e = _openDBEnv() d = db.DB(e) --- 300,304 ---- pgsize=None, lorder=None): ! flags = _checkflag(flag, file) e = _openDBEnv() d = db.DB(e) *************** *** 319,323 **** rlen=None, delim=None, source=None, pad=None): ! flags = _checkflag(flag) e = _openDBEnv() d = db.DB(e) --- 319,323 ---- rlen=None, delim=None, source=None, pad=None): ! flags = _checkflag(flag, file) e = _openDBEnv() d = db.DB(e) *************** *** 340,344 **** return e ! def _checkflag(flag): if flag == 'r': flags = db.DB_RDONLY --- 340,344 ---- return e ! def _checkflag(flag, file): if flag == 'r': flags = db.DB_RDONLY *************** *** 350,354 **** flags = db.DB_CREATE elif flag == 'n': ! flags = db.DB_CREATE | db.DB_TRUNCATE else: raise error, "flags should be one of 'r', 'w', 'c' or 'n'" --- 350,359 ---- flags = db.DB_CREATE elif flag == 'n': ! flags = db.DB_CREATE ! #flags = db.DB_CREATE | db.DB_TRUNCATE ! # we used db.DB_TRUNCATE flag for this before but BerkeleyDB ! # 4.2.52 changed to disallowed truncate with txn environments. ! if os.path.isfile(file): ! os.unlink(file) else: raise error, "flags should be one of 'r', 'w', 'c' or 'n'" From bcannon at users.sourceforge.net Sun Jun 27 19:17:38 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Jun 27 20:04:51 2004 Subject: [Python-checkins] python/dist/src/Demo/classes Range.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/classes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29971 Modified Files: Range.py Log Message: Add code for a range function that uses generators. Cleaned up existing code by abstracting code to parse arguments. Also removed any unneeded operations (such as calling 'int' on a division when using floor division also works). Fixed a bug where the values returned by OldStyleRange could be short by one value. Added more documentation. Testing code also has a basic sanity check. Index: Range.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/classes/Range.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Range.py 12 Feb 2004 17:35:01 -0000 1.6 --- Range.py 27 Jun 2004 23:17:35 -0000 1.7 *************** *** 1,49 **** ! # Example of a generator: re-implement the built-in range function ! # without actually constructing the list of values. (It turns out ! # that the built-in function is about 20 times faster -- that's why ! # it's built-in. :-) ! # Wrapper function to emulate the complicated range() arguments ! def range(*a): ! if len(a) == 1: ! start, stop, step = 0, a[0], 1 ! elif len(a) == 2: ! start, stop = a ! step = 1 ! elif len(a) == 3: ! start, stop, step = a ! else: ! raise TypeError, 'range() needs 1-3 arguments' ! return Range(start, stop, step) ! # Class implementing a range object. ! # To the user the instances feel like immutable sequences ! # (and you can't concatenate or slice them) ! class Range: ! # initialization -- should be called only by range() above ! def __init__(self, start, stop, step): ! if step == 0: ! raise ValueError, 'range() called with zero step' ! self.start = start ! self.stop = stop ! self.step = step ! self.len = max(0, int((self.stop - self.start) / self.step)) - # implement repr(x) and is also used by print x def __repr__(self): return 'range(%r, %r, %r)' % (self.start, self.stop, self.step) - # implement len(x) def __len__(self): return self.len - # implement x[i] def __getitem__(self, i): ! if 0 <= i < self.len: return self.start + self.step * i else: --- 1,62 ---- ! """Example of a generator: re-implement the built-in range function ! without actually constructing the list of values. + OldStyleRange is coded in the way required to work in a 'for' loop before + iterators were introduced into the language; using __getitem__ and __len__ . ! """ ! def handleargs(arglist): ! """Take list of arguments and extract/create proper start, stop, and step ! values and return in a tuple""" ! try: ! if len(arglist) == 1: ! return 0, int(arglist[0]), 1 ! elif len(arglist) == 2: ! return int(arglist[0]), int(arglist[1]), 1 ! elif len(arglist) == 3: ! if arglist[2] == 0: ! raise ValueError("step argument must not be zero") ! return tuple(int(x) for x in arglist) ! else: ! raise TypeError("range() accepts 1-3 arguments, given", len(arglist)) ! except TypeError: ! raise TypeError("range() arguments must be numbers or strings " ! "representing numbers") ! def genrange(*a): ! """Function to implement 'range' as a generator""" ! start, stop, step = handleargs(a) ! value = start ! while value < stop: ! yield value ! value += step + class oldrange: + """Class implementing a range object. + To the user the instances feel like immutable sequences + (and you can't concatenate or slice them) ! Done using the old way (pre-iterators; __len__ and __getitem__) to have an ! object be used by a 'for' loop. ! """ ! def __init__(self, *a): ! """ Initialize start, stop, and step values along with calculating the ! nubmer of values (what __len__ will return) in the range""" ! self.start, self.stop, self.step = handleargs(a) ! self.len = max(0, (self.stop - self.start) // self.step) def __repr__(self): + """implement repr(x) which is also used by print""" return 'range(%r, %r, %r)' % (self.start, self.stop, self.step) def __len__(self): + """implement len(x)""" return self.len def __getitem__(self, i): ! """implement x[i]""" ! if 0 <= i <= self.len: return self.start + self.step * i else: *************** *** 51,71 **** - # Small test program - def test(): import time, __builtin__ ! print range(10), range(-10, 10), range(0, 10, 2) ! for i in range(100, -100, -10): print i, ! print t1 = time.time() ! for i in range(1000): pass t2 = time.time() ! for i in __builtin__.range(1000): pass t3 = time.time() ! print t2-t1, 'sec (class)' ! print t3-t2, 'sec (built-in)' ! test() --- 64,93 ---- def test(): import time, __builtin__ ! #Just a quick sanity check ! correct_result = __builtin__.range(5, 100, 3) ! oldrange_result = list(oldrange(5, 100, 3)) ! genrange_result = list(genrange(5, 100, 3)) ! if genrange_result != correct_result or oldrange_result != correct_result: ! raise Exception("error in implementation:\ncorrect = %s" ! "\nold-style = %s\ngenerator = %s" % ! (correct_result, oldrange_result, genrange_result)) ! print "Timings for range(1000):" t1 = time.time() ! for i in oldrange(1000): pass t2 = time.time() ! for i in genrange(1000): pass t3 = time.time() ! for i in __builtin__.range(1000): ! pass ! t4 = time.time() ! print t2-t1, 'sec (old-style class)' ! print t3-t2, 'sec (generator)' ! print t4-t3, 'sec (built-in)' ! if __name__ == '__main__': ! test() From bcannon at users.sourceforge.net Sun Jun 27 20:48:32 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun Jun 27 20:48:41 2004 Subject: [Python-checkins] python/dist/src/Include datetime.h,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13454/Include Modified Files: datetime.h Log Message: Add missing backslash for PyDateTimeAPI->Delta_FromDelta() macro. Index: datetime.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/datetime.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** datetime.h 20 Jun 2004 22:41:24 -0000 1.5 --- datetime.h 28 Jun 2004 00:48:30 -0000 1.6 *************** *** 226,230 **** #define PyDelta_FromDSU(days, seconds, useconds) \ ! PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, PyDateTimeAPI->DeltaType) --- 226,230 ---- #define PyDelta_FromDSU(days, seconds, useconds) \ ! PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \ PyDateTimeAPI->DeltaType) From bwarsaw at users.sourceforge.net Sun Jun 27 20:50:45 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun Jun 27 20:50:51 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_socket.py, 1.69, 1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13892/Lib/test Modified Files: test_socket.py Log Message: Added socket.getservbyport(), and make its second argument and that of getservbyname() optional. Update the tests and the docs. Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** test_socket.py 31 May 2004 03:09:25 -0000 1.69 --- test_socket.py 28 Jun 2004 00:50:37 -0000 1.70 *************** *** 285,299 **** self.assertRaises(OverflowError, func, 1L<<34) ! def testGetServByName(self): ! # Testing getservbyname() ! # try a few protocols - not everyone has telnet enabled ! for proto in ("telnet", "ssh", "www", "ftp"): ! try: ! socket.getservbyname(proto, 'tcp') ! break ! except socket.error: ! pass try: ! socket.getservbyname(proto, 'udp') break except socket.error: --- 285,296 ---- self.assertRaises(OverflowError, func, 1L<<34) ! def testGetServBy(self): ! eq = self.assertEqual ! # Find one service that exists, then check all the related interfaces. ! # I've ordered this by protocols that have both a tcp and udp ! # protocol, at least for modern Linuxes. ! for service in ('ssh', 'www', 'echo', 'imap2'): try: ! port = socket.getservbyname(service, 'tcp') break except socket.error: *************** *** 301,304 **** --- 298,316 ---- else: raise socket.error + # Try same call with optional protocol omitted + port2 = socket.getservbyname(service) + eq(port, port2) + # Try udp, but don't barf it it doesn't exist + try: + udpport = socket.getservbyname(service, 'udp') + except socket.error: + udpport = None + else: + eq(udpport, port) + # Now make sure the lookup by port returns the same service name + eq(socket.getservbyport(port2), service) + eq(socket.getservbyport(port, 'tcp'), service) + if udpport is not None: + eq(socket.getservbyport(udpport, 'udp'), service) def testDefaultTimeout(self): From bwarsaw at users.sourceforge.net Sun Jun 27 20:50:46 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun Jun 27 20:51:02 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1011,1.1012 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13892/Misc Modified Files: NEWS Log Message: Added socket.getservbyport(), and make its second argument and that of getservbyname() optional. Update the tests and the docs. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1011 retrieving revision 1.1012 diff -C2 -d -r1.1011 -r1.1012 *** NEWS 27 Jun 2004 16:51:46 -0000 1.1011 --- NEWS 28 Jun 2004 00:50:42 -0000 1.1012 *************** *** 232,235 **** --- 232,238 ---- ----------------- + - Added socket.getservbyport(), and make the second argument in + getservbyname() and getservbyport() optional. + - time module code that deals with input POSIX timestamps will now raise ValueError if more than a second is lost in precision when the From bwarsaw at users.sourceforge.net Sun Jun 27 20:50:46 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun Jun 27 20:51:11 2004 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c, 1.291, 1.292 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13892/Modules Modified Files: socketmodule.c Log Message: Added socket.getservbyport(), and make its second argument and that of getservbyname() optional. Update the tests and the docs. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.291 retrieving revision 1.292 diff -C2 -d -r1.291 -r1.292 *** socketmodule.c 3 Jun 2004 09:24:42 -0000 1.291 --- socketmodule.c 28 Jun 2004 00:50:43 -0000 1.292 *************** *** 26,30 **** - socket.gethostname() --> host name (string: 'spam' or 'spam.domain.com') - socket.getprotobyname(protocolname) --> protocol number ! - socket.getservbyname(servicename, protocolname) --> port number - socket.socket([family[, type [, proto]]]) --> new socket object - socket.ntohs(16 bit value) --> new int object --- 26,31 ---- - socket.gethostname() --> host name (string: 'spam' or 'spam.domain.com') - socket.getprotobyname(protocolname) --> protocol number ! - socket.getservbyname(servicename[, protocolname]) --> port number ! - socket.getservbyport(portnumber[, protocolname]) --> service name - socket.socket([family[, type [, proto]]]) --> new socket object - socket.ntohs(16 bit value) --> new int object *************** *** 2885,2891 **** socket_getservbyname(PyObject *self, PyObject *args) { ! char *name, *proto; struct servent *sp; ! if (!PyArg_ParseTuple(args, "ss:getservbyname", &name, &proto)) return NULL; Py_BEGIN_ALLOW_THREADS --- 2886,2892 ---- socket_getservbyname(PyObject *self, PyObject *args) { ! char *name, *proto=NULL; struct servent *sp; ! if (!PyArg_ParseTuple(args, "s|s:getservbyname", &name, &proto)) return NULL; Py_BEGIN_ALLOW_THREADS *************** *** 2900,2908 **** PyDoc_STRVAR(getservbyname_doc, ! "getservbyname(servicename, protocolname) -> integer\n\ \n\ Return a port number from a service name and protocol name.\n\ ! The protocol name should be 'tcp' or 'udp'."); /* Python interface to getprotobyname(name). --- 2901,2940 ---- PyDoc_STRVAR(getservbyname_doc, ! "getservbyname(servicename[, protocolname]) -> integer\n\ \n\ Return a port number from a service name and protocol name.\n\ ! The optional protocol name, if given, should be 'tcp' or 'udp',\n\ ! otherwise any protocol will match."); ! ! ! /* Python interface to getservbyport(port). ! This only returns the service name, since the other info is already ! known or not useful (like the list of aliases). */ ! ! /*ARGSUSED*/ ! static PyObject * ! socket_getservbyport(PyObject *self, PyObject *args) ! { ! int port; ! char *proto=NULL; ! struct servent *sp; ! if (!PyArg_ParseTuple(args, "i|s:getservbyport", &port, &proto)) ! return NULL; ! Py_BEGIN_ALLOW_THREADS ! sp = getservbyport(htons(port), proto); ! Py_END_ALLOW_THREADS ! if (sp == NULL) { ! PyErr_SetString(socket_error, "port/proto not found"); ! return NULL; ! } ! return PyString_FromString(sp->s_name); ! } + PyDoc_STRVAR(getservbyport_doc, + "getservbyport(port[, protocolname]) -> string\n\ + \n\ + Return the service name from a port number and protocol name.\n\ + The optional protocol name, if given, should be 'tcp' or 'udp',\n\ + otherwise any protocol will match."); /* Python interface to getprotobyname(name). *************** *** 3531,3534 **** --- 3563,3568 ---- {"getservbyname", socket_getservbyname, METH_VARARGS, getservbyname_doc}, + {"getservbyport", socket_getservbyport, + METH_VARARGS, getservbyport_doc}, {"getprotobyname", socket_getprotobyname, METH_VARARGS,getprotobyname_doc}, From bwarsaw at users.sourceforge.net Sun Jun 27 20:51:09 2004 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Sun Jun 27 20:51:21 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsocket.tex,1.83,1.84 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13892/Doc/lib Modified Files: libsocket.tex Log Message: Added socket.getservbyport(), and make its second argument and that of getservbyname() optional. Update the tests and the docs. Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** libsocket.tex 3 Jun 2004 16:23:23 -0000 1.83 --- libsocket.tex 28 Jun 2004 00:50:35 -0000 1.84 *************** *** 273,280 **** \end{funcdesc} ! \begin{funcdesc}{getservbyname}{servicename, protocolname} Translate an Internet service name and protocol name to a port number ! for that service. The protocol name should be \code{'tcp'} or ! \code{'udp'}. \end{funcdesc} --- 273,286 ---- \end{funcdesc} ! \begin{funcdesc}{getservbyname}{servicename\optional{, protocolname}} Translate an Internet service name and protocol name to a port number ! for that service. The optional protocol name, if given, should be ! \code{'tcp'} or \code{'udp'}, otherwise any protocol will match. ! \end{funcdesc} ! ! \begin{funcdesc}{getservbyport}{port\optional{, protocolname}} ! Translate an Internet port number and protocol name to a service name ! for that service. The optional protocol name, if given, should be ! \code{'tcp'} or \code{'udp'}, otherwise any protocol will match. \end{funcdesc} From greg at users.sourceforge.net Sun Jun 27 21:20:45 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Sun Jun 27 21:20:50 2004 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18311/Modules Modified Files: _bsddb.c Log Message: Add weakref support to all bsddb.db objects. Make DBTxn objects automatically call abort() in their destructor if not yet finalized and raise a RuntimeWarning to that effect. Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** _bsddb.c 27 Jun 2004 23:36:37 -0000 1.33 --- _bsddb.c 28 Jun 2004 01:20:40 -0000 1.34 *************** *** 195,198 **** --- 195,205 ---- #endif + /* if Python >= 2.1 better support warnings */ + #if PYTHON_API_VERSION >= 1010 + #define HAVE_WARNINGS + #else + #undef HAVE_WARNINGS + #endif + struct behaviourFlags { /* What is the default behaviour when DB->get or DBCursor->get returns a *************** *** 213,216 **** --- 220,226 ---- int closed; struct behaviourFlags moduleFlags; + #ifdef HAVE_WEAKREF + PyObject *in_weakreflist; /* List of weak references */ + #endif } DBEnvObject; *************** *** 228,231 **** --- 238,244 ---- int primaryDBType; #endif + #ifdef HAVE_WEAKREF + PyObject *in_weakreflist; /* List of weak references */ + #endif } DBObject; *************** *** 244,247 **** --- 257,263 ---- PyObject_HEAD DB_TXN* txn; + #ifdef HAVE_WEAKREF + PyObject *in_weakreflist; /* List of weak references */ + #endif } DBTxnObject; *************** *** 250,253 **** --- 266,272 ---- PyObject_HEAD DB_LOCK lock; + #ifdef HAVE_WEAKREF + PyObject *in_weakreflist; /* List of weak references */ + #endif } DBLockObject; *************** *** 468,473 **** _db_errmsg[0] = 0; } ! /* if Python 2.1 or better use warning framework */ ! #if PYTHON_API_VERSION >= 1010 exceptionRaised = PyErr_Warn(PyExc_RuntimeWarning, errTxt); #else --- 487,491 ---- _db_errmsg[0] = 0; } ! #ifdef HAVE_WARNINGS exceptionRaised = PyErr_Warn(PyExc_RuntimeWarning, errTxt); #else *************** *** 698,701 **** --- 716,722 ---- self->primaryDBType = 0; #endif + #ifdef HAVE_WEAKREF + self->in_weakreflist = NULL; + #endif /* keep a reference to our python DBEnv object */ *************** *** 719,722 **** --- 740,746 ---- #endif MYDB_END_ALLOW_THREADS; + /* TODO add a weakref(self) to the self->myenvobj->open_child_weakrefs + * list so that a DBEnv can refuse to close without aborting any open + * open DBTxns and closing any open DBs first. */ if (makeDBError(err)) { if (self->myenvobj) { *************** *** 742,747 **** self->db->close(self->db, 0); MYDB_END_ALLOW_THREADS; ! /* if Python 2.1 or better use warning framework */ ! #if PYTHON_API_VERSION >= 1010 } else { PyErr_Warn(PyExc_RuntimeWarning, --- 766,770 ---- self->db->close(self->db, 0); MYDB_END_ALLOW_THREADS; ! #ifdef HAVE_WARNINGS } else { PyErr_Warn(PyExc_RuntimeWarning, *************** *** 751,754 **** --- 774,782 ---- self->db = NULL; } + #ifdef HAVE_WEAKREF + if (self->in_weakreflist != NULL) { + PyObject_ClearWeakRefs((PyObject *) self); + } + #endif if (self->myenvobj) { Py_DECREF(self->myenvobj); *************** *** 843,846 **** --- 871,877 ---- self->moduleFlags.getReturnsNone = DEFAULT_GET_RETURNS_NONE; self->moduleFlags.cursorSetReturnsNone = DEFAULT_CURSOR_SET_RETURNS_NONE; + #ifdef HAVE_WEAKREF + self->in_weakreflist = NULL; + #endif MYDB_BEGIN_ALLOW_THREADS; *************** *** 860,863 **** --- 891,900 ---- DBEnv_dealloc(DBEnvObject* self) { + #ifdef HAVE_WEAKREF + if (self->in_weakreflist != NULL) { + PyObject_ClearWeakRefs((PyObject *) self); + } + #endif + if (!self->closed) { MYDB_BEGIN_ALLOW_THREADS; *************** *** 886,889 **** --- 923,929 ---- if (self == NULL) return NULL; + #ifdef HAVE_WEAKREF + self->in_weakreflist = NULL; + #endif MYDB_BEGIN_ALLOW_THREADS; *************** *** 893,896 **** --- 933,939 ---- err = txn_begin(myenv->db_env, parent, &(self->txn), flags); #endif + /* TODO add a weakref(self) to the self->myenvobj->open_child_weakrefs + * list so that a DBEnv can refuse to close without aborting any open + * open DBTxns and closing any open DBs first. */ MYDB_END_ALLOW_THREADS; if (makeDBError(err)) { *************** *** 904,910 **** DBTxn_dealloc(DBTxnObject* self) { ! /* XXX nothing to do for transaction objects?!? */ ! /* TODO: if it hasn't been commited, should we abort it? */ #if PYTHON_API_VERSION <= 1007 --- 947,970 ---- DBTxn_dealloc(DBTxnObject* self) { ! #ifdef HAVE_WEAKREF ! if (self->in_weakreflist != NULL) { ! PyObject_ClearWeakRefs((PyObject *) self); ! } ! #endif ! #ifdef HAVE_WARNINGS ! if (self->txn) { ! /* it hasn't been finalized, abort it! */ ! MYDB_BEGIN_ALLOW_THREADS; ! #if (DBVER >= 40) ! self->txn->abort(self->txn); ! #else ! txn_abort(self->txn); ! #endif ! MYDB_END_ALLOW_THREADS; ! PyErr_Warn(PyExc_RuntimeWarning, ! "DBTxn aborted in destructor. No prior commit() or abort()."); ! } ! #endif #if PYTHON_API_VERSION <= 1007 *************** *** 930,933 **** --- 990,996 ---- if (self == NULL) return NULL; + #ifdef HAVE_WEAKREF + self->in_weakreflist = NULL; + #endif MYDB_BEGIN_ALLOW_THREADS; *************** *** 950,954 **** DBLock_dealloc(DBLockObject* self) { ! /* TODO: if it hasn't been released, should we do it? */ #if PYTHON_API_VERSION <= 1007 --- 1013,1022 ---- DBLock_dealloc(DBLockObject* self) { ! #ifdef HAVE_WEAKREF ! if (self->in_weakreflist != NULL) { ! PyObject_ClearWeakRefs((PyObject *) self); ! } ! #endif ! /* TODO: is this lock held? should we release it? */ #if PYTHON_API_VERSION <= 1007 *************** *** 4306,4309 **** --- 4374,4390 ---- &DB_mapping,/*tp_as_mapping*/ 0, /*tp_hash*/ + #ifdef HAVE_WEAKREF + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(DBObject, in_weakreflist), /* tp_weaklistoffset */ + #endif }; *************** *** 4359,4362 **** --- 4440,4456 ---- 0, /*tp_as_mapping*/ 0, /*tp_hash*/ + #ifdef HAVE_WEAKREF + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(DBEnvObject, in_weakreflist), /* tp_weaklistoffset */ + #endif }; *************** *** 4378,4381 **** --- 4472,4488 ---- 0, /*tp_as_mapping*/ 0, /*tp_hash*/ + #ifdef HAVE_WEAKREF + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(DBTxnObject, in_weakreflist), /* tp_weaklistoffset */ + #endif }; *************** *** 4398,4401 **** --- 4505,4521 ---- 0, /*tp_as_mapping*/ 0, /*tp_hash*/ + #ifdef HAVE_WEAKREF + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(DBLockObject, in_weakreflist), /* tp_weaklistoffset */ + #endif }; From greg at users.sourceforge.net Mon Jun 28 00:06:51 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Mon Jun 28 00:06:57 2004 Subject: [Python-checkins] python/dist/src/Lib/bsddb dbobj.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11608/Lib/bsddb Modified Files: dbobj.py Log Message: Adds support for DB.pget and DBCursor.pget methods. Based on a patch supplied by Ian Ward on the pybsddb mailing list 2004-03-26. Index: dbobj.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/dbobj.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** dbobj.py 28 Aug 2003 21:50:30 -0000 1.8 --- dbobj.py 28 Jun 2004 04:06:48 -0000 1.9 *************** *** 135,138 **** --- 135,140 ---- def get(self, *args, **kwargs): return apply(self._cobj.get, args, kwargs) + def pget(self, *args, **kwargs): + return apply(self._cobj.pget, args, kwargs) def get_both(self, *args, **kwargs): return apply(self._cobj.get_both, args, kwargs) From greg at users.sourceforge.net Mon Jun 28 00:06:50 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Mon Jun 28 00:07:06 2004 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11608/Modules Modified Files: _bsddb.c Log Message: Adds support for DB.pget and DBCursor.pget methods. Based on a patch supplied by Ian Ward on the pybsddb mailing list 2004-03-26. Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** _bsddb.c 28 Jun 2004 01:20:40 -0000 1.34 --- _bsddb.c 28 Jun 2004 04:06:47 -0000 1.35 *************** *** 98,102 **** #endif ! #define PY_BSDDB_VERSION "4.2.7" static char *rcs_id = "$Id$"; --- 98,102 ---- #endif ! #define PY_BSDDB_VERSION "4.2.8" static char *rcs_id = "$Id$"; *************** *** 1464,1467 **** --- 1464,1555 ---- } + static PyObject* + DB_pget(DBObject* self, PyObject* args, PyObject* kwargs) + { + int err, flags=0; + PyObject* txnobj = NULL; + PyObject* keyobj; + PyObject* dfltobj = NULL; + PyObject* retval = NULL; + int dlen = -1; + int doff = -1; + DBT key, pkey, data; + DB_TXN *txn = NULL; + char* kwnames[] = {"key", "default", "txn", "flags", "dlen", "doff", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OOiii:pget", kwnames, + &keyobj, &dfltobj, &txnobj, &flags, &dlen, + &doff)) + return NULL; + + CHECK_DB_NOT_CLOSED(self); + if (!make_key_dbt(self, keyobj, &key, &flags)) + return NULL; + if (!checkTxnObj(txnobj, &txn)) { + FREE_DBT(key); + return NULL; + } + + CLEAR_DBT(data); + if (CHECK_DBFLAG(self, DB_THREAD)) { + /* Tell BerkeleyDB to malloc the return value (thread safe) */ + data.flags = DB_DBT_MALLOC; + } + if (!add_partial_dbt(&data, dlen, doff)) { + FREE_DBT(key); + return NULL; + } + + CLEAR_DBT(pkey); + pkey.flags = DB_DBT_MALLOC; + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db->pget(self->db, txn, &key, &pkey, &data, flags); + MYDB_END_ALLOW_THREADS; + + if ((err == DB_NOTFOUND) && (dfltobj != NULL)) { + err = 0; + Py_INCREF(dfltobj); + retval = dfltobj; + } + else if ((err == DB_NOTFOUND) && self->moduleFlags.getReturnsNone) { + err = 0; + Py_INCREF(Py_None); + retval = Py_None; + } + else if (!err) { + PyObject *pkeyObj; + PyObject *dataObj; + dataObj = PyString_FromStringAndSize(data.data, data.size); + + if (self->primaryDBType == DB_RECNO || + self->primaryDBType == DB_QUEUE) + pkeyObj = PyInt_FromLong(*(long *)pkey.data); + else + pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size); + + if (flags & DB_SET_RECNO) /* return key , pkey and data */ + { + PyObject *keyObj; + int type = _DB_get_type(self); + if (type == DB_RECNO || type == DB_QUEUE) + keyObj = PyInt_FromLong(*(long *)key.data); + else + keyObj = PyString_FromStringAndSize(key.data, key.size); + retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj); + } + else /* return just the pkey and data */ + { + retval = Py_BuildValue("OO", pkeyObj, dataObj); + } + FREE_DBT(pkey); + FREE_DBT(data); + } + FREE_DBT(key); + + RETURN_IF_ERR(); + return retval; + } + /* Return size of entry */ *************** *** 2828,2831 **** --- 2916,3019 ---- } + static PyObject* + DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs) + { + int err, flags=0; + PyObject* keyobj = NULL; + PyObject* dataobj = NULL; + PyObject* retval = NULL; + int dlen = -1; + int doff = -1; + DBT key, pkey, data; + char* kwnames[] = { "key","data", "flags", "dlen", "doff", NULL }; + + CLEAR_DBT(key); + CLEAR_DBT(data); + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|ii:pget", &kwnames[2], + &flags, &dlen, &doff)) + { + PyErr_Clear(); + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi|ii:pget", + &kwnames[1], + &keyobj, &flags, &dlen, &doff)) + { + PyErr_Clear(); + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOi|ii:pget", + kwnames, &keyobj, &dataobj, + &flags, &dlen, &doff)) + { + return NULL; + } + } + } + + CHECK_CURSOR_NOT_CLOSED(self); + + if (keyobj && !make_key_dbt(self->mydb, keyobj, &key, NULL)) + return NULL; + if ( (dataobj && !make_dbt(dataobj, &data)) || + (!add_partial_dbt(&data, dlen, doff)) ) { + FREE_DBT(key); + return NULL; + } + + if (CHECK_DBFLAG(self->mydb, DB_THREAD)) { + data.flags = DB_DBT_MALLOC; + if (!(key.flags & DB_DBT_REALLOC)) { + key.flags |= DB_DBT_MALLOC; + } + } + + CLEAR_DBT(pkey); + pkey.flags = DB_DBT_MALLOC; + + MYDB_BEGIN_ALLOW_THREADS; + err = self->dbc->c_pget(self->dbc, &key, &pkey, &data, flags); + MYDB_END_ALLOW_THREADS; + + if ((err == DB_NOTFOUND) && self->mydb->moduleFlags.getReturnsNone) { + Py_INCREF(Py_None); + retval = Py_None; + } + else if (makeDBError(err)) { + retval = NULL; + } + else { + PyObject *pkeyObj; + PyObject *dataObj; + dataObj = PyString_FromStringAndSize(data.data, data.size); + + if (self->mydb->primaryDBType == DB_RECNO || + self->mydb->primaryDBType == DB_QUEUE) + pkeyObj = PyInt_FromLong(*(long *)pkey.data); + else + pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size); + + if (flags & DB_SET_RECNO) /* return key, pkey and data */ + { + PyObject *keyObj; + int type = _DB_get_type(self->mydb); + if (type == DB_RECNO || type == DB_QUEUE) + keyObj = PyInt_FromLong(*(long *)key.data); + else + keyObj = PyString_FromStringAndSize(key.data, key.size); + retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj); + FREE_DBT(key); + } + else /* return just the pkey and data */ + { + retval = Py_BuildValue("OO", pkeyObj, dataObj); + } + FREE_DBT(pkey); + FREE_DBT(data); + } + /* the only time REALLOC should be set is if we used an integer + * key that make_key_dbt malloc'd for us. always free these. */ + if (key.flags & DB_DBT_REALLOC) { + FREE_DBT(key); + } + return retval; + } + static PyObject* *************** *** 2975,2980 **** } FREE_DBT(data); } - FREE_DBT(key); return retval; --- 3163,3173 ---- } FREE_DBT(data); + FREE_DBT(key); + } + /* the only time REALLOC should be set is if we used an integer + * key that make_key_dbt malloc'd for us. always free these. */ + if (key.flags & DB_DBT_REALLOC) { + FREE_DBT(key); } return retval; *************** *** 3045,3049 **** } /* the only time REALLOC should be set is if we used an integer ! * key that make_dbt_key malloc'd for us. always free these. */ if (key.flags & DB_DBT_REALLOC) { FREE_DBT(key); --- 3238,3242 ---- } /* the only time REALLOC should be set is if we used an integer ! * key that make_key_dbt malloc'd for us. always free these. */ if (key.flags & DB_DBT_REALLOC) { FREE_DBT(key); *************** *** 4184,4187 **** --- 4377,4381 ---- {"fd", (PyCFunction)DB_fd, METH_VARARGS}, {"get", (PyCFunction)DB_get, METH_VARARGS|METH_KEYWORDS}, + {"pget", (PyCFunction)DB_pget, METH_VARARGS|METH_KEYWORDS}, {"get_both", (PyCFunction)DB_get_both, METH_VARARGS|METH_KEYWORDS}, {"get_byteswapped", (PyCFunction)DB_get_byteswapped,METH_VARARGS}, *************** *** 4243,4246 **** --- 4437,4441 ---- {"first", (PyCFunction)DBC_first, METH_VARARGS|METH_KEYWORDS}, {"get", (PyCFunction)DBC_get, METH_VARARGS|METH_KEYWORDS}, + {"pget", (PyCFunction)DBC_pget, METH_VARARGS|METH_KEYWORDS}, {"get_recno", (PyCFunction)DBC_get_recno, METH_VARARGS}, {"last", (PyCFunction)DBC_last, METH_VARARGS|METH_KEYWORDS}, From greg at users.sourceforge.net Mon Jun 28 00:06:52 2004 From: greg at users.sourceforge.net (greg@users.sourceforge.net) Date: Mon Jun 28 00:07:14 2004 Subject: [Python-checkins] python/dist/src/Lib/bsddb/test test_associate.py, 1.7, 1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11608/Lib/bsddb/test Modified Files: test_associate.py Log Message: Adds support for DB.pget and DBCursor.pget methods. Based on a patch supplied by Ian Ward on the pybsddb mailing list 2004-03-26. Index: test_associate.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_associate.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_associate.py 12 Feb 2004 17:35:08 -0000 1.7 --- test_associate.py 28 Jun 2004 04:06:49 -0000 1.8 *************** *** 84,87 **** --- 84,88 ---- 53: ("David Lanz", "Heartsounds", "New Age"), 54: ("David Lanz", "Leaves on the Seine", "New Age"), + 99: ("unknown artist", "Unnamed song", "Unknown"), } *************** *** 118,121 **** --- 119,123 ---- def createDB(self): self.primary = db.DB(self.env) + self.primary.set_get_returns_none(2) self.primary.open(self.filename, "primary", self.dbtype, db.DB_CREATE | db.DB_THREAD) *************** *** 137,140 **** --- 139,143 ---- secDB = db.DB(self.env) secDB.set_flags(db.DB_DUP) + secDB.set_get_returns_none(2) secDB.open(self.filename, "secondary", db.DB_BTREE, db.DB_CREATE | db.DB_THREAD) *************** *** 167,170 **** --- 170,183 ---- def finish_test(self, secDB): + # 'Blues' should not be in the secondary database + vals = secDB.pget('Blues') + assert vals == None, vals + + vals = secDB.pget('Unknown') + assert vals[0] == 99 or vals[0] == '99', vals + vals[1].index('Unknown') + vals[1].index('Unnamed') + vals[1].index('unknown') + if verbose: print "Primary key traversal:" *************** *** 188,191 **** --- 201,216 ---- c = secDB.cursor() count = 0 + + # test cursor pget + vals = c.pget('Unknown', flags=db.DB_LAST) + assert vals[1] == 99 or vals[1] == '99', vals + assert vals[0] == 'Unknown' + vals[2].index('Unknown') + vals[2].index('Unnamed') + vals[2].index('unknown') + + vals = c.pget('Unknown', data='wrong value', flags=db.DB_GET_BOTH) + assert vals == None, vals + rec = c.first() assert rec[0] == "Jazz" From rhettinger at users.sourceforge.net Mon Jun 28 02:57:23 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Jun 28 02:57:29 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode_file.py, 1.14, 1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4262 Modified Files: test_unicode_file.py Log Message: Patch from Mark Hammond to fix a test error. Now runs without exception on WinME/98. Index: test_unicode_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode_file.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_unicode_file.py 21 Mar 2004 20:55:47 -0000 1.14 --- test_unicode_file.py 28 Jun 2004 06:57:19 -0000 1.15 *************** *** 40,54 **** # basename should appear in listdir. path, base = os.path.split(os.path.abspath(filename)) ! if (isinstance (filename, str)): ! new_base = base.decode(TESTFN_ENCODING) ! file_list = [f.decode(TESTFN_ENCODING) for f in os.listdir(path)] ! else: ! new_base = base ! file_list = os.listdir(path) ! new_base = unicodedata.normalize("NFD", new_base) file_list = [unicodedata.normalize("NFD", f) for f in file_list] ! self.failUnless(new_base in file_list) # Do as many "equivalancy' tests as we can - ie, check that although we --- 40,57 ---- # basename should appear in listdir. path, base = os.path.split(os.path.abspath(filename)) ! if isinstance(base, str): ! base = base.decode(TESTFN_ENCODING) ! file_list = os.listdir(path) ! # listdir() with a unicode arg may or may not return Unicode ! # objects, depending on the platform. ! if file_list and isinstance(file_list[0], str): ! file_list = [f.decode(TESTFN_ENCODING) for f in file_list] ! # Normalize the unicode strings, as round-tripping the name via the OS ! # may return a different (but equivalent) value. ! base = unicodedata.normalize("NFD", base) file_list = [unicodedata.normalize("NFD", f) for f in file_list] ! self.failUnless(base in file_list) # Do as many "equivalancy' tests as we can - ie, check that although we From loewis at users.sourceforge.net Mon Jun 28 11:24:25 2004 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon Jun 28 11:24:29 2004 Subject: [Python-checkins] python/dist/src/PCbuild pcbuild.sln,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32022 Modified Files: pcbuild.sln Log Message: Add readme.txt Index: pcbuild.sln =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pcbuild.sln,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pcbuild.sln 2 Jan 2004 21:13:59 -0000 1.1 --- pcbuild.sln 28 Jun 2004 15:24:23 -0000 1.2 *************** *** 151,154 **** --- 151,157 ---- {680CDC79-9CCA-4282-9A8D-927CB0DB55B2}.Release.Build.0 = Release|Win32 EndGlobalSection + GlobalSection(SolutionItems) = postSolution + readme.txt = readme.txt + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection From bcannon at users.sourceforge.net Mon Jun 28 23:48:25 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon Jun 28 23:48:29 2004 Subject: [Python-checkins] python/dist/src/Doc/ext extending.tex,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12197 Modified Files: extending.tex Log Message: Changed applicable use of ``char *`` declarations that are passed into PyArg_ParseTuple() to ``const char *`` to match the recommendation made in section 1.3 and to support better coding habits. Section 1.8 ("Keyword Parameters for Extension Functions") and it's coding example were not touched since it is stems from an accredited source and thus did not want to step on anyone's toes. Index: extending.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/extending.tex,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** extending.tex 27 Jun 2004 04:28:00 -0000 1.29 --- extending.tex 29 Jun 2004 03:48:23 -0000 1.30 *************** *** 71,75 **** spam_system(PyObject *self, PyObject *args) { ! char *command; int sts; --- 71,75 ---- spam_system(PyObject *self, PyObject *args) { ! const char *command; int sts; *************** *** 635,639 **** int i, j; long k, l; ! char *s; int size; --- 635,639 ---- int i, j; long k, l; ! const char *s; int size; *************** *** 660,665 **** \begin{verbatim} { ! char *file; ! char *mode = "r"; int bufsize = 0; ok = PyArg_ParseTuple(args, "s|si", &file, &mode, &bufsize); --- 660,665 ---- \begin{verbatim} { ! const char *file; ! const char *mode = "r"; int bufsize = 0; ok = PyArg_ParseTuple(args, "s|si", &file, &mode, &bufsize); *************** *** 1229,1233 **** \begin{verbatim} static int ! PySpam_System(char *command) { return system(command); --- 1229,1233 ---- \begin{verbatim} static int ! PySpam_System(const char *command) { return system(command); *************** *** 1241,1245 **** spam_system(PyObject *self, PyObject *args) { ! char *command; int sts; --- 1241,1245 ---- spam_system(PyObject *self, PyObject *args) { ! const char *command; int sts; From bcannon at users.sourceforge.net Tue Jun 29 00:02:44 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Jun 29 00:02:49 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1012,1.1013 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14186/Misc Modified Files: NEWS Log Message: rsync is now a recognized protocol that uses "netloc" (i.e. specifies a network location) in its addressing. Closes bug #981299. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1012 retrieving revision 1.1013 diff -C2 -d -r1.1012 -r1.1013 *** NEWS 28 Jun 2004 00:50:42 -0000 1.1012 --- NEWS 29 Jun 2004 04:02:40 -0000 1.1013 *************** *** 351,354 **** --- 351,357 ---- ------- + - Bug #981299: rsync is now a recognized protocol that uses a "netloc" portion + of a URL. + - Bug #919012: shutil.move() will not try to move a directory into itself. Thanks Johannes Gijsbers. From bcannon at users.sourceforge.net Tue Jun 29 00:02:57 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Jun 29 00:03:00 2004 Subject: [Python-checkins] python/dist/src/Lib urlparse.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14186/Lib Modified Files: urlparse.py Log Message: rsync is now a recognized protocol that uses "netloc" (i.e. specifies a network location) in its addressing. Closes bug #981299. Index: urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urlparse.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** urlparse.py 7 May 2004 05:50:35 -0000 1.44 --- urlparse.py 29 Jun 2004 04:02:39 -0000 1.45 *************** *** 14,18 **** uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', ! 'snews', 'prospero', 'rtsp', 'rtspu', ''] non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', 'telnet', 'wais', 'imap', 'snews', 'sip'] --- 14,18 ---- uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', ! 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', ''] non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', 'telnet', 'wais', 'imap', 'snews', 'sip'] From bcannon at users.sourceforge.net Tue Jun 29 00:05:59 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Jun 29 00:06:02 2004 Subject: [Python-checkins] python/dist/src/Lib urlparse.py,1.40,1.40.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14641/Lib Modified Files: Tag: release23-maint urlparse.py Log Message: Add support in urlparse for recognizing rsync as a protocol that defines a "netloc" (i.e., network location) in its URL. Closes bug #981299. Index: urlparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urlparse.py,v retrieving revision 1.40 retrieving revision 1.40.10.1 diff -C2 -d -r1.40 -r1.40.10.1 *** urlparse.py 30 Mar 2003 16:28:26 -0000 1.40 --- urlparse.py 29 Jun 2004 04:05:57 -0000 1.40.10.1 *************** *** 14,18 **** uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', ! 'snews', 'prospero', 'rtsp', 'rtspu', ''] non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', 'telnet', 'wais', 'imap', 'snews', 'sip'] --- 14,18 ---- uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', ! 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', ''] non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', 'telnet', 'wais', 'imap', 'snews', 'sip'] From bcannon at users.sourceforge.net Tue Jun 29 00:06:00 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Jun 29 00:06:07 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS, 1.831.4.124, 1.831.4.125 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14641/Misc Modified Files: Tag: release23-maint NEWS Log Message: Add support in urlparse for recognizing rsync as a protocol that defines a "netloc" (i.e., network location) in its URL. Closes bug #981299. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.124 retrieving revision 1.831.4.125 diff -C2 -d -r1.831.4.124 -r1.831.4.125 *** NEWS 26 Jun 2004 04:10:14 -0000 1.831.4.124 --- NEWS 29 Jun 2004 04:05:57 -0000 1.831.4.125 *************** *** 38,41 **** --- 38,44 ---- ------- + - Bug #981299: rsync is now a recognized protocol in urlparse that uses a + "netloc" portion of a URL. + - Patch #975885: Print file name in err msg in quiet mode of compileall.py. From bcannon at users.sourceforge.net Tue Jun 29 00:08:26 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Jun 29 00:08:30 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1013,1.1014 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15074/Misc Modified Files: NEWS Log Message: Fix stupid mistake of forgetting to mention that the fix for bug #981299 entailed editing the urlparse module. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1013 retrieving revision 1.1014 diff -C2 -d -r1.1013 -r1.1014 *** NEWS 29 Jun 2004 04:02:40 -0000 1.1013 --- NEWS 29 Jun 2004 04:08:23 -0000 1.1014 *************** *** 351,356 **** ------- ! - Bug #981299: rsync is now a recognized protocol that uses a "netloc" portion ! of a URL. - Bug #919012: shutil.move() will not try to move a directory into itself. --- 351,356 ---- ------- ! - Bug #981299: rsync is now a recognized protocol in urlparse that uses a ! "netloc" portion of a URL. - Bug #919012: shutil.move() will not try to move a directory into itself. From bcannon at users.sourceforge.net Tue Jun 29 00:14:04 2004 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue Jun 29 00:14:07 2004 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.119,1.120 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15956 Modified Files: ref3.tex Log Message: Add a missing space. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** ref3.tex 6 May 2004 12:44:29 -0000 1.119 --- ref3.tex 29 Jun 2004 04:14:02 -0000 1.120 *************** *** 1186,1190 **** \begin{methoddesc}[object]{__hash__}{self} ! Called for the key object for dictionary\obindex{dictionary} operations, and by the built-in function \function{hash()}\bifuncindex{hash}. Should return a 32-bit integer --- 1186,1190 ---- \begin{methoddesc}[object]{__hash__}{self} ! Called for the key object for dictionary \obindex{dictionary} operations, and by the built-in function \function{hash()}\bifuncindex{hash}. Should return a 32-bit integer From rhettinger at users.sourceforge.net Tue Jun 29 06:08:39 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 29 06:08:46 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.24, 1.25 test_Decimal.py, 1.19, 1.20 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10586 Modified Files: Decimal.py test_Decimal.py Log Message: Prepare Decimal to move into the core. * With agreement from the principal contributors, removed the BSD license and added a PSF copyright. * Remove version history. CVS will track that now. * Add a todo list. * Made Decimal() == Decimal("0"). * Added pickle support for Decimal objects. * Copy and deepcopy now return self (as all good immutables do). * Run doctest on the docstrings. * Group the test suites together so their results can be aggregated. * Replaced variable names that shadowed imports or builtins (this excludes "divmod" which seemed to be the variable name). Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Decimal.py 25 Jun 2004 17:46:20 -0000 1.24 --- Decimal.py 29 Jun 2004 10:08:35 -0000 1.25 *************** *** 1,7 **** ! # Class Decimal, version 0.7.1 ! # Written by Eric Price ! # and Facundo Batista ! # Based on code written by Aahz (aahz@pobox.com) ! # Currently under BSD-style license (copyright 2003) """ This is a stab at a decimal arithmetic module based on the decimal --- 1,19 ---- ! # Copyright (c) 2004 Python Software Foundation. ! # All rights reserved. ! ! # Written by Eric Price ! # and Facundo Batista ! # and Raymond Hettinger ! # and Aahz (aahz at pobox.com) ! # and Tim Peters ! ! ! # Todo: ! # Add deepcopy and pickle support for contexts ! # Rename to decimal.Decimal before moving into production ! # Consider having a SimpleDecimal subclass implementing X3.274 semantics ! # Add an __all__ attribute ! # Improve docstrings and add more doctests ! """ This is a stab at a decimal arithmetic module based on the decimal *************** *** 95,132 **** """ ! # facundobatista: ! # 0.8.2 2004.06.24 Lot of small clean-ups from Raymond Hettinger. ! # 0.8.1 2004.06.23 Complies with immutability-near as discussed in c.l.py. ! # 0.8.0 2004.06.21 Using the updated Spec (and complies with new test cases) from ! # Cowlishaw. Deprecated trim and rescale. Changed __str__ and ! # __repr__ to return in sci format, added as_tuple(). Fixed the ! # initial examples. Extracted lt, gt and eq methods from context. ! # Added copy method to context. ! # 0.7.6 2004.06.20 More name changes. Extracted InsufficientStorage exception. ! # Added create_decimal to context. ! # 0.7.5 2004.06.19 Lots of name changes. ! # 0.7.4 2004.04.05 Added rdiv, rdivmod, rmod, rpow, rfloordiv special methods. ! # Fixed sub. ! # 0.7.3 2004.04.04 Added _convert_other method, for implicit constructions, ! # and more checks when constructing from tuples. Fixed ! # __sub__ to modify a copy of the instance. ! # 0.7.2 2004.04.02 Fixed __pow__ to run the example ok. Added from_float ! # method. Fixed isnan to accept empty strings. ! # 0.7.1 2004.03.08 Corrected initial examples ! ! # eprice: ! # 0.7.0 2003.2.28 More changes. Contexts done nicely, exponent limits ! # 0.6.0 2003.2.24 Many changes. No exponent limits ! ! # Aahz: ! # 0.0.8 2001.5.24 Fixed multiplication with trailing zeroes ! # 0.0.7 2001.5.23 Fixed string conversion to follow spec ! # 0.0.6 2001.5.20 Tim Peters's _floatToString() ! # 0.0.5 2001.5.20 Now with multiplication, round(), and conversions ! # 0.0.0 2001.5.18 First public release with just addition/subtraction ! ! # To-do list: ! # ! # Cleanup, hunt and kill bugs import threading --- 107,111 ---- """ ! # XXX Add an __all__ attribute import threading *************** *** 137,141 **** #Capitals: 1E+10, not 1e10 - CAPITALS = 1 --- 116,119 ---- *************** *** 401,404 **** --- 379,383 ---- return context + class Decimal(object): """Floating point class for decimal arithmetic.""" *************** *** 406,410 **** __slots__ = ('_exp','_int','_sign') ! def __init__(self, value, context = None): """Initialize the Decimal class. --- 385,389 ---- __slots__ = ('_exp','_int','_sign') ! def __init__(self, value="0", context=None): """Initialize the Decimal class. *************** *** 420,423 **** --- 399,403 ---- if context is None: context = getcontext() + # String? # REs insist on real strings, so we can too. *************** *** 448,451 **** --- 428,432 ---- return + ### XXX Hmm, with precision=3, Decimal(12345) fails with Decimal('12345') works if isinstance(value, (int,long)): # checking that the int or long doesn't exceed precision *************** *** 1795,1810 **** return ans ! copy = self._fix(context=context) ! if copy._isinfinity(): ! return copy ! if not copy: ! return Decimal( (copy._sign, (0,), 0) ) ! end = len(copy._int) ! exp = copy._exp ! while copy._int[end-1] == 0: exp += 1 end -= 1 ! return Decimal( (copy._sign, copy._int[:end], exp) ) --- 1776,1791 ---- return ans ! dup = self._fix(context=context) ! if dup._isinfinity(): ! return dup ! if not dup: ! return Decimal( (dup._sign, (0,), 0) ) ! end = len(dup._int) ! exp = dup._exp ! while dup._int[end-1] == 0: exp += 1 end -= 1 ! return Decimal( (dup._sign, dup._int[:end], exp) ) *************** *** 2110,2113 **** --- 2091,2104 ---- exp = property(_get_exp) + # support for pickling, copy, and deepcopy + def __reduce__(self): + return (self.__class__, (str(self),)) + + def __copy__(self): + return self # I'm immutable; therefore I am my own clone + + def __deepcopy__(self, memo): + return self # My components are also immutable + # get rounding method function: *************** *** 2202,2205 **** --- 2193,2197 ---- """Returns Etiny (= Emin - prec + 1)""" return long(self.Emin - self.prec + 1) + def Etop(self): """Returns maximum exponent (= Emin - prec + 1)""" *************** *** 2375,2379 **** curspot -= 1 ! def subtract(self, list): """Subtract a list from the current int (in place). --- 2367,2371 ---- curspot -= 1 ! def subtract(self, alist): """Subtract a list from the current int (in place). *************** *** 2384,2392 **** self.int.reverse() ! list.reverse() carry = 0 ! for x in xrange(len(list)): ! self.int[x] -= list[x] + carry if self.int[x] < 0: carry = 1 --- 2376,2384 ---- self.int.reverse() ! alist.reverse() carry = 0 ! for x in xrange(len(alist)): ! self.int[x] -= alist[x] + carry if self.int[x] < 0: carry = 1 *************** *** 2403,2407 **** self.int[last+1:]=[] self.int.reverse() ! list.reverse() return --- 2395,2399 ---- self.int[last+1:]=[] self.int.reverse() ! alist.reverse() return *************** *** 2753,2755 **** return "%s%se%d" % (sign, str(top), e) - --- 2745,2746 ---- Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_Decimal.py 25 Jun 2004 01:30:49 -0000 1.19 --- test_Decimal.py 29 Jun 2004 10:08:35 -0000 1.20 *************** *** 1,5 **** ! # Test Cases for Decimal module, version 0.1.1 ! # Written by Eric Price ! # and Facundo Batista """ These are the test cases for the Decimal module. --- 1,11 ---- ! # Copyright (c) 2004 Python Software Foundation. ! # All rights reserved. ! ! # Written by Eric Price ! # and Facundo Batista ! # and Raymond Hettinger ! # and Aahz (aahz at pobox.com) ! # and Tim Peters ! """ These are the test cases for the Decimal module. *************** *** 15,43 **** """ - # 0.2.1 2004.06.23 fb: Added immutability test for operations. - # 0.2.0 2004.06.21 fb: Using the new test cases from Cowlishaw. Deprecated trim - # test case and use of result in inexact test case. Added - # as_tuple() test case. - # 0.1.9 2004.06.20 fb: More fixes because of the name changes. Added test case for - # context.create_decimal(). - # 0.1.8 2004.06.19 fb: Adjusted threading test case. Taken out the immutability - # test. Added tearDown method to DecimalTest class. Some fixes - # because of the name changes. - # 0.1.7 2004.04.05 fb: Adjusted several test cases. Eliminated interaction - # with float in comparations and min/max test cases. - # 0.1.6 2004.04.04 fb: Extended explicit construction test case from tuples. - # 0.1.5 2004.04.02 fb: Adjusted explicit construction test cases. - # 0.1.4 2004.03.28 fb: Added Use of Context and Decimal Usability test cases. - # Corrected tests using try/except/else. - # 0.1.3 2004.03.23 fb: Added arithmetic operators test and corrected minor - # method case issues. - # 0.1.2 2004.03.20 fb: Added from_float to explicit construction test cases - # and all implicit construction test cases. Also upgraded - # method names to new GvR definiton. - # 0.1.1 2004.03.11 fb: Added Explicit Construction tests - # 0.1.0 2004.03.11 fb: Placed the structure to run separate test groups - # - # fb = facundobatista - from __future__ import division --- 21,24 ---- *************** *** 45,51 **** import glob import os, sys from Decimal import * ! from test.test_support import TestSkipped, run_unittest --- 26,33 ---- import glob import os, sys + import pickle, copy from Decimal import * ! from test.test_support import TestSkipped, run_unittest, run_doctest *************** *** 90,94 **** # Name adapter to be able to change the Decimal and Context ! # interface without changing the test files from Cowlishaw nameAdapter = {'toeng':'to_eng_string', 'tosci':'to_sci_string', --- 72,76 ---- # Name adapter to be able to change the Decimal and Context ! # interface without changing the test files from Cowlishaw nameAdapter = {'toeng':'to_eng_string', 'tosci':'to_sci_string', *************** *** 144,148 **** #Exception raised where there shoudn't have been one. self.fail('Exception "'+exception.__class__.__name__ + '" raised on line '+line) ! return --- 126,130 ---- #Exception raised where there shoudn't have been one. self.fail('Exception "'+exception.__class__.__name__ + '" raised on line '+line) ! return *************** *** 200,204 **** fname = nameAdapter.get(funct, funct) if fname == 'rescale': ! return funct = getattr(self.context, fname) vals = [] --- 182,186 ---- fname = nameAdapter.get(funct, funct) if fname == 'rescale': ! return funct = getattr(self.context, fname) vals = [] *************** *** 234,238 **** else: self.fail("Did not raise %s in %s" % (error, s)) ! self.context.trap_enablers[error] = 0 v = self.context.create_decimal(v) else: --- 216,220 ---- else: self.fail("Did not raise %s in %s" % (error, s)) ! self.context.trap_enablers[error] = 0 v = self.context.create_decimal(v) else: *************** *** 241,245 **** ans = FixQuotes(ans) ! if EXTENDEDERRORTEST and fname not in ('to_sci_string', 'to_eng_string'): for error in theirexceptions: --- 223,227 ---- ans = FixQuotes(ans) ! if EXTENDEDERRORTEST and fname not in ('to_sci_string', 'to_eng_string'): for error in theirexceptions: *************** *** 254,258 **** else: self.fail("Did not raise %s in %s" % (error, s)) ! self.context.trap_enablers[error] = 0 try: result = str(funct(*vals)) --- 236,240 ---- else: self.fail("Did not raise %s in %s" % (error, s)) ! self.context.trap_enablers[error] = 0 try: result = str(funct(*vals)) *************** *** 490,494 **** def test_empty(self): '''Explicit construction without parameters.''' ! self.assertRaises(TypeError, Decimal) def test_from_None(self): --- 472,476 ---- def test_empty(self): '''Explicit construction without parameters.''' ! self.assertEqual(Decimal(), Decimal("0")) def test_from_None(self): *************** *** 510,514 **** d = Decimal(-45) self.assertEqual(str(d), '-45') ! #zero d = Decimal(0) --- 492,496 ---- d = Decimal(-45) self.assertEqual(str(d), '-45') ! #zero d = Decimal(0) *************** *** 525,529 **** d = Decimal('45') self.assertEqual(str(d), '45') ! #float d = Decimal('45.34') --- 507,511 ---- d = Decimal('45') self.assertEqual(str(d), '45') ! #float d = Decimal('45.34') *************** *** 548,552 **** d = Decimal.from_float(-32.0) self.assertEqual(str(d), '-32') ! #zero d = Decimal.from_float(0.0) --- 530,534 ---- d = Decimal.from_float(-32.0) self.assertEqual(str(d), '-32') ! #zero d = Decimal.from_float(0.0) *************** *** 565,573 **** d = Decimal.from_float(2.2) self.assertEqual(str(d), '2.20000000000000017763568394002504646778106689453125') ! #inexact float, rounded to some positions d = Decimal.from_float(2.2, 16) self.assertEqual(str(d), '2.2000000000000002') ! #inexact float, rounded to less positions d = Decimal.from_float(2.2, 5) --- 547,555 ---- d = Decimal.from_float(2.2) self.assertEqual(str(d), '2.20000000000000017763568394002504646778106689453125') ! #inexact float, rounded to some positions d = Decimal.from_float(2.2, 16) self.assertEqual(str(d), '2.2000000000000002') ! #inexact float, rounded to less positions d = Decimal.from_float(2.2, 5) *************** *** 584,588 **** d = Decimal( (1, (4, 5), 0) ) self.assertEqual(str(d), '-45') ! #float d = Decimal( (0, (4, 5, 3, 4), -2) ) --- 566,570 ---- d = Decimal( (1, (4, 5), 0) ) self.assertEqual(str(d), '-45') ! #float d = Decimal( (0, (4, 5, 3, 4), -2) ) *************** *** 626,630 **** self.assertEqual(str(e), '-45') self.assertNotEqual(id(d), id(e)) ! #zero d = Decimal(0) --- 608,612 ---- self.assertEqual(str(e), '-45') self.assertNotEqual(id(d), id(e)) ! #zero d = Decimal(0) *************** *** 688,692 **** else: self.fail('Did not raised an error!') ! def test_from_int(self): '''Implicit construction with int or long.''' --- 670,674 ---- else: self.fail('Did not raised an error!') ! def test_from_int(self): '''Implicit construction with int or long.''' *************** *** 704,708 **** else: self.fail('Did not raised an error!') ! def test_from_string(self): '''Implicit construction with string.''' --- 686,690 ---- else: self.fail('Did not raised an error!') ! def test_from_string(self): '''Implicit construction with string.''' *************** *** 1010,1014 **** def test_threading(self): '''Test the "threading isolation" of a Context.''' ! self.synchro = threading.Event() self.finish1 = threading.Event() --- 992,996 ---- def test_threading(self): '''Test the "threading isolation" of a Context.''' ! self.synchro = threading.Event() self.finish1 = threading.Event() *************** *** 1073,1088 **** '''Test copy and deepcopy.''' - import copy d = Decimal('43.24') - - #copy c = copy.copy(d) ! self.assertEqual(c, d) ! self.assertNotEqual(id(c), id(d)) ! ! #deepcopy dc = copy.deepcopy(d) ! self.assertEqual(dc, d) ! self.assertNotEqual(id(dc), id(d)) def test_hash_method(self): --- 1055,1063 ---- '''Test copy and deepcopy.''' d = Decimal('43.24') c = copy.copy(d) ! self.assertEqual(id(c), id(d)) dc = copy.deepcopy(d) ! self.assertEqual(id(dc), id(d)) def test_hash_method(self): *************** *** 1123,1127 **** #as true self.failUnless(Decimal('0.372')) ! def test_tostring_methods(self): '''Test str and repr methods.''' --- 1098,1102 ---- #as true self.failUnless(Decimal('0.372')) ! def test_tostring_methods(self): '''Test str and repr methods.''' *************** *** 1134,1138 **** #repr self.assertEqual(repr(d), 'Decimal("15.32")') ! def test_tonum_methods(self): '''Test float, int and long methods.''' --- 1109,1113 ---- #repr self.assertEqual(repr(d), 'Decimal("15.32")') ! def test_tonum_methods(self): '''Test float, int and long methods.''' *************** *** 1163,1167 **** d = Decimal( (1, (4, 5), 0) ) self.assertEqual(d, eval(repr(d))) ! #float d = Decimal( (0, (4, 5, 3, 4), -2) ) --- 1138,1142 ---- d = Decimal( (1, (4, 5), 0) ) self.assertEqual(d, eval(repr(d))) ! #float d = Decimal( (0, (4, 5, 3, 4), -2) ) *************** *** 1182,1186 **** d = Decimal(-45) self.assertEqual(d.as_tuple(), (1, (4, 5), 0) ) ! #complicated string d = Decimal("-4.34913534E-17") --- 1157,1161 ---- d = Decimal(-45) self.assertEqual(d.as_tuple(), (1, (4, 5), 0) ) ! #complicated string d = Decimal("-4.34913534E-17") *************** *** 1247,1251 **** self.assertEqual(d1._int, b1._int) self.assertEqual(d1._exp, b1._exp) ! checkSameDec("__abs__") checkSameDec("__add__", True) --- 1222,1226 ---- self.assertEqual(d1._int, b1._int) self.assertEqual(d1._exp, b1._exp) ! checkSameDec("__abs__") checkSameDec("__add__", True) *************** *** 1289,1295 **** checkSameDec("to_integral") ! def test_main(which=None): """ Execute the tests. --- 1264,1276 ---- checkSameDec("to_integral") + class DecimalPythonAPItests(unittest.TestCase): + def test_pickle(self): + d = Decimal('-3.141590000') + p = pickle.dumps(d) + e = pickle.loads(p) + self.assertEqual(d, e) ! def test_main(which=None, verbose=None): """ Execute the tests. *************** *** 1298,1312 **** Otherwise, executes both of them. """ if which == "Arithmetic" or which is None: ! run_unittest(DecimalTest) if which == "Behaviour" or which is None: ! run_unittest(DecimalExplicitConstructionTest) ! run_unittest(DecimalImplicitConstructionTest) ! run_unittest(DecimalArithmeticOperatorsTest) ! run_unittest(DecimalUseOfContextTest) ! run_unittest(DecimalUsabilityTest) ! return --- 1279,1300 ---- Otherwise, executes both of them. """ + test_classes = [] if which == "Arithmetic" or which is None: ! test_classes.extend([DecimalTest]) if which == "Behaviour" or which is None: ! test_classes.extend([ ! DecimalExplicitConstructionTest, ! DecimalImplicitConstructionTest, ! DecimalArithmeticOperatorsTest, ! DecimalUseOfContextTest, ! DecimalUsabilityTest, ! DecimalPythonAPItests, ! ]) ! ! run_unittest(*test_classes) ! import Decimal as DecimalModule ! run_doctest(DecimalModule, verbose) return *************** *** 1314,1320 **** if __name__ == '__main__': if len(sys.argv) == 1: ! test_main() elif len(sys.argv) == 2: ! test_main(sys.argv[1]) else: raise ValueError, "test called with wrong arguments, use test_Decimal [Arithmetic|Behaviour]" --- 1302,1308 ---- if __name__ == '__main__': if len(sys.argv) == 1: ! test_main(verbose=True) elif len(sys.argv) == 2: ! test_main(sys.argv[1], verbose=True) else: raise ValueError, "test called with wrong arguments, use test_Decimal [Arithmetic|Behaviour]" From akuchling at users.sourceforge.net Tue Jun 29 09:07:57 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Jun 29 09:08:01 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_urllib.py, 1.15, 1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12980 Modified Files: test_urllib.py Log Message: Docstring grammar fix Index: test_urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_urllib.py 5 Jun 2004 13:30:56 -0000 1.15 --- test_urllib.py 29 Jun 2004 13:07:53 -0000 1.16 *************** *** 20,24 **** Try to test as much functionality as possible so as to cut down on reliance ! on connect to the Net for testing. """ --- 20,24 ---- Try to test as much functionality as possible so as to cut down on reliance ! on connecting to the Net for testing. """ From akuchling at users.sourceforge.net Tue Jun 29 09:15:49 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Jun 29 09:15:54 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_urllib2.py, 1.13, 1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14526 Modified Files: test_urllib2.py Log Message: Add test case for bug #912845: requesting an HTTP byte range doesn't work Index: test_urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib2.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_urllib2.py 31 May 2004 18:22:40 -0000 1.13 --- test_urllib2.py 29 Jun 2004 13:15:46 -0000 1.14 *************** *** 671,683 **** self.assert_(False) def test_main(verbose=None): from test import test_sets ! test_support.run_unittest( ! TrivialTests, ! OpenerDirectorTests, ! HandlerTests, ! MiscTests, ! ) if __name__ == "__main__": --- 671,693 ---- self.assert_(False) + class NetworkTests(unittest.TestCase): + def test_range (self): + req = urllib2.Request("http://www.python.org", + headers={'Range': 'bytes=20-39'}) + result = urllib2.urlopen(req) + data = result.read() + self.assertEqual(len(data), 20) + + def test_main(verbose=None): from test import test_sets ! tests = (TrivialTests, ! OpenerDirectorTests, ! HandlerTests, ! MiscTests) ! if test_support.is_resource_enabled('network'): ! tests += (NetworkTests,) ! test_support.run_unittest(*tests) if __name__ == "__main__": From akuchling at users.sourceforge.net Tue Jun 29 09:17:32 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Jun 29 09:17:35 2004 Subject: [Python-checkins] python/dist/src/Lib/test test_urllib2.py, 1.14, 1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14870 Modified Files: test_urllib2.py Log Message: Remove unused import. (If it's there for some deep, dark reason, it should have been commented.) Index: test_urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib2.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_urllib2.py 29 Jun 2004 13:15:46 -0000 1.14 --- test_urllib2.py 29 Jun 2004 13:17:29 -0000 1.15 *************** *** 682,686 **** def test_main(verbose=None): - from test import test_sets tests = (TrivialTests, OpenerDirectorTests, --- 682,685 ---- From akuchling at users.sourceforge.net Tue Jun 29 09:19:31 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Jun 29 09:19:34 2004 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15318 Modified Files: urllib2.py Log Message: [Bug #912845] urllib2 only checks for a 200 return code, but 206 is also legal if a Range: header was supplied. (Actually, should the first 'if' statement be modified to allow any 2xx status code?) Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** urllib2.py 7 Jun 2004 03:49:50 -0000 1.68 --- urllib2.py 29 Jun 2004 13:19:19 -0000 1.69 *************** *** 469,473 **** code, msg, hdrs = response.code, response.msg, response.info() ! if code != 200: response = self.parent.error( 'http', request, response, code, msg, hdrs) --- 469,473 ---- code, msg, hdrs = response.code, response.msg, response.info() ! if code not in (200, 206): response = self.parent.error( 'http', request, response, code, msg, hdrs) *************** *** 997,1001 **** raise URLError(err) ! if r.status == 200: # Pick apart the HTTPResponse object to get the addinfourl # object initialized properly --- 997,1001 ---- raise URLError(err) ! if r.status in (200, 206): # Pick apart the HTTPResponse object to get the addinfourl # object initialized properly From akuchling at users.sourceforge.net Tue Jun 29 09:35:11 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Jun 29 09:35:15 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libsha.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18837 Modified Files: libsha.tex Log Message: [Bug #978556] Update SHA spec URL; bugfix candidate Index: libsha.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsha.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libsha.tex 15 Sep 2003 18:20:52 -0000 1.11 --- libsha.tex 29 Jun 2004 13:35:01 -0000 1.12 *************** *** 68,80 **** \begin{seealso} ! \seetitle[http://csrc.nist.gov/publications/fips/fips180-1/fip180-1.txt] {Secure Hash Standard} {The Secure Hash Algorithm is defined by NIST document FIPS ! PUB 180-1: ! \citetitle[http://csrc.nist.gov/publications/fips/fips180-1/fip180-1.txt] ! {Secure Hash Standard}, published in April of 1995. It is ! available online as plain text (at least one diagram was ! omitted) and as PDF at ! \url{http://csrc.nist.gov/publications/fips/fips180-1/fip180-1.pdf}.} \seetitle[http://csrc.nist.gov/encryption/tkhash.html] --- 68,77 ---- \begin{seealso} ! \seetitle[http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf] {Secure Hash Standard} {The Secure Hash Algorithm is defined by NIST document FIPS ! PUB 180-2: ! \citetitle[http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf] ! {Secure Hash Standard}, published in August 2002.} \seetitle[http://csrc.nist.gov/encryption/tkhash.html] *************** *** 82,83 **** --- 79,81 ---- {Links from NIST to various information on secure hashing.} \end{seealso} + From akuchling at users.sourceforge.net Tue Jun 29 09:52:18 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Jun 29 09:52:22 2004 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21982 Modified Files: exceptions.tex Log Message: [Bug #948970] Add PyExc_* symbols to index. (I ran this through texcheck, but don't have LaTeX installed on this machine and therefore haven't verified that the changes are accepted by LaTeX.) Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** exceptions.tex 12 May 2004 03:20:37 -0000 1.18 --- exceptions.tex 29 Jun 2004 13:52:14 -0000 1.19 *************** *** 346,377 **** \begin{tableiii}{l|l|c}{cdata}{C Name}{Python Name}{Notes} ! \lineiii{PyExc_Exception}{\exception{Exception}}{(1)} ! \lineiii{PyExc_StandardError}{\exception{StandardError}}{(1)} ! \lineiii{PyExc_ArithmeticError}{\exception{ArithmeticError}}{(1)} ! \lineiii{PyExc_LookupError}{\exception{LookupError}}{(1)} ! \lineiii{PyExc_AssertionError}{\exception{AssertionError}}{} ! \lineiii{PyExc_AttributeError}{\exception{AttributeError}}{} ! \lineiii{PyExc_EOFError}{\exception{EOFError}}{} ! \lineiii{PyExc_EnvironmentError}{\exception{EnvironmentError}}{(1)} ! \lineiii{PyExc_FloatingPointError}{\exception{FloatingPointError}}{} ! \lineiii{PyExc_IOError}{\exception{IOError}}{} ! \lineiii{PyExc_ImportError}{\exception{ImportError}}{} ! \lineiii{PyExc_IndexError}{\exception{IndexError}}{} ! \lineiii{PyExc_KeyError}{\exception{KeyError}}{} ! \lineiii{PyExc_KeyboardInterrupt}{\exception{KeyboardInterrupt}}{} ! \lineiii{PyExc_MemoryError}{\exception{MemoryError}}{} ! \lineiii{PyExc_NameError}{\exception{NameError}}{} ! \lineiii{PyExc_NotImplementedError}{\exception{NotImplementedError}}{} ! \lineiii{PyExc_OSError}{\exception{OSError}}{} ! \lineiii{PyExc_OverflowError}{\exception{OverflowError}}{} ! \lineiii{PyExc_ReferenceError}{\exception{ReferenceError}}{(2)} ! \lineiii{PyExc_RuntimeError}{\exception{RuntimeError}}{} ! \lineiii{PyExc_SyntaxError}{\exception{SyntaxError}}{} ! \lineiii{PyExc_SystemError}{\exception{SystemError}}{} ! \lineiii{PyExc_SystemExit}{\exception{SystemExit}}{} ! \lineiii{PyExc_TypeError}{\exception{TypeError}}{} ! \lineiii{PyExc_ValueError}{\exception{ValueError}}{} ! \lineiii{PyExc_WindowsError}{\exception{WindowsError}}{(3)} ! \lineiii{PyExc_ZeroDivisionError}{\exception{ZeroDivisionError}}{} \end{tableiii} --- 346,377 ---- \begin{tableiii}{l|l|c}{cdata}{C Name}{Python Name}{Notes} ! \lineiii{PyExc_Exception\ttindex{PyExc_Exception}}{\exception{Exception}}{(1)} ! \lineiii{PyExc_StandardError\ttindex{PyExc_StandardError}}{\exception{StandardError}}{(1)} ! \lineiii{PyExc_ArithmeticError\ttindex{PyExc_ArithmeticError}}{\exception{ArithmeticError}}{(1)} ! \lineiii{PyExc_LookupError\ttindex{PyExc_LookupError}}{\exception{LookupError}}{(1)} ! \lineiii{PyExc_AssertionError\ttindex{PyExc_AssertionError}}{\exception{AssertionError}}{} ! \lineiii{PyExc_AttributeError\ttindex{PyExc_AttributeError}}{\exception{AttributeError}}{} ! \lineiii{PyExc_EOFError\ttindex{PyExc_EOFError}}{\exception{EOFError}}{} ! \lineiii{PyExc_EnvironmentError\ttindex{PyExc_EnvironmentError}}{\exception{EnvironmentError}}{(1)} ! \lineiii{PyExc_FloatingPointError\ttindex{PyExc_FloatingPointError}}{\exception{FloatingPointError}}{} ! \lineiii{PyExc_IOError\ttindex{PyExc_IOError}}{\exception{IOError}}{} ! \lineiii{PyExc_ImportError\ttindex{PyExc_ImportError}}{\exception{ImportError}}{} ! \lineiii{PyExc_IndexError\ttindex{PyExc_IndexError}}{\exception{IndexError}}{} ! \lineiii{PyExc_KeyError\ttindex{PyExc_KeyError}}{\exception{KeyError}}{} ! \lineiii{PyExc_KeyboardInterrupt\ttindex{PyExc_KeyboardInterrupt}}{\exception{KeyboardInterrupt}}{} ! \lineiii{PyExc_MemoryError\ttindex{PyExc_MemoryError}}{\exception{MemoryError}}{} ! \lineiii{PyExc_NameError\ttindex{PyExc_NameError}}{\exception{NameError}}{} ! \lineiii{PyExc_NotImplementedError\ttindex{PyExc_NotImplementedError}}{\exception{NotImplementedError}}{} ! \lineiii{PyExc_OSError\ttindex{PyExc_OSError}}{\exception{OSError}}{} ! \lineiii{PyExc_OverflowError\ttindex{PyExc_OverflowError}}{\exception{OverflowError}}{} ! \lineiii{PyExc_ReferenceError\ttindex{PyExc_ReferenceError}}{\exception{ReferenceError}}{(2)} ! \lineiii{PyExc_RuntimeError\ttindex{PyExc_RuntimeError}}{\exception{RuntimeError}}{} ! \lineiii{PyExc_SyntaxError\ttindex{PyExc_SyntaxError}}{\exception{SyntaxError}}{} ! \lineiii{PyExc_SystemError\ttindex{PyExc_SystemError}}{\exception{SystemError}}{} ! \lineiii{PyExc_SystemExit\ttindex{PyExc_SystemExit}}{\exception{SystemExit}}{} ! \lineiii{PyExc_TypeError\ttindex{PyExc_TypeError}}{\exception{TypeError}}{} ! \lineiii{PyExc_ValueError\ttindex{PyExc_ValueError}}{\exception{ValueError}}{} ! \lineiii{PyExc_WindowsError\ttindex{PyExc_WindowsError}}{\exception{WindowsError}}{(3)} ! \lineiii{PyExc_ZeroDivisionError\ttindex{PyExc_ZeroDivisionError}}{\exception{ZeroDivisionError}}{} \end{tableiii} From akuchling at users.sourceforge.net Tue Jun 29 10:03:07 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Jun 29 10:03:10 2004 Subject: [Python-checkins] python/dist/src/Parser acceler.c,2.20,2.21 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24357/Parser Modified Files: acceler.c Log Message: [Patch #974633] Check PyObject_MALLOC return for error Index: acceler.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/acceler.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** acceler.c 19 Nov 2003 15:24:46 -0000 2.20 --- acceler.c 29 Jun 2004 14:03:04 -0000 2.21 *************** *** 70,73 **** --- 70,77 ---- s->s_accept = 0; accel = (int *) PyObject_MALLOC(nl * sizeof(int)); + if (accel == NULL) { + fprintf(stderr, "no mem to build parser accelerators\n"); + exit(1); + } for (k = 0; k < nl; k++) accel[k] = -1; From akuchling at users.sourceforge.net Tue Jun 29 10:03:06 2004 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Jun 29 10:03:15 2004 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.268,1.269 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24357/Misc Modified Files: ACKS Log Message: [Patch #974633] Check PyObject_MALLOC return for error Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.268 retrieving revision 1.269 diff -C2 -d -r1.268 -r1.269 *** ACKS 25 Jun 2004 22:20:33 -0000 1.268 --- ACKS 29 Jun 2004 14:03:04 -0000 1.269 *************** *** 144,147 **** --- 144,148 ---- Walter Dörwald Jaromir Dolecek + Dima Dorfman Cesar Douady Dean Draayer From fdrake at acm.org Tue Jun 29 10:35:53 2004 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Tue Jun 29 10:36:33 2004 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex, 1.18, 1.19 In-Reply-To: References: Message-ID: <200406291035.53295.fdrake@acm.org> On Tuesday 29 June 2004 09:52 am, akuchling@users.sourceforge.net wrote: > [Bug #948970] Add PyExc_* symbols to index. > (I ran this through texcheck, but don't have LaTeX installed on this > machine and therefore haven't verified that the changes are accepted by > LaTeX.) Thanks; this works just fine. -Fred -- Fred L. Drake, Jr. From fdrake at users.sourceforge.net Tue Jun 29 10:39:09 2004 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Jun 29 10:39:13 2004 Subject: [Python-checkins] python/dist/src/Doc/tools push-docs.sh,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv738 Modified Files: push-docs.sh Log Message: fix handling when a proper getopt(1) is available; the "--" end-of-options marker wasn't recognized Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** push-docs.sh 17 Jun 2004 22:04:17 -0000 1.18 --- push-docs.sh 29 Jun 2004 14:39:06 -0000 1.19 *************** *** 62,65 **** --- 62,69 ---- shift 2 ;; + --) + shift 1 + break + ;; -*) echo "Unknown option: $1" >&2 From rhettinger at users.sourceforge.net Tue Jun 29 16:49:53 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 29 16:49:57 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.25, 1.26 test_Decimal.py, 1.20, 1.21 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14187 Modified Files: Decimal.py test_Decimal.py Log Message: * Remove from_float() from the API * copy and deepcopy produce new instances for subclasses * use assertRaises instead of try/except in tests Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Decimal.py 29 Jun 2004 10:08:35 -0000 1.25 --- Decimal.py 29 Jun 2004 20:49:50 -0000 1.26 *************** *** 394,399 **** Decimal instance long, int - - To construct from float, use Decimal.from_float(float_value) """ if context is None: --- 394,397 ---- *************** *** 472,509 **** return - if isinstance(value, float): - raise TypeError("Can't convert " + repr(value) + - ". Try Decimal.from_float() instead.") - raise TypeError("Can't convert %r" % value) - def from_float(cls, value, positions=None): - """Class method that creates Decimal from float - - value must be float - if positions is present, rounds to that quantity of decimal places - """ - if not isinstance(value, float): - raise TypeError, "value must be float in Decimal.from_float(value, [positions])" - - # get the *very* exact string representation of the float - string_number = _floatToString(value) - d = cls(string_number) - - # round up to positions - if positions is not None: - if not isinstance(positions, (int,long)): - raise TypeError, "positions must be int or long in Decimal.from_float(value, [positions])" - if positions < 0: - raise TypeError, "positions must be not negative in Decimal.from_float(value, [positions])" - - # we must know what precision to pass to round - int_positions = len(d._int) + d._exp - real_decimal_positions = positions + int_positions - d = d._round(real_decimal_positions, ROUND_HALF_UP) - - return d - from_float = classmethod(from_float) - def _convert_other(self, other): """Convert other to Decimal. --- 470,475 ---- *************** *** 2096,2103 **** def __copy__(self): ! return self # I'm immutable; therefore I am my own clone def __deepcopy__(self, memo): ! return self # My components are also immutable --- 2062,2073 ---- def __copy__(self): ! if type(self) == Decimal: ! return self # I'm immutable; therefore I am my own clone ! return self.__class__(str(self)) def __deepcopy__(self, memo): ! if type(self) == Decimal: ! return self # My components are also immutable ! return self.__class__(str(self)) *************** *** 2240,2247 **** def create_decimal(self, num): """Creates a new Decimal instance but using self as context.""" ! if isinstance(num, float): ! d = Decimal.from_float(num) ! else: ! d = Decimal(num, context=self) return d._fix(context=self) --- 2210,2214 ---- def create_decimal(self, num): """Creates a new Decimal instance but using self as context.""" ! d = Decimal(num, context=self) return d._fix(context=self) Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_Decimal.py 29 Jun 2004 10:08:35 -0000 1.20 --- test_Decimal.py 29 Jun 2004 20:49:51 -0000 1.21 *************** *** 516,559 **** self.assertEqual(str(d), '4.5E+3') #just not a number d = Decimal('ugly') self.assertEqual(str(d), 'NaN') - def test_from_float(self): - '''Explicit construction with float.''' - - #positive integer - d = Decimal.from_float(45.0) - self.assertEqual(str(d), '45') - - #negative integer - d = Decimal.from_float(-32.0) - self.assertEqual(str(d), '-32') - - #zero - d = Decimal.from_float(0.0) - self.assertEqual(str(d), '0') - - #empty - self.assertRaises(TypeError, Decimal.from_float) - - #with a string - self.assertRaises(TypeError, Decimal.from_float, '') - - #with an int - self.assertRaises(TypeError, Decimal.from_float, 5) - - #inexact float, without positions - d = Decimal.from_float(2.2) - self.assertEqual(str(d), '2.20000000000000017763568394002504646778106689453125') - - #inexact float, rounded to some positions - d = Decimal.from_float(2.2, 16) - self.assertEqual(str(d), '2.2000000000000002') - - #inexact float, rounded to less positions - d = Decimal.from_float(2.2, 5) - self.assertEqual(str(d), '2.20000') - def test_from_tuples(self): '''Explicit construction with tuples.''' --- 516,524 ---- self.assertEqual(str(d), '4.5E+3') + # XXX this should raise a ValueError for an invalid literal #just not a number d = Decimal('ugly') self.assertEqual(str(d), 'NaN') def test_from_tuples(self): '''Explicit construction with tuples.''' *************** *** 637,646 **** self.assertEqual(str(d), '4.57E+5') - # from float - d = Decimal.from_float(1.1) - self.assertEqual(str(d), '1.100000000000000088817841970012523233890533447265625') - d = nc.create_decimal(1.1) - self.assertEqual(str(d), '1.10') - # from tuples d = Decimal( (1, (4, 3, 4, 9, 1, 3, 5, 3, 4), -25) ) --- 602,605 ---- *************** *** 663,722 **** '''Implicit construction with None.''' ! d = Decimal(5) ! try: ! d + None ! except TypeError: ! pass ! else: ! self.fail('Did not raised an error!') def test_from_int(self): '''Implicit construction with int or long.''' - d = Decimal(5) #normal ! e = d + 45 ! self.assertEqual(str(e), '50') #exceeding precision ! try: ! d + 123456789000 ! except ValueError: ! pass ! else: ! self.fail('Did not raised an error!') def test_from_string(self): '''Implicit construction with string.''' - d = Decimal(5) #just any string ! try: ! d + '3' ! except TypeError: ! pass ! else: ! self.fail('Did not raised an error!') def test_from_float(self): '''Implicit construction with float.''' - d = Decimal(5) #just any float ! try: ! d + 2.2 ! except TypeError: ! pass ! else: ! self.fail('Did not raised an error!') def test_from_Decimal(self): '''Implicit construction with Decimal.''' ! d = Decimal(5) ! ! #any Decimal ! e = d + Decimal(45) ! self.assertEqual(str(e), '50') --- 622,652 ---- '''Implicit construction with None.''' ! self.assertRaises(TypeError, eval, 'Decimal(5) + None', globals()) def test_from_int(self): '''Implicit construction with int or long.''' #normal ! self.assertEqual(str(Decimal(5) + 45), '50') #exceeding precision ! self.assertRaises(ValueError, eval, 'Decimal(5) + 123456789000', globals()) def test_from_string(self): '''Implicit construction with string.''' #just any string ! self.assertRaises(TypeError, eval, 'Decimal(5) + "3"', globals()) def test_from_float(self): '''Implicit construction with float.''' #just any float ! self.assertRaises(TypeError, eval, 'Decimal(5) + 2.2', globals()) def test_from_Decimal(self): '''Implicit construction with Decimal.''' ! self.assertEqual(Decimal(5) + Decimal(45), Decimal(50)) *************** *** 1281,1288 **** test_classes = [] ! if which == "Arithmetic" or which is None: test_classes.extend([DecimalTest]) ! if which == "Behaviour" or which is None: test_classes.extend([ DecimalExplicitConstructionTest, --- 1211,1218 ---- test_classes = [] ! if which is None or which.lower().startswith("arith"): test_classes.extend([DecimalTest]) ! if which is None or which.lower().startswith("behav"): test_classes.extend([ DecimalExplicitConstructionTest, From rhettinger at users.sourceforge.net Tue Jun 29 21:06:05 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 29 21:06:10 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.26, 1.27 test_Decimal.py, 1.21, 1.22 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv864 Modified Files: Decimal.py test_Decimal.py Log Message: Neaten up the code a bit Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Decimal.py 29 Jun 2004 20:49:50 -0000 1.26 --- Decimal.py 30 Jun 2004 01:06:02 -0000 1.27 *************** *** 15,18 **** --- 15,19 ---- # Add an __all__ attribute # Improve docstrings and add more doctests + # Improve the Context API """ *************** *** 545,550 **** self._sign, self._int, self._exp = _string2exact(value) except ValueError: ! self._sign, self._int, self._exp = \ ! context._raise_error(ConversionSyntax) return --- 546,550 ---- self._sign, self._int, self._exp = _string2exact(value) except ValueError: ! self._sign, self._int, self._exp = context._raise_error(ConversionSyntax) return *************** *** 2572,2578 **** NaN = Decimal('NaN') - # Code ripped more-or-less directly from FixedPoint.py - # _floatToString modified by Tim Peters to give exact results - # crud for parsing strings import re --- 2572,2575 ---- *************** *** 2604,2608 **** m = _parser(s) if m is None: ! raise ValueError("Can't parse as number: %r" % s) if m.group('sign') == "-": --- 2601,2605 ---- m = _parser(s) if m is None: ! raise ValueError("invalid literal for Decimal: %r" % s) if m.group('sign') == "-": *************** *** 2642,2713 **** return (sign, mantissa, exp) - - - def _floatToString(x): - """Return float x as exact decimal string. - - The string is of the form: - "-", if and only if x is < 0. - One or more decimal digits. The last digit is not 0 unless x is 0. - "e" - The exponent, a (possibly signed) integer - """ - - import math - - if x == 0: - return "0e0" - - sign = "" - if x < 0: - sign = "-" - x = -x - - f, e = math.frexp(x) - assert 0.5 <= f < 1.0 - # x = f * 2**e exactly - - # Suck up CHUNK bits at a time; 28 is enough so that we suck - # up all bits in 2 iterations for all known binary double- - # precision formats, and small enough to fit in an int. - CHUNK = 28 - top = 0L - # invariant: x = (top + f) * 2**e exactly - while f: - f = math.ldexp(f, CHUNK) - digit = int(f) - assert digit >> CHUNK == 0 - top = (top << CHUNK) | digit - f -= digit - assert 0.0 <= f < 1.0 - e -= CHUNK - - assert top > 0 - - # Now x = top * 2**e exactly. Get rid of trailing 0 bits if e < 0 - # (purely to increase efficiency a little later -- this loop can - # be removed without changing the result). - while e < 0 and top & 1 == 0: - top >>= 1 - e += 1 - - # Transform this into an equal value top' * 10**e'. - if e > 0: - top <<= e - e = 0 - elif e < 0: - # Exact is top/2**-e. Multiply top and bottom by 5**-e to - # get top*5**-e/10**-e = top*5**-e * 10**e - top = top * 5**-e - - # Nuke trailing (decimal) zeroes. - while 1: - assert top > 0 - newtop, rem = divmod(top, 10) - if rem: - break - top = newtop - e += 1 - - return "%s%se%d" % (sign, str(top), e) - --- 2639,2640 ---- Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** test_Decimal.py 29 Jun 2004 20:49:51 -0000 1.21 --- test_Decimal.py 30 Jun 2004 01:06:02 -0000 1.22 *************** *** 15,18 **** --- 15,22 ---- test the pythonic behaviour according to PEP 327. + Cowlishaw's tests can be downloaded from: + + www2.hursley.ibm.com/decimal/dectest.zip + This test module can be called from command line with one parameter (Arithmetic or Behaviour) to test each part, or without parameter to test both parts. If *************** *** 283,416 **** def test_abs(self): - """Tests the Decimal class on Cowlishaw's abs tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'abs' + '.decTest') def test_add(self): - """Tests the Decimal class on Cowlishaw's add tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'add' + '.decTest') def test_base(self): - """Tests the Decimal class on Cowlishaw's base tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'base' + '.decTest') def test_clamp(self): - """Tests the Decimal class on Cowlishaw's clamp tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'clamp' + '.decTest') def test_compare(self): - """Tests the Decimal class on Cowlishaw's compare tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'compare' + '.decTest') def test_divide(self): - """Tests the Decimal class on Cowlishaw's divide tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'divide' + '.decTest') def test_divideint(self): - """Tests the Decimal class on Cowlishaw's divideint tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'divideint' + '.decTest') def test_inexact(self): - """Tests the Decimal class on Cowlishaw's inexact tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'inexact' + '.decTest') def test_max(self): - """Tests the Decimal class on Cowlishaw's max tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'max' + '.decTest') def test_min(self): - """Tests the Decimal class on Cowlishaw's min tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'min' + '.decTest') def test_minus(self): - """Tests the Decimal class on Cowlishaw's minus tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'minus' + '.decTest') def test_multiply(self): - """Tests the Decimal class on Cowlishaw's multiply tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir+'multiply'+'.decTest') def test_normalize(self): - """Tests the Decimal class on Cowlishaw's normalize tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'normalize' + '.decTest') def test_plus(self): - """Tests the Decimal class on Cowlishaw's plus tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'plus' + '.decTest') def test_power(self): - """Tests the Decimal class on Cowlishaw's power tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'power' + '.decTest') def test_quantize(self): - """Tests the Decimal class on Cowlishaw's quantize tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'quantize' + '.decTest') def test_randomBound32(self): - """Tests the Decimal class on Cowlishaw's randomBound32 tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'randomBound32' + '.decTest') def test_randoms(self): - """Tests the Decimal class on Cowlishaw's randoms tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'randoms' + '.decTest') def test_remainder(self): - """Tests the Decimal class on Cowlishaw's remainder tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'remainder' + '.decTest') --- 287,344 ---- *************** *** 423,469 **** def test_rounding(self): - """Tests the Decimal class on Cowlishaw's rounding tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'rounding' + '.decTest') def test_samequantum(self): - """Tests the Decimal class on Cowlishaw's samequantum tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'samequantum' + '.decTest') def test_squareroot(self): - """Tests the Decimal class on Cowlishaw's squareroot tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'squareroot' + '.decTest') def test_subtract(self): - """Tests the Decimal class on Cowlishaw's subtract tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'subtract' + '.decTest') def test_tointegral(self): - """Tests the Decimal class on Cowlishaw's tointegral tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'tointegral' + '.decTest') ! # # The following classes test the behaviour of Decimal according to PEP 327 ! # ! # - Explicit Construction ! # - Implicit Construction ! # - Arithmetic Operators ! # - Use of Context ! # - Usability ! # class DecimalExplicitConstructionTest(unittest.TestCase): --- 351,371 ---- def test_rounding(self): self.eval_file(dir + 'rounding' + '.decTest') def test_samequantum(self): self.eval_file(dir + 'samequantum' + '.decTest') def test_squareroot(self): self.eval_file(dir + 'squareroot' + '.decTest') def test_subtract(self): self.eval_file(dir + 'subtract' + '.decTest') def test_tointegral(self): self.eval_file(dir + 'tointegral' + '.decTest') ! # The following classes test the behaviour of Decimal according to PEP 327 ! class DecimalExplicitConstructionTest(unittest.TestCase): *************** *** 501,523 **** #empty ! d = Decimal('') ! self.assertEqual(str(d), 'NaN') #int ! d = Decimal('45') ! self.assertEqual(str(d), '45') #float ! d = Decimal('45.34') ! self.assertEqual(str(d), '45.34') #engineer notation ! d = Decimal('45e2') ! self.assertEqual(str(d), '4.5E+3') - # XXX this should raise a ValueError for an invalid literal #just not a number ! d = Decimal('ugly') ! self.assertEqual(str(d), 'NaN') def test_from_tuples(self): --- 403,419 ---- #empty ! self.assertEqual(str(Decimal('')), 'NaN') #int ! self.assertEqual(str(Decimal('45')), '45') #float ! self.assertEqual(str(Decimal('45.34')), '45.34') #engineer notation ! self.assertEqual(str(Decimal('45e2')), '4.5E+3') #just not a number ! self.assertEqual(str(Decimal('ugly')), 'NaN') def test_from_tuples(self): From rhettinger at users.sourceforge.net Tue Jun 29 23:37:15 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Jun 29 23:37:19 2004 Subject: [Python-checkins] python/nondist/peps pep-0327.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24012 Modified Files: pep-0327.txt Log Message: Update the PEP to reflect the most recent decisions about interactions with binary floating point. Also document the rationale for the decisions. Index: pep-0327.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0327.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pep-0327.txt 16 Jun 2004 14:27:00 -0000 1.3 --- pep-0327.txt 30 Jun 2004 03:37:13 -0000 1.4 *************** *** 551,554 **** --- 551,581 ---- Decimal.from_float(1.1): The same as doing Decimal('1100000000000000088817841970012523233890533447265625e-51'). + Based on later discussions, it was decided to omit from_float() from the + API for Py2.4. Several ideas contributed to the thought process: + + - Interactions between decimal and binary floating point force the user to + deal with tricky issues of representation and round-off. Avoidance of those + issues is a primary reason for having the module in the first place. + + - The first release of the module should focus on that which is safe, minimal, + and essential. + + - While theoretically nice, real world use cases for interactions between + and decimals are lacking. Java included float/decimal conversions to handle + an obscure case where calculations are best performed in decimal eventhough + a legacy data structure requires the inputs and outputs to be stored in + binary floating point. + + - If the need arises, users can use string representations as an intermediate + type. The advantage of this approach is that it makes explicit the + assumptions about precision and representation (no wondering what is going + on under the hood). + + - The Java docs for BigDecimal(double val) reflected their experiences with + the constructor:: + + The results of this constructor can be somewhat + unpredictable and its use is generally not recommended. + From tuples *************** *** 723,732 **** accuracy, and range than float. ! But in Python it's OK to do ``35 + 1.1``, so why can't I do ! ``Decimal(35) + 1.1``? We agree that when a naive user writes ``1.1`` ! doesn't know that he's being inexact, but that happens in the both ! examples I just mentioned. ! So, what should we do? I propose to allow the interaction with float, making an exact conversion and raising ValueError if exceeds the precision in the current context (this is maybe too tricky, because --- 750,762 ---- accuracy, and range than float. ! The example of the valid python expression, ``35 + 1.1``, seems to suggest ! that ``Decimal(35) + 1.1`` should also be valid. However, a closer look ! shows that it only demonstrates the feasibility of integer to floating ! point conversions. Hence, the correct analog for decimal floating point ! is ``35 + Decimal(1.1)``. Both coercions, int-to-float and int-to-Decimal, ! can be done without incurring representation error. ! The question of how to coerce between binary and decimal floating point ! is more complex. I proposed allowing the interaction with float, making an exact conversion and raising ValueError if exceeds the precision in the current context (this is maybe too tricky, because From rhettinger at users.sourceforge.net Wed Jun 30 00:22:56 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Jun 30 00:23:01 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.27, 1.28 test_Decimal.py, 1.22, 1.23 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28773 Modified Files: Decimal.py test_Decimal.py Log Message: The decimal constructor for integer arguments now converts integer input to a string and then applies the usual "to-number" rules. * restores the domain to include all possible integer inputs between the under and overflow limits * Makes sure that Decimal(12345)==Decimal('12345') even when the precision is only three. * Makes sure that integer handling honors the spirit of the to-number rules. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Decimal.py 30 Jun 2004 01:06:02 -0000 1.27 --- Decimal.py 30 Jun 2004 04:22:54 -0000 1.28 *************** *** 399,402 **** --- 399,405 ---- context = getcontext() + if isinstance(value, (int,long)): + value = str(value) + # String? # REs insist on real strings, so we can too. *************** *** 427,440 **** return - ### XXX Hmm, with precision=3, Decimal(12345) fails with Decimal('12345') works - if isinstance(value, (int,long)): - # checking that the int or long doesn't exceed precision - max_int = 10 ** context.prec - if value > max_int: - raise ValueError, "Exceeded precision: use a smaller int or a Decimal with more precision" - # converting it - self._convertString(str(value), context) - return - # tuple/list conversion (possibly from as_tuple()) if isinstance(value, (list,tuple)): --- 430,433 ---- Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test_Decimal.py 30 Jun 2004 01:06:02 -0000 1.22 --- test_Decimal.py 30 Jun 2004 04:22:54 -0000 1.23 *************** *** 191,195 **** conglomerate = '' quote = 0 ! theirexceptions = map(lambda x: ErrorNames[x.lower()], exceptions) for exception in ExceptionList: --- 191,195 ---- conglomerate = '' quote = 0 ! theirexceptions = [ErrorNames[x.lower()] for x in exceptions] for exception in ExceptionList: *************** *** 490,494 **** d = nc.create_decimal(456) self.failUnless(isinstance(d, Decimal)) ! self.assertRaises(ValueError, nc.create_decimal, 45678) # from string --- 490,495 ---- d = nc.create_decimal(456) self.failUnless(isinstance(d, Decimal)) ! self.assertEqual(nc.create_decimal(45678), ! nc.create_decimal('457E+2')) # from string *************** *** 527,531 **** #exceeding precision ! self.assertRaises(ValueError, eval, 'Decimal(5) + 123456789000', globals()) def test_from_string(self): --- 528,532 ---- #exceeding precision ! self.assertEqual(Decimal(5) + 123456789000, Decimal(123456789000)) def test_from_string(self): From rhettinger at users.sourceforge.net Wed Jun 30 00:46:49 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Jun 30 00:46:52 2004 Subject: [Python-checkins] python/nondist/peps pep-0327.txt,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1202 Modified Files: pep-0327.txt Log Message: Update to reflect the equivalence: Decimal(12345)==Decimal('12345') where the precision is three Index: pep-0327.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0327.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pep-0327.txt 30 Jun 2004 03:37:13 -0000 1.4 --- pep-0327.txt 30 Jun 2004 04:46:47 -0000 1.5 *************** *** 729,736 **** '''''''''''''''' ! Aahz suggested the need of an explicit conversion from int, but also ! thinks it's OK if the precision in the current Context is not ! exceeded; in that case you raise ValueError. Votes in ! comp.lang.python agreed with this. --- 729,739 ---- '''''''''''''''' ! An int or long is a treated like a Decimal explicitly constructed from ! Decimal(str(x)) in the current context (meaning that the to-string rules ! for rounding are applied and the appropriate flags are set). This ! guarantees that expressions like ``Decimal('1234567') + 13579`` match ! the mental model of ``Decimal('1234567') + Decimal('13579')``. That ! model works because all integers are representable as strings without ! representation error. From rhettinger at users.sourceforge.net Wed Jun 30 01:38:27 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Jun 30 01:38:30 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.28, 1.29 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7869 Modified Files: Decimal.py Log Message: Part I: Add docstrings and doctests adapted from the spec. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Decimal.py 30 Jun 2004 04:22:54 -0000 1.28 --- Decimal.py 30 Jun 2004 05:38:25 -0000 1.29 *************** *** 1,3 **** ! # Copyright (c) 2004 Python Software Foundation. # All rights reserved. --- 1,3 ---- ! # Copyright (c) 2004 Python Software Foundation. # All rights reserved. *************** *** 2216,2236 **** --- 2216,2364 ---- return a.compare(b, context=self) def divide(self, a, b): + """Decimal division in a specified context. + + >>> Context(prec=9).divide(Decimal('1'), Decimal('3')) + Decimal("0.333333333") + >>> Context(prec=9).divide(Decimal('2'), Decimal('3')) + Decimal("0.666666667") + >>> Context(prec=9).divide(Decimal('5'), Decimal('2')) + Decimal("2.5") + >>> Context(prec=9).divide(Decimal('1'), Decimal('10')) + Decimal("0.1") + >>> Context(prec=9).divide(Decimal('12'), Decimal('12')) + Decimal("1") + >>> Context(prec=9).divide(Decimal('8.00'), Decimal('2')) + Decimal("4.00") + >>> Context(prec=9).divide(Decimal('2.400'), Decimal('2.0')) + Decimal("1.20") + >>> Context(prec=9).divide(Decimal('1000'), Decimal('100')) + Decimal("10") + >>> Context(prec=9).divide(Decimal('1000'), Decimal('1')) + Decimal("1000") + >>> Context(prec=9).divide(Decimal('2.40E+6'), Decimal('2')) + Decimal("1.20E+6") + """ return a.__div__(b, context=self) + def divide_int(self, a, b): + """Divides two numbers and returns the integer part of the result. + + >>> Context(prec=9).divide_int(Decimal('2'), Decimal('3')) + Decimal("0") + >>> Context(prec=9).divide_int(Decimal('10'), Decimal('3')) + Decimal("3") + >>> Context(prec=9).divide_int(Decimal('1'), Decimal('0.3')) + Decimal("3") + """ return a.__floordiv__(b, context=self) + def divmod(self, a, b): return a.__divmod__(b, context=self) def max(self, a,b): + """max compares two values numerically and returns the maximum. + + If either operand is a NaN then the general rules apply. + Otherwise, the operands are compared as as though by the compare + operation. If they are numerically equal then the left-hand operand + is chosen as the result. Otherwise the maximum (closer to positive + infinity) of the two operands is chosen as the result. + + >>> Context(prec=9).max(Decimal('3'), Decimal('2')) + Decimal("3") + >>> Context(prec=9).max(Decimal('-10'), Decimal('3')) + Decimal("3") + >>> Context(prec=9).max(Decimal('1.0'), Decimal('1')) + Decimal("1.0") + """ return a.max(b, context=self) + def min(self, a,b): + """min compares two values numerically and returns the minimum. + + If either operand is a NaN then the general rules apply. + Otherwise, the operands are compared as as though by the compare + operation. If they are numerically equal then the left-hand operand + is chosen as the result. Otherwise the minimum (closer to negative + infinity) of the two operands is chosen as the result. + + >>> Context(prec=9).min(Decimal('3'), Decimal('2')) + Decimal("2") + >>> Context(prec=9).min(Decimal('-10'), Decimal('3')) + Decimal("-10") + >>> Context(prec=9).min(Decimal('1.0'), Decimal('1')) + Decimal("1.0") + """ return a.min(b, context=self) + def minus(self, a): + """Minus corresponds to unary prefix minus in Python. + + The operation is evaluated using the same rules as subtract; the + operation minus(a) is calculated as subtract(’0’, a) where the ’0’ + has the same exponent as the operand. + + >>> Context(prec=9).minus(Decimal('1.3')) + Decimal("-1.3") + >>> Context(prec=9).minus(Decimal('-1.3')) + Decimal("1.3") + """ return a.__neg__(context=self) + def multiply(self, a, b): + """multiply multiplies two operands. + + If either operand is a special value then the general rules apply. + Otherwise, the operands are multiplied together (‘long multiplication’), + resulting in a number which may be as long as the sum of the lengths + of the two operands. + + >>> Context(prec=9).multiply(Decimal('1.20'), Decimal('3')) + Decimal("3.60") + >>> Context(prec=9).multiply(Decimal('7'), Decimal('3')) + Decimal("21") + >>> Context(prec=9).multiply(Decimal('0.9'), Decimal('0.8')) + Decimal("0.72") + >>> Context(prec=9).multiply(Decimal('0.9'), Decimal('-0')) + Decimal("-0.0") + >>> Context(prec=9).multiply(Decimal('654321'), Decimal('654321')) + Decimal("4.28135971E+11") + """ return a.__mul__(b, context=self) + def normalize(self, a): + """normalize reduces its operand to its simplest form. + + Essentially a plus operation with all trailing zeros removed from the + result. + + >>> Context(prec=9).normalize(Decimal('2.1')) + Decimal("2.1") + >>> Context(prec=9).normalize(Decimal('-2.0')) + Decimal("-2") + >>> Context(prec=9).normalize(Decimal('1.200')) + Decimal("1.2") + >>> Context(prec=9).normalize(Decimal('-120')) + Decimal("-1.2E+2") + >>> Context(prec=9).normalize(Decimal('120.00')) + Decimal("1.2E+2") + >>> Context(prec=9).normalize(Decimal('0.00')) + Decimal("0") + """ return a.normalize(context=self) + def plus(self, a): + """Plus corresponds to unary prefix plus in Python. + + The operation is evaluated using the same rules as add; the + operation plus(a) is calculated as add(’0’, a) where the ’0’ + has the same exponent as the operand. + + >>> Context(prec=9).plus(Decimal('1.3')) + Decimal("1.3") + >>> Context(prec=9).plus(Decimal('-1.3')) + Decimal("-1.3") + """ return a.__pos__(context=self) + def power(self, a, b, modulo=None): return a.__pow__(b, modulo, context=self) From rhettinger at users.sourceforge.net Wed Jun 30 03:19:24 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Jun 30 03:19:28 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.29, 1.30 test_Decimal.py, 1.23, 1.24 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22565 Modified Files: Decimal.py test_Decimal.py Log Message: * Part II: docstrings and doctests * removed Lost Digits which was unused Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Decimal.py 30 Jun 2004 05:38:25 -0000 1.29 --- Decimal.py 30 Jun 2004 07:19:21 -0000 1.30 *************** *** 297,304 **** return NaN - class LostDigits(DecimalException): - """Actually, this is not used for the extended version.""" - pass - class Rounded(DecimalException): """Number got rounded (not necessarily changed during rounding)""" --- 297,300 ---- *************** *** 2363,2372 **** def power(self, a, b, modulo=None): return a.__pow__(b, modulo, context=self) def remainder(self, a, b): return a.__mod__(b, context=self) def remainder_near(self, a, b): return a.remainder_near(b, context=self) ! def quantize(self, a, b): ! return a.quantize(b, context=self) def same_quantum(self, a, b): return a.same_quantum(b) --- 2359,2468 ---- def power(self, a, b, modulo=None): return a.__pow__(b, modulo, context=self) + + def quantize(self, a, b): + """Returns a value equal to 'a' (rounded) and having the exponent of 'b'. + + The coefficient of the result is derived from that of the left-hand + operand. It may be rounded using the current rounding setting (if the + exponent is being increased), multiplied by a positive power of ten (if + the exponent is being decreased), or is unchanged (if the exponent is + already equal to that of the right-hand operand). + + Unlike other operations, if the length of the coefficient after the + quantize operation would be greater than precision then an Invalid + operation condition is raised. This guarantees that, unless there is an + error condition, the exponent of the result of a quantize is always + equal to that of the right-hand operand. + + Also unlike other operations, quantize will never raise Underflow, even + if the result is subnormal and inexact. + + >>> Context(prec=9).quantize(Decimal('2.17'), Decimal('0.001')) + Decimal("2.170") + >>> Context(prec=9).quantize(Decimal('2.17'), Decimal('0.01')) + Decimal("2.17") + >>> Context(prec=9).quantize(Decimal('2.17'), Decimal('0.1')) + Decimal("2.2") + >>> Context(prec=9).quantize(Decimal('2.17'), Decimal('1e+0')) + Decimal("2") + >>> Context(prec=9).quantize(Decimal('2.17'), Decimal('1e+1')) + Decimal("0E+1") + >>> Context(prec=9).quantize(Decimal('-Inf'), Decimal('Infinity')) + Decimal("-Infinity") + >>> Context(prec=9).quantize(Decimal('2'), Decimal('Infinity')) + Decimal("NaN") + >>> Context(prec=9).quantize(Decimal('-0.1'), Decimal('1')) + Decimal("-0") + >>> Context(prec=9).quantize(Decimal('-0'), Decimal('1e+5')) + Decimal("-0E+5") + >>> Context(prec=9).quantize(Decimal('+35236450.6'), Decimal('1e-2')) + Decimal("NaN") + >>> Context(prec=9).quantize(Decimal('-35236450.6'), Decimal('1e-2')) + Decimal("NaN") + >>> Context(prec=9).quantize(Decimal('217'), Decimal('1e-1')) + Decimal("217.0") + >>> Context(prec=9).quantize(Decimal('217'), Decimal('1e-0')) + Decimal("217") + >>> Context(prec=9).quantize(Decimal('217'), Decimal('1e+1')) + Decimal("2.2E+2") + >>> Context(prec=9).quantize(Decimal('217'), Decimal('1e+2')) + Decimal("2E+2") + """ + return a.quantize(b, context=self) + def remainder(self, a, b): + """Returns the remainder from integer division. + + The result is the residue of the dividend after the operation of + calculating integer division as described for divide-integer, rounded to + precision digits if necessary. The sign of the result, if non-zero, is + the same as that of the original dividend. + + This operation will fail under the same conditions as integer division + (that is, if integer division on the same two operands would fail, the + remainder cannot be calculated). + + >>> Context(prec=9).remainder(Decimal('2.1'), Decimal('3')) + Decimal("2.1") + >>> Context(prec=9).remainder(Decimal('10'), Decimal('3')) + Decimal("1") + >>> Context(prec=9).remainder(Decimal('-10'), Decimal('3')) + Decimal("-1") + >>> Context(prec=9).remainder(Decimal('10.2'), Decimal('1')) + Decimal("0.2") + >>> Context(prec=9).remainder(Decimal('10'), Decimal('0.3')) + Decimal("0.1") + >>> Context(prec=9).remainder(Decimal('3.6'), Decimal('1.3')) + Decimal("1.0") + """ return a.__mod__(b, context=self) + def remainder_near(self, a, b): + """Returns to be a – b × n, where n is the integer nearest the exact + value of a ÷ b (if two integers are equally near then the even one + is chosen). If the result is equal to 0 then its sign will be the + sign of a. + + This operation will fail under the same conditions as integer division + (that is, if integer division on the same two operands would fail, the + remainder cannot be calculated). + + >>> Context(prec=9).remainder_near(Decimal('2.1'), Decimal('3')) + Decimal("-0.9") + >>> Context(prec=9).remainder_near(Decimal('10'), Decimal('6')) + Decimal("-2") + >>> Context(prec=9).remainder_near(Decimal('10'), Decimal('3')) + Decimal("1") + >>> Context(prec=9).remainder_near(Decimal('-10'), Decimal('3')) + Decimal("-1") + >>> Context(prec=9).remainder_near(Decimal('10.2'), Decimal('1')) + Decimal("0.2") + >>> Context(prec=9).remainder_near(Decimal('10'), Decimal('0.3')) + Decimal("0.1") + >>> Context(prec=9).remainder_near(Decimal('3.6'), Decimal('1.3')) + Decimal("-0.3") + """ return a.remainder_near(b, context=self) ! def same_quantum(self, a, b): return a.same_quantum(b) *************** *** 2760,2761 **** --- 2856,2862 ---- return (sign, mantissa, exp) + + + ##if __name__ == '__main__': + ## import doctest, sys + ## doctest.testmod(sys.modules[__name__]) Index: test_Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test_Decimal.py 30 Jun 2004 04:22:54 -0000 1.23 --- test_Decimal.py 30 Jun 2004 07:19:21 -0000 1.24 *************** *** 56,60 **** 'invalid_context' : InvalidContext, 'invalid_operation' : InvalidOperation, - 'lost_digits' : LostDigits, 'overflow' : Overflow, 'rounded' : Rounded, --- 56,59 ---- *************** *** 344,351 **** def test_remainderNear(self): - """Tests the Decimal class on Cowlishaw's remainderNear tests. - - See www2.hursley.ibm.com/decimal/dectest.zip to download the suite. - """ self.eval_file(dir + 'remainderNear' + '.decTest') --- 343,346 ---- From rhettinger at users.sourceforge.net Wed Jun 30 04:06:28 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Jun 30 04:06:45 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.30, 1.31 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31119 Modified Files: Decimal.py Log Message: Int/long unification. Use int() everywhere. Only call long() when requested. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Decimal.py 30 Jun 2004 07:19:21 -0000 1.30 --- Decimal.py 30 Jun 2004 08:06:25 -0000 1.31 *************** *** 441,445 **** self._exp = value[2] else: ! self._exp = long(value[2]) return --- 441,445 ---- self._exp = value[2] else: ! self._exp = int(value[2]) return *************** *** 451,455 **** self._sign = 1 self._int = tuple(value.int) ! self._exp = long(value.exp) return --- 451,455 ---- self._sign = 1 self._int = tuple(value.int) ! self._exp = int(value.exp) return *************** *** 627,631 **** """ if self._exp >= 0: ! return hash(long(self)) else: return hash( (self._sign, self._int, self._exp) ) --- 627,631 ---- """ if self._exp >= 0: ! return hash(int(self)) else: return hash( (self._sign, self._int, self._exp) ) *************** *** 1365,1370 **** return float(str(self)) ! def __long__(self): ! """Converts self to a long, truncating if necessary.""" if self._isnan(): context = getcontext() --- 1365,1370 ---- return float(str(self)) ! def __int__(self): ! """Converts self to a int, truncating if necessary.""" if self._isnan(): context = getcontext() *************** *** 1377,1383 **** if self._exp >= 0: s = sign + ''.join(map(str, self._int)) + '0'*self._exp ! return long(s) s = sign + ''.join(map(str, self._int))[:self._exp] ! return long(s) tmp = list(self._int) tmp.reverse() --- 1377,1383 ---- if self._exp >= 0: s = sign + ''.join(map(str, self._int)) + '0'*self._exp ! return int(s) s = sign + ''.join(map(str, self._int))[:self._exp] ! return int(s) tmp = list(self._int) tmp.reverse() *************** *** 1386,1397 **** val *= 10 val += tmp.pop() ! return long(((-1) ** self._sign) * val * 10.**int(self._exp)) ! def __int__(self): ! """Converts to a regular int. ! Equivalent to int(long(self)) """ ! return int(self.__long__()) def _fix(self, prec=None, rounding=None, folddown=None, context=None): --- 1386,1397 ---- val *= 10 val += tmp.pop() ! return int(((-1) ** self._sign) * val * 10.**int(self._exp)) ! def __long__(self): ! """Converts to a long. ! Equivalent to long(int(self)) """ ! return long(self.__int__()) def _fix(self, prec=None, rounding=None, folddown=None, context=None): *************** *** 1657,1661 **** sign = self._sign and not n._iseven() ! n = long(n) if self._isinfinity(): --- 1657,1661 ---- sign = self._sign and not n._iseven() ! n = int(n) if self._isinfinity(): *************** *** 2151,2159 **** def Etiny(self): """Returns Etiny (= Emin - prec + 1)""" ! return long(self.Emin - self.prec + 1) def Etop(self): """Returns maximum exponent (= Emin - prec + 1)""" ! return long(self.Emax - self.prec + 1) def _set_rounding_decision(self, type): --- 2151,2159 ---- def Etiny(self): """Returns Etiny (= Emin - prec + 1)""" ! return int(self.Emin - self.prec + 1) def Etop(self): """Returns maximum exponent (= Emin - prec + 1)""" ! return int(self.Emax - self.prec + 1) def _set_rounding_decision(self, type): *************** *** 2829,2833 **** exp = 0 else: ! exp = long(exp) intpart = m.group('int') --- 2829,2833 ---- exp = 0 else: ! exp = int(exp) intpart = m.group('int') From rhettinger at users.sourceforge.net Wed Jun 30 04:16:45 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Jun 30 04:16:48 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.31, 1.32 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv543 Modified Files: Decimal.py Log Message: Complete the int/long unification. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Decimal.py 30 Jun 2004 08:06:25 -0000 1.31 --- Decimal.py 30 Jun 2004 08:16:42 -0000 1.32 *************** *** 1373,1377 **** raise OverflowError, "Cannot convert infinity to long" if not self: ! return 0L sign = '-'*self._sign if self._exp >= 0: --- 1373,1377 ---- raise OverflowError, "Cannot convert infinity to long" if not self: ! return 0 sign = '-'*self._sign if self._exp >= 0: *************** *** 1382,1386 **** tmp = list(self._int) tmp.reverse() ! val = 0L while tmp: val *= 10 --- 1382,1386 ---- tmp = list(self._int) tmp.reverse() ! val = 0 while tmp: val *= 10 From mwh at users.sourceforge.net Wed Jun 30 05:02:37 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed Jun 30 05:02:41 2004 Subject: [Python-checkins] python/dist/src/Lib asyncore.py,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8745/Lib Modified Files: asyncore.py Log Message: Check in the updated version of patch #957240, which doesn't rely on the marshalling characteristics of infinities. Index: asyncore.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/asyncore.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** asyncore.py 14 Jun 2004 04:58:42 -0000 1.52 --- asyncore.py 30 Jun 2004 09:02:32 -0000 1.53 *************** *** 158,162 **** poll3 = poll2 # Alias for backward compatibility ! def loop(timeout=30.0, use_poll=False, map=None): if map is None: map = socket_map --- 158,162 ---- poll3 = poll2 # Alias for backward compatibility ! def loop(timeout=30.0, use_poll=False, map=None, count=None): if map is None: map = socket_map *************** *** 167,172 **** poll_fun = poll ! while map: ! poll_fun(timeout, map) class dispatcher: --- 167,178 ---- poll_fun = poll ! if count is None: ! while map: ! poll_fun(timeout, map) ! ! else: ! while map and count > 0: ! poll_fun(timeout, map) ! count = count - 1 class dispatcher: *************** *** 524,525 **** --- 530,532 ---- self.socket = file_wrapper(fd) self.add_channel() + From mwh at users.sourceforge.net Wed Jun 30 05:02:37 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed Jun 30 05:02:46 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libasyncore.tex, 1.16, 1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8745/Doc/lib Modified Files: libasyncore.tex Log Message: Check in the updated version of patch #957240, which doesn't rely on the marshalling characteristics of infinities. Index: libasyncore.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libasyncore.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** libasyncore.tex 14 Jun 2004 04:58:41 -0000 1.16 --- libasyncore.tex 30 Jun 2004 09:02:33 -0000 1.17 *************** *** 45,62 **** \begin{funcdesc}{loop}{\optional{timeout\optional{, use_poll\optional{, ! map}}}} ! Enter a polling loop that only terminates after all open channels ! have been closed. All arguments are optional. The \var{timeout} ! argument sets the timeout parameter for the appropriate ! \function{select()} or \function{poll()} call, measured in seconds; ! the default is 30 seconds. The \var{use_poll} parameter, if true, ! indicates that \function{poll()} should be used in preference to ! \function{select()} (the default is \code{False}). The \var{map} parameter ! is a dictionary whose items are the channels to watch. As channels ! are closed they are deleted from their map. If \var{map} is ! omitted, a global map is used (this map is updated by the default ! class \method{__init__()} ! -- make sure you extend, rather than override, \method{__init__()} ! if you want to retain this behavior). Channels (instances of \class{asyncore.dispatcher}, \class{asynchat.async_chat} --- 45,62 ---- \begin{funcdesc}{loop}{\optional{timeout\optional{, use_poll\optional{, ! map\optional{,count}}}}} ! Enter a polling loop that terminates after count passes or all open ! channels have been closed. All arguments are optional. The \var(count) ! parameter defaults to None, resulting in the loop terminating only ! when all channels have been closed. The \var{timeout} argument sets the ! timeout parameter for the appropriate \function{select()} or ! \function{poll()} call, measured in seconds; the default is 30 seconds. ! The \var{use_poll} parameter, if true, indicates that \function{poll()} ! should be used in preference to \function{select()} (the default is ! \code{False}). The \var{map} parameter is a dictionary whose items are ! the channels to watch. As channels are closed they are deleted from their ! map. If \var{map} is omitted, a global map is used (this map is updated ! by the default class \method{__init__()} -- make sure you extend, rather ! than override, \method{__init__()} if you want to retain this behavior). Channels (instances of \class{asyncore.dispatcher}, \class{asynchat.async_chat} From mwh at users.sourceforge.net Wed Jun 30 05:06:34 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed Jun 30 05:06:37 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1014,1.1015 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9602 Modified Files: NEWS Log Message: restore NEWS entry for 957240 Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1014 retrieving revision 1.1015 diff -C2 -d -r1.1014 -r1.1015 *** NEWS 29 Jun 2004 04:08:23 -0000 1.1014 --- NEWS 30 Jun 2004 09:06:29 -0000 1.1015 *************** *** 378,381 **** --- 378,384 ---- installation scheme for all platforms. + - asyncore.loop now has a repeat count parameter that defaults to + looping forever.. + - The distutils sdist command now ignores all .svn directories, in addition to CVS and RCS directories. .svn directories hold From mwh at users.sourceforge.net Wed Jun 30 05:09:43 2004 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Wed Jun 30 05:09:46 2004 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.1015,1.1016 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9982 Modified Files: NEWS Log Message: tyop Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.1015 retrieving revision 1.1016 diff -C2 -d -r1.1015 -r1.1016 *** NEWS 30 Jun 2004 09:06:29 -0000 1.1015 --- NEWS 30 Jun 2004 09:09:38 -0000 1.1016 *************** *** 379,383 **** - asyncore.loop now has a repeat count parameter that defaults to ! looping forever.. - The distutils sdist command now ignores all .svn directories, in --- 379,383 ---- - asyncore.loop now has a repeat count parameter that defaults to ! looping forever. - The distutils sdist command now ignores all .svn directories, in From rhettinger at users.sourceforge.net Wed Jun 30 14:49:10 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Jun 30 14:49:16 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.32, 1.33 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26046 Modified Files: Decimal.py Log Message: * Part III: docstrings and doctests * Localize some inner loop variables Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Decimal.py 30 Jun 2004 08:16:42 -0000 1.32 --- Decimal.py 30 Jun 2004 18:49:07 -0000 1.33 *************** *** 1038,1041 **** --- 1038,1042 ---- op1, op2 = op2, op1 + _divmod = divmod accumulator = [0]*(len(self._int) + len(other._int)) for i in xrange(len(op2)): *************** *** 1045,1049 **** carry = 0 for j in xrange(len(op1)): ! carry, accumulator[i+j] = divmod( mult * op1[j] + carry + accumulator[i+j], 10) --- 1046,1050 ---- carry = 0 for j in xrange(len(op1)): ! carry, accumulator[i+j] = _divmod( mult * op1[j] + carry + accumulator[i+j], 10) *************** *** 2204,2214 **** --- 2205,2267 ---- #Methods def abs(self, a): + """Returns the absolute value of the operand. + + If the operand is negative, the result is the same as using the minus + operation on the operand. Otherwise, the result is the same as using + the plus operation on the operand. + + >>> Context(prec=9).abs(Decimal('2.1')) + Decimal("2.1") + >>> Context(prec=9).abs(Decimal('-100')) + Decimal("100") + >>> Context(prec=9).abs(Decimal('101.5')) + Decimal("101.5") + >>> Context(prec=9).abs(Decimal('-101.5')) + Decimal("101.5") + """ return a.__abs__(context=self) + def add(self, a, b): + """Return the sum of the two operands. + + >>> Context(prec=9).add(Decimal('12'), Decimal('7.00')) + Decimal("19.00") + >>> Context(prec=9).add(Decimal('1E+2'), Decimal('1.01E+4')) + Decimal("1.02E+4") + """ return a.__add__(b, context=self) + def _apply(self, a): return str(a._fix(context=self)) + def compare(self, a, b): + """Compares values numerically. + + If the signs of the operands differ, a value representing each operand + (’-1’ if the operand is less than zero, ’0’ if the operand is zero or + negative zero, or ’1’ if the operand is greater than zero) is used in + place of that operand for the comparison instead of the actual + operand. + + The comparison is then effected by subtracting the second operand from + the first and then returning a value according to the result of the + subtraction: ’-1’ if the result is less than zero, ’0’ if the result is + zero or negative zero, or ’1’ if the result is greater than zero. + + >>> Context(prec=9).compare(Decimal('2.1'), Decimal('3')) + Decimal("-1") + >>> Context(prec=9).compare(Decimal('2.1'), Decimal('2.1')) + Decimal("0") + >>> Context(prec=9).compare(Decimal('2.1'), Decimal('2.10')) + Decimal("0") + >>> Context(prec=9).compare(Decimal('3'), Decimal('2.1')) + Decimal("1") + >>> Context(prec=9).compare(Decimal('2.1'), Decimal('-3')) + Decimal("1") + >>> Context(prec=9).compare(Decimal('-3'), Decimal('2.1')) + Decimal("-1") + """ return a.compare(b, context=self) + def divide(self, a, b): """Decimal division in a specified context. *************** *** 2251,2254 **** --- 2304,2308 ---- def divmod(self, a, b): return a.__divmod__(b, context=self) + def max(self, a,b): """max compares two values numerically and returns the maximum. *************** *** 2466,2483 **** --- 2520,2617 ---- def same_quantum(self, a, b): + """Returns True if the two operands have the same exponent. + + The result is never affected by either the sign or the coefficient of + either operand. + + >>> Context(prec=9).same_quantum(Decimal('2.17'), Decimal('0.001')) + False + >>> Context(prec=9).same_quantum(Decimal('2.17'), Decimal('0.01')) + True + >>> Context(prec=9).same_quantum(Decimal('2.17'), Decimal('1')) + False + >>> Context(prec=9).same_quantum(Decimal('Inf'), Decimal('-Inf')) + True + """ return a.same_quantum(b) + def sqrt(self, a): + """Returns the square root of a non-negative number to context precision. + + If the result must be inexact, it is rounded using the round-half-even + algorithm. + + >>> Context(prec=9).sqrt(Decimal('0')) + Decimal("0") + >>> Context(prec=9).sqrt(Decimal('-0')) + Decimal("-0") + >>> Context(prec=9).sqrt(Decimal('0.39')) + Decimal("0.624499800") + >>> Context(prec=9).sqrt(Decimal('100')) + Decimal("10") + >>> Context(prec=9).sqrt(Decimal('1')) + Decimal("1") + >>> Context(prec=9).sqrt(Decimal('1.0')) + Decimal("1.0") + >>> Context(prec=9).sqrt(Decimal('1.00')) + Decimal("1.0") + >>> Context(prec=9).sqrt(Decimal('7')) + Decimal("2.64575131") + >>> Context(prec=9).sqrt(Decimal('10')) + Decimal("3.16227766") + """ return a.sqrt(context=self) + def subtract(self, a, b): + """Return the sum of the two operands. + + >>> Context(prec=9).subtract(Decimal('1.3'), Decimal('1.07')) + Decimal("0.23") + >>> Context(prec=9).subtract(Decimal('1.3'), Decimal('1.30')) + Decimal("0.00") + >>> Context(prec=9).subtract(Decimal('1.3'), Decimal('2.07')) + Decimal("-0.77") + """ return a.__sub__(b, context=self) + def to_eng_string(self, a): return a.to_eng_string(context=self) + def to_sci_string(self, a): return a.__str__(context=self) + def to_integral(self, a): + """Rounds to an integer. + + When the operand has a negative exponent, the result is the same + as using the quantize() operation using the given operand as the + left-hand-operand, 1E+0 as the right-hand-operand, and the precision + of the operand as the precision setting, except that no flags will + be set. The rounding mode is taken from the context. + + >>> Context(prec=9).to_integral(Decimal('2.1')) + Decimal("2") + >>> Context(prec=9).to_integral(Decimal('100')) + Decimal("100") + >>> Context(prec=9).to_integral(Decimal('100.0')) + Decimal("100") + >>> Context(prec=9).to_integral(Decimal('101.5')) + Decimal("102") + >>> Context(prec=9).to_integral(Decimal('-101.5')) + Decimal("-102") + >>> Context(prec=9).to_integral(Decimal('10E+5')) + Decimal("1.0E+6") + >>> Context(prec=9).to_integral(Decimal('7.89E+77')) + Decimal("7.89E+77") + >>> Context(prec=9).to_integral(Decimal('-Inf')) + Decimal("-Infinity") + """ return a.to_integral(context=self) class _WorkRep(object): __slots__ = ('sign','int','exp') + # sign: -1 None 1 + # int: list + # exp: None, int, or string def __init__(self, value=None): *************** *** 2559,2582 **** """ ! self.int.reverse() alist.reverse() carry = 0 for x in xrange(len(alist)): ! self.int[x] -= alist[x] + carry ! if self.int[x] < 0: carry = 1 ! self.int[x] += 10 else: carry = 0 if carry: ! self.int[x+1] -= 1 ! last = len(self.int)-1 ! while len(self.int) > 1 and self.int[last] == 0: last -= 1 if last == 0: break ! self.int[last+1:]=[] ! self.int.reverse() alist.reverse() return --- 2693,2717 ---- """ ! selfint = self.int ! selfint.reverse() alist.reverse() carry = 0 for x in xrange(len(alist)): ! selfint[x] -= alist[x] + carry ! if selfint[x] < 0: carry = 1 ! selfint[x] += 10 else: carry = 0 if carry: ! selfint[x+1] -= 1 ! last = len(selfint)-1 ! while len(selfint) > 1 and selfint[last] == 0: last -= 1 if last == 0: break ! selfint[last+1:]=[] ! selfint.reverse() alist.reverse() return From rhettinger at users.sourceforge.net Wed Jun 30 15:11:42 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Jun 30 15:11:48 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.33, 1.34 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30998 Modified Files: Decimal.py Log Message: Part IV: docstrings and doctests Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Decimal.py 30 Jun 2004 18:49:07 -0000 1.33 --- Decimal.py 30 Jun 2004 19:11:40 -0000 1.34 *************** *** 212,216 **** class Clamped(DecimalException): ! """Exponent of a 0 changed to fit bounds""" --- 212,225 ---- class Clamped(DecimalException): ! """Exponent of a 0 changed to fit bounds. ! ! This occurs and signals clamped if the exponent of a result has been ! altered in order to fit the constraints of a specific concrete ! representation. This may occur when the exponent of a zero result would ! be outside the bounds of a representation, or when a large normal ! number would have an encoded exponent that cannot be represented. In ! this latter case, the exponent is reduced to fit and the corresponding ! number of zero digits are appended to the coefficient ("fold-down"). ! """ *************** *** 240,244 **** class ConversionSyntax(InvalidOperation): ! """Trying to convert badly formed string.""" def handle(self, context, *args): --- 249,258 ---- class ConversionSyntax(InvalidOperation): ! """Trying to convert badly formed string. ! ! This occurs and signals invalid-operation if an string is being ! converted to a number and it does not conform to the numeric string ! syntax. The result is [0,qNaN]. ! """ def handle(self, context, *args): *************** *** 248,256 **** """Division by 0. ! x / 0 ! Different from ZeroDivisionError because if the trap is disabled, ! (+-) INF is returned. ! Pass in the sign, and another argument will return a 2-tuple ! (for divmod) instead of the single number. """ --- 262,273 ---- """Division by 0. ! This occurs and signals division-by-zero if division of a finite number ! by zero was attempted (during a divide-integer or divide operation, or a ! power operation with negative right-hand operand), and the dividend was ! not zero. ! ! The result of the operation is [sign,inf], where sign is the exclusive ! or of the signs of the operands for divide, or is 1 for an odd power of ! –0, for power. """ *************** *** 263,268 **** """Cannot perform the division adequately. ! Result of a divide-integer or remainder option longer than precision ! Not actually raised. """ --- 280,286 ---- """Cannot perform the division adequately. ! This occurs and signals invalid-operation if the integer result of a ! divide-integer or remainder operation had too many digits (would be ! longer than precision). The result is [0,qNaN]. """ *************** *** 273,283 **** """Undefined result of division. ! 0 / 0 ! Not a ZeroDivisionError, because it isn't infinity, ! but can be anything. ! If the trap is disabled, returns NaN. ! ! If arguments are passed, it returns a 2-tuple (for divmod) as opposed ! to a single tuple. """ --- 291,297 ---- """Undefined result of division. ! This occurs and signals invalid-operation if division by zero was ! attempted (during a divide-integer, divide, or remainder operation), and ! the dividend is also zero. The result is [0,qNaN]. """ *************** *** 288,296 **** class Inexact(DecimalException): ! """Had to round, losing information.""" default = 0 class InvalidContext(InvalidOperation): ! """Invalid context. Unknown rounding, for example.""" def handle(self, context, *args): --- 302,327 ---- class Inexact(DecimalException): ! """Had to round, losing information. ! ! This occurs and signals inexact whenever the result of an operation is ! not exact (that is, it needed to be rounded and any discarded digits ! were non-zero), or if an overflow or underflow condition occurs. The ! result in all cases is unchanged. ! ! The inexact signal may be tested (or trapped) to determine if a given ! operation (or sequence of operations) was inexact. ! """ default = 0 class InvalidContext(InvalidOperation): ! """Invalid context. Unknown rounding, for example. ! ! This occurs and signals invalid-operation if an invalid context was ! detected during an operation. This can occur if contexts are not checked ! on creation and either the precision exceeds the capability of the ! underlying concrete representation or an unknown or unsupported rounding ! was specified. These aspects of the context need only be checked when ! the values are required to be used. The result is [0,qNaN]. ! """ def handle(self, context, *args): *************** *** 298,325 **** class Rounded(DecimalException): ! """Number got rounded (not necessarily changed during rounding)""" default = 0 class Subnormal(DecimalException): ! """Exponent < Emin before rounding""" pass class Overflow(Inexact, Rounded): ! """Number overflows ! Rescale with coefficient becoming greater than prec long ! Adjusted exponent greater than Emax ! Power's adjusted exponent above ABSOLUTE_EMAX ! Pass in the sign, and the result is: ! rounding in (half-up, half-even, half-down, up) => signed INF ! Otherwise, if the sign is negative: ! If rounding is floor, return -INF ! otherwise (rounding in (ceiling, down)) return negative number ! with highest absolute value possible (9.999999...eEmin) ! Sign positive: ! rounding = ceiling => INF ! rounding in (floor, down) => maximum finite number (9.9999...eEmax) ! """ def handle(self, context, sign, *args): --- 329,377 ---- class Rounded(DecimalException): ! """Number got rounded (not necessarily changed during rounding). ! ! This occurs and signals rounded whenever the result of an operation is ! rounded (that is, some zero or non-zero digits were discarded from the ! coefficient), or if an overflow or underflow condition occurs. The ! result in all cases is unchanged. ! ! The rounded signal may be tested (or trapped) to determine if a given ! operation (or sequence of operations) caused a loss of precision. ! """ default = 0 class Subnormal(DecimalException): ! """Exponent < Emin before rounding. ! ! This occurs and signals subnormal whenever the result of a conversion or ! operation is subnormal (that is, its adjusted exponent is less than ! Emin, before any rounding). The result in all cases is unchanged. ! ! The subnormal signal may be tested (or trapped) to determine if a given ! or operation (or sequence of operations) yielded a subnormal result. ! """ pass class Overflow(Inexact, Rounded): ! """Numerical overflow. ! This occurs and signals overflow if the adjusted exponent of a result ! (from a conversion or from an operation that is not an attempt to divide ! by zero), after rounding, would be greater than the largest value that ! can be handled by the implementation (the value Emax). ! The result depends on the rounding mode: ! ! For round-half-up and round-half-even (and for round-half-down and ! round-up, if implemented), the result of the operation is [sign,inf], ! where sign is the sign of the intermediate result. For round-down, the ! result is the largest finite number that can be represented in the ! current precision, with the sign of the intermediate result. For ! round-ceiling, the result is the same as for round-down if the sign of ! the intermediate result is 1, or is [0,inf] otherwise. For round-floor, ! the result is the same as for round-down if the sign of the intermediate ! result is 0, or is [1,inf] otherwise. In all cases, Inexact and Rounded ! will also be raised. ! """ def handle(self, context, sign, *args): *************** *** 340,344 **** class Underflow(Inexact, Rounded, Subnormal): ! """Number too small, got rounded to 0""" --- 392,408 ---- class Underflow(Inexact, Rounded, Subnormal): ! """Numerical underflow with result rounded to 0. ! ! This occurs and signals underflow if a result is inexact and the ! adjusted exponent of the result would be smaller (more negative) than ! the smallest value that can be handled by the implementation (the value ! Emin). That is, the result is both inexact and subnormal. ! ! The result after an underflow will be a subnormal number rounded, if ! necessary, so that its exponent is not less than Etiny. This may result ! in 0 with the sign of the intermediate result and an exponent of Etiny. ! ! In all cases, Inexact, Rounded, and Subnormal will also be raised. ! """ *************** *** 2412,2415 **** --- 2476,2525 ---- def power(self, a, b, modulo=None): + """Raises a to the power of b, to modulo if given. + + The right-hand operand must be a whole number whose integer part (after + any exponent has been applied) has no more than 9 digits and whose + fractional part (if any) is all zeros before any rounding. The operand + may be positive, negative, or zero; if negative, the absolute value of + the power is used, and the left-hand operand is inverted (divided into + 1) before use. + + If the increased precision needed for the intermediate calculations + exceeds the capabilities of the implementation then an Invalid operation + condition is raised. + + If, when raising to a negative power, an underflow occurs during the + division into 1, the operation is not halted at that point but + continues. + + >>> Context(prec=9).power(Decimal('2'), Decimal('3')) + Decimal("8") + >>> Context(prec=9).power(Decimal('2'), Decimal('-3')) + Decimal("0.125") + >>> Context(prec=9).power(Decimal('1.7'), Decimal('8')) + Decimal("69.7575744") + >>> Context(prec=9).power(Decimal('Infinity'), Decimal('-2')) + Decimal("0") + >>> Context(prec=9).power(Decimal('Infinity'), Decimal('-1')) + Decimal("0") + >>> Context(prec=9).power(Decimal('Infinity'), Decimal('0')) + Decimal("1") + >>> Context(prec=9).power(Decimal('Infinity'), Decimal('1')) + Decimal("Infinity") + >>> Context(prec=9).power(Decimal('Infinity'), Decimal('2')) + Decimal("Infinity") + >>> Context(prec=9).power(Decimal('-Infinity'), Decimal('-2')) + Decimal("0") + >>> Context(prec=9).power(Decimal('-Infinity'), Decimal('-1')) + Decimal("-0") + >>> Context(prec=9).power(Decimal('-Infinity'), Decimal('0')) + Decimal("1") + >>> Context(prec=9).power(Decimal('-Infinity'), Decimal('1')) + Decimal("-Infinity") + >>> Context(prec=9).power(Decimal('-Infinity'), Decimal('2')) + Decimal("Infinity") + >>> Context(prec=9).power(Decimal('0'), Decimal('0')) + Decimal("NaN") + """ return a.__pow__(b, modulo, context=self) *************** *** 2576,2582 **** --- 2686,2700 ---- def to_eng_string(self, a): + """Converts a number to a string, using scientific notation. + + The operation is not affected by the context. + """ return a.to_eng_string(context=self) def to_sci_string(self, a): + """Converts a number to a string, using scientific notation. + + The operation is not affected by the context. + """ return a.__str__(context=self) From montanaro at users.sourceforge.net Wed Jun 30 17:06:47 2004 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed Jun 30 17:06:51 2004 Subject: [Python-checkins] python/dist/src/Doc/lib libfcntl.tex,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22598 Modified Files: libfcntl.tex Log Message: use file() in preference to open() Index: libfcntl.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfcntl.tex,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** libfcntl.tex 13 Jun 2004 21:11:03 -0000 1.34 --- libfcntl.tex 30 Jun 2004 21:06:45 -0000 1.35 *************** *** 154,162 **** import struct, fcntl ! file = open(...) ! rv = fcntl(file, fcntl.F_SETFL, os.O_NDELAY) lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0) ! rv = fcntl.fcntl(file, fcntl.F_SETLKW, lockdata) \end{verbatim} --- 154,162 ---- import struct, fcntl ! f = file(...) ! rv = fcntl(f, fcntl.F_SETFL, os.O_NDELAY) lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0) ! rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata) \end{verbatim} From facundobatista at users.sourceforge.net Wed Jun 30 20:04:39 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Wed Jun 30 20:04:42 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal money.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25435 Added Files: money.py Log Message: Draft of Money class. --- NEW FILE: money.py --- import Decimal Decimal.SetDefaultContext(Decimal.BASIC_DEFAULT_CONTEXT) context = Decimal.getcontext() context.prec = 20 context.rounding = Decimal.ROUND_HALF_UP # styles for currency simbol OUTSIDE = 'outside' # $-15.36 or $(15.36) INSIDE = 'inside' # -$15.36 or ($15.36) # styles for minus sign DASH = 'dash' # $-15.36 or -$15.36 PARENTHESES = 'parentheses' # $(15.36) or ($15.36) class Money(Decimal.Decimal): '''Money class''' decimalSeparator = '.' thousandSeparator = '' currencySymbol = '$' decimal_positions = 2 currSymbolStyle = OUTSIDE minusStyle = DASH def __init__(self, value=0): Decimal.Decimal.__init__(self, value) self.quantdec = Decimal.Decimal('1e-'+str(self.decimal_positions)) def __str__(self): (sign, number, exp) = self.quantize(self.quantdec).as_tuple() numbint = number[:exp] numbdec = number[exp:] # convert to list and reverse nint = list(numbint) nint.reverse() parts_lrev = [nint[x:x+3] for x in range(0, len(nint), 3)] parts_lrev.reverse() # reverse each chunk parts_str = [] for part in parts_lrev: part.reverse() parts_str.append(''.join(map(str, part))) # parts of the final string cSS = self.currSymbolStyle mS = self.minusStyle if sign: if cSS == OUTSIDE and mS == DASH: fstr = [self.currencySymbol, '-'] elif cSS == INSIDE and mS == DASH: fstr = ['-', self.currencySymbol] elif cSS == OUTSIDE and mS == PARENTHESES: fstr = [self.currencySymbol, '('] elif cSS == INSIDE and mS == PARENTHESES: fstr = ['(', self.currencySymbol] else: raise ValueError, "Bad value for minus or currency symbol styles!" else: fstr = [self.currencySymbol] fstr.append(self.thousandSeparator.join(parts_str)) fstr.append(self.decimalSeparator) fstr.extend(map(str, numbdec)) if sign and mS == PARENTHESES: fstr.append(')') return ''.join(fstr) def __repr__(self): return "Money('%s')" % Decimal.Decimal.__str__(self) From facundobatista at users.sourceforge.net Wed Jun 30 20:05:32 2004 From: facundobatista at users.sourceforge.net (facundobatista@users.sourceforge.net) Date: Wed Jun 30 20:05:34 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal test_money.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25552 Added Files: test_money.py Log Message: Draft tests for Money class. --- NEW FILE: test_money.py --- ''' Unit tests for Money ''' __copyright__ = 'Python Software Foundation' __author__ = 'Facundo Batista' __version__ = 0, 1 import unittest from money import * import Decimal class SonOfMoney(Money): '''Subclass of Money to change its visual elements.''' decimalSeparator = '#' currencySymbol = 'AR$' thousandSeparator = ';' decimal_positions = 2 currSymbolStyle = OUTSIDE minusStyle = DASH class TestRepresentations(unittest.TestCase): '''Unit test for string representations of Money.''' def test_string_with_decimals(self): '''String with decimals.''' m = Money('23.72') self.assertEqual(str(m), '$23.72') som = SonOfMoney('23.72') self.assertEqual(str(som), 'AR$23#72') def test_int(self): '''Integer.''' m = Money(15) self.assertEqual(str(m), '$15.00') som = SonOfMoney(15) self.assertEqual(str(som), 'AR$15#00') def test_thousand_separator(self): '''Thousand separator.''' m = Money(1234567) self.assertEqual(str(m), '$1234567.00') som = SonOfMoney(1234567) self.assertEqual(str(som), 'AR$1;234;567#00') def test_negative(self): '''Negative with values set inheritating.''' m = Money('-23.72') self.assertEqual(str(m), '$-23.72') som = SonOfMoney('-23.72') self.assertEqual(str(som), 'AR$-23#72') def test_negative_currSymbol_inside(self): '''Negative with currency symbol inside.''' m = Money('-23.72') som = SonOfMoney('-23.72') m.currSymbolStyle = INSIDE som.currSymbolStyle = INSIDE self.assertEqual(str(m), '-$23.72') self.assertEqual(str(som), '-AR$23#72') def test_negative_minus_parenth(self): '''Negative with parentheses instead of dash.''' m = Money('-23.72') som = SonOfMoney('-23.72') m.minusStyle = PARENTHESES som.minusStyle = PARENTHESES self.assertEqual(str(m), '$(23.72)') self.assertEqual(str(som), 'AR$(23#72)') def test_negative_inside_parenth(self): '''Negative with parentheses and currency symbol inside.''' m = Money('-23.72') som = SonOfMoney('-23.72') m.currSymbolStyle = INSIDE som.currSymbolStyle = INSIDE m.minusStyle = PARENTHESES som.minusStyle = PARENTHESES self.assertEqual(str(m), '($23.72)') self.assertEqual(str(som), '(AR$23#72)') def test__repr__(self): '''Test representation.''' m = Money('25.172') self.assertEqual(repr(m), "Money('25.172')") class TestBehaviour(unittest.TestCase): '''Unit test for example behaviours.''' def test_Mark_McEahern(self): '''Generic test case provided by Mark to comp.lang.python.''' cost = Money('5.99') percentDiscount = Decimal.Decimal('0.1') months = 3 subTotal = cost * months discount = subTotal * percentDiscount total = subTotal - discount self.assertEqual(total, Money('16.17')) if __name__ == '__main__': unittest.main() def test_main(verbose=None): from test import test_sets test_support.run_unittest( TestRepresentations, TestBehaviour, ) test_support.run_doctest(test_sets, verbose) if __name__ == "__main__": test_main(verbose=True) From rhettinger at users.sourceforge.net Wed Jun 30 21:47:05 2004 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Jun 30 21:47:10 2004 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py, 1.34, 1.35 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8494 Modified Files: Decimal.py Log Message: * Fix broken hash function so that now: hash(2.300) == hash(2.3) == hash(2300e-2) hash(0) == hash(-0) hash(i) == hash(int(i)) whenever i is an integer signs and exponents are taken into account * Add or improve more docstrings and doctests. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Decimal.py 30 Jun 2004 19:11:40 -0000 1.34 --- Decimal.py 1 Jul 2004 01:47:03 -0000 1.35 *************** *** 16,35 **** # Improve docstrings and add more doctests # Improve the Context API """ ! This is a stab at a decimal arithmetic module based on the decimal ! arithmetic ANSI standard X3.274-1996. ! Most of the information used to create this module was helpfully provided ! by Mike Cowlishaw's work at ! http://www2.hursley.ibm.com/decimal/ ! The rest comes from Tim Peters's FixedPoint.py, particularly the string ! conversion routine and general Pythonic practices. ! In the current form of Decimal(), precision is finite but unbounded, with ! the exception of division and square roots. ! Here are some simple test cases that show how to use Decimal. There ! is a separate full-blown test harness (run Test(testdatadir).test()) >>> from Decimal import * --- 16,47 ---- # Improve docstrings and add more doctests # Improve the Context API + # Provide a clean way of attaching monetary format representations """ ! This is an implementation of decimal floating point arithmetic based on ! the General Decimal Arithmetic Specification: ! www2.hursley.ibm.com/decimal/decarith.html ! IEEE standard 854-1987: ! www.cs.berkeley.edu/~ejr/projects/754/private/drafts/854-1987/dir.html ! ! and ANSI standard X3.274-1996: ! ! www.rexxla.org/Standards/ansi.html ! ! ! Decimal floating point has finite precision with arbitrarily large bounds. ! ! The purpose of the module is to support arithmetic using familiar ! "schoolhouse" rules and to avoid the some of tricky representation ! issues associated with binary floating point. The package is especially ! useful for financial applications or for contexts where users have ! expectations that are at odds with binary floating point (for instance, ! in binary floating point, 1.00 % 0.1 gives 0.09999999999999995 instead ! of the expected Decimal("0.00") returned by decimal floating point). ! ! Here are some examples of using the decimal module: >>> from Decimal import * *************** *** 447,458 **** def __init__(self, value="0", context=None): ! """Initialize the Decimal class. ! ! Accepts several types of input: ! string ! list/tuple in form (sign, (digit_list), exponent) ! Decimal instance ! long, int """ if context is None: --- 459,472 ---- def __init__(self, value="0", context=None): ! """Create a decimal point instance. ! >>> Decimal('3.14') # string input ! Decimal("3.14") ! >>> Decimal((0, (3, 1, 4), -2)) # tuple input (sign, digit_tuple, exponent) ! Decimal("3.14") ! >>> Decimal(314) # int or long ! Decimal("314") ! >>> Decimal(Decimal(314)) # another decimal instance ! Decimal("314") """ if context is None: *************** *** 684,697 **** def __hash__(self): ! """Hashes whole numbers to their long equivalent. ! ! Numbers equal in value hash to the same value if exp>0, only if ! they have the same precision if not. ! XXX Doesn't make too much sense-- hash(10) = hash(1e1) != hash(100e-1) ! """ ! if self._exp >= 0: ! return hash(int(self)) ! else: ! return hash( (self._sign, self._int, self._exp) ) def as_tuple(self): --- 698,710 ---- def __hash__(self): ! """x.__hash__() <==> hash(x)""" ! # Decimal integers must hash the same as the ints ! # Non-integer decimals are normalized and hashed as strings ! # Normalization assures that hast(100E-1) == hash(10) ! i = int(self) ! if self == Decimal(i): ! return hash(i) ! assert self.__nonzero__() # '-0' handled by integer case ! return hash(str(self.normalize())) def as_tuple(self): *************** *** 703,717 **** def __repr__(self): ! """Represents the number as an instance of Decimal. ! ! Not pretty, but eval(repr(self)) == self ! """ return 'Decimal("%s")' % str(self) def __str__(self, eng = 0, context=None): ! """Return the string representation of the number. ! It is written in scientific notation. Because it represents all the ! number information, can be used from repr() also. """ --- 716,727 ---- def __repr__(self): ! """Represents the number as an instance of Decimal.""" ! # Invariant: eval(repr(d)) == d return 'Decimal("%s")' % str(self) def __str__(self, eng = 0, context=None): ! """Return string representation of the number in scientific notation. ! Captures all of the information in the underlying representation. """