(original) (raw)
? ID ? Python.vpj ? Python.vpw ? Python.vtg ? compileall.diff ? cvstatus.py ? d ? dict_pop.diff ? foo.html ? foo.py ? gc_leaveold.diff ? gc_moveroots.diff ? generator_bench.py ? linux-build ? m ? micro_nas.diff ? micro_nas2.diff ? micro_nas3.diff ? pymalloc.diff ? pymalloc2.diff ? pymem_del.diff ? pymem_nukeit.diff ? rlim_inf.diff ? str-eq-cmp2.patch ? str_mod.diff ? tcc-build ? trashcan_gc.diff ? unquote_doc.diff ? Doc/api.aux ? Doc/api.dvi ? Doc/api.idx ? Doc/api.ind ? Doc/api.l2h ? Doc/api.log ? Doc/api.toc ? Doc/doc.aux ? Doc/doc.dvi ? Doc/doc.ind ? Doc/doc.l2h ? Doc/doc.log ? Doc/doc.toc ? Doc/ext.aux ? Doc/ext.dvi ? Doc/ext.idx ? Doc/ext.ind ? Doc/ext.l2h ? Doc/ext.log ? Doc/ext.toc ? Doc/lib.aux ? Doc/lib.idx ? Doc/lib.ind ? Doc/lib.l2h ? Doc/lib.log ? Doc/lib.pla ? Doc/lib.toc ? Doc/lib10.syn ? Doc/lib11.syn ? Doc/lib12.syn ? Doc/lib2.syn ? Doc/lib3.syn ? Doc/lib4.syn ? Doc/lib5.syn ? Doc/lib6.syn ? Doc/lib7.syn ? Doc/lib8.syn ? Doc/lib9.syn ? Doc/modapi.ind ? Doc/moddoc.ind ? Doc/modext.ind ? Doc/modlib.idx ? Doc/modlib.ind ? Doc/ref.log ? Include/d ? Python/reorder.diff Index: Modules/selectmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v retrieving revision 2.71 diff -u -r2.71 selectmodule.c --- Modules/selectmodule.c 12 Nov 2002 11:42:20 -0000 2.71 +++ Modules/selectmodule.c 17 Nov 2002 18:28:21 -0000 @@ -214,11 +214,9 @@ return NULL; } else { - tout = PyNumber_Float(tout); - if (!tout) + timeout = PyFloat_AsDouble(tout); + if (timeout == -1 && PyErr_Occurred()) return NULL; - timeout = PyFloat_AS_DOUBLE(tout); - Py_DECREF(tout); if (timeout > (double)LONG_MAX) { PyErr_SetString(PyExc_OverflowError, "timeout period too long"); Index: Objects/abstract.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/abstract.c,v retrieving revision 2.106 diff -u -r2.106 abstract.c --- Objects/abstract.c 5 Nov 2002 18:05:49 -0000 2.106 +++ Objects/abstract.c 17 Nov 2002 18:28:22 -0000 @@ -639,12 +639,6 @@ PyObject * PyNumber_Remainder(PyObject *v, PyObject *w) { - if (PyString_Check(v)) - return PyString_Format(v, w); -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(v)) - return PyUnicode_Format(v, w); -#endif return binary_op(v, w, NB_SLOT(nb_remainder), "%"); } Index: Objects/floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.115 diff -u -r2.115 floatobject.c --- Objects/floatobject.c 19 Aug 2002 19:26:42 -0000 2.115 +++ Objects/floatobject.c 17 Nov 2002 18:28:22 -0000 @@ -202,9 +202,13 @@ if (op && PyFloat_Check(op)) return PyFloat_AS_DOUBLE((PyFloatObject*) op); - if (op == NULL || (nb = op->ob_type->tp_as_number) == NULL || - nb->nb_float == NULL) { + if (op == NULL) { PyErr_BadArgument(); + return -1; + } + + if ((nb = op->ob_type->tp_as_number) == NULL || nb->nb_float == NULL) { + PyErr_SetString(PyExc_TypeError, "a float is required"); return -1; } Index: Objects/stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.196 diff -u -r2.196 stringobject.c --- Objects/stringobject.c 12 Nov 2002 23:01:11 -0000 2.196 +++ Objects/stringobject.c 17 Nov 2002 18:28:24 -0000 @@ -3126,9 +3126,28 @@ return NULL; } +static PyObject * +string_mod(PyObject *v, PyObject *w) +{ + if (!PyString_Check(v)) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + return PyString_Format(v, w); +} + PyDoc_STRVAR(basestring_doc, "Type basestring cannot be instantiated; it is the base for str and unicode."); +static PyNumberMethods string_as_number = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + 0, /*nb_divide*/ + string_mod, /*nb_remainder*/ +}; + + PyTypeObject PyBaseString_Type = { PyObject_HEAD_INIT(&PyType_Type) 0, @@ -3190,7 +3209,7 @@ 0, /* tp_setattr */ 0, /* tp_compare */ (reprfunc)string_repr, /* tp_repr */ - 0, /* tp_as_number */ + &string_as_number, /* tp_as_number */ &string_as_sequence, /* tp_as_sequence */ &string_as_mapping, /* tp_as_mapping */ (hashfunc)string_hash, /* tp_hash */ @@ -3199,7 +3218,8 @@ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ &string_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | + Py_TPFLAGS_BASETYPE, /* tp_flags */ string_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ Index: Objects/unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.174 diff -u -r2.174 unicodeobject.c --- Objects/unicodeobject.c 12 Nov 2002 23:01:11 -0000 2.174 +++ Objects/unicodeobject.c 17 Nov 2002 18:28:26 -0000 @@ -5799,6 +5799,24 @@ {NULL, NULL} }; +static PyObject * +unicode_mod(PyObject *v, PyObject *w) +{ + if (!PyUnicode_Check(v)) { + Py_INCREF(Py_NotImplemented); + return Py_NotImplemented; + } + return PyUnicode_Format(v, w); +} + +static PyNumberMethods unicode_as_number = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + 0, /*nb_divide*/ + unicode_mod, /*nb_remainder*/ +}; + static PySequenceMethods unicode_as_sequence = { (inquiry) unicode_length, /* sq_length */ (binaryfunc) PyUnicode_Concat, /* sq_concat */ @@ -6647,7 +6665,7 @@ 0, /* tp_setattr */ (cmpfunc) unicode_compare, /* tp_compare */ (reprfunc) unicode_repr, /* tp_repr */ - 0, /* tp_as_number */ + &unicode_as_number, /* tp_as_number */ &unicode_as_sequence, /* tp_as_sequence */ &unicode_as_mapping, /* tp_as_mapping */ (hashfunc) unicode_hash, /* tp_hash*/ @@ -6656,7 +6674,8 @@ PyObject_GenericGetAttr, /* tp_getattro */ 0, /* tp_setattro */ &unicode_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | + Py_TPFLAGS_BASETYPE, /* tp_flags */ unicode_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */