>>>>> "BAW" == Barry A Warsaw <bwarsaw@cnri.reston.va.us> writes: BAW> Uh oh. Fresh CVS update and make clean, make: >>> sum(*n) | Traceback (innermost last): | File "<stdin>", line 1, in ? | SystemError: bad argument to internal function Here's a proposed patch that will cause a TypeError to be raised instead. -Barry -------------------- snip snip -------------------- Index: abstract.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Objects/abstract.c,v retrieving revision 2.33 diff -c -r2.33 abstract.c *** abstract.c 2000/03/10 22:55:18 2.33 --- abstract.c 2000/03/29 05:36:21 *************** *** 860,866 **** PyObject *s; { PySequenceMethods *m; ! if (s == NULL) { null_error(); return -1; --- 860,867 ---- PyObject *s; { PySequenceMethods *m; ! int size = -1; ! if (s == NULL) { null_error(); return -1; *************** *** 868,877 **** m = s->ob_type->tp_as_sequence; if (m && m->sq_length) ! return m->sq_length(s); ! type_error("len() of unsized object"); ! return -1; } PyObject * --- 869,879 ---- m = s->ob_type->tp_as_sequence; if (m && m->sq_length) ! size = m->sq_length(s); ! if (size < 0) ! type_error("len() of unsized object"); ! return size; } PyObject * Index: ceval.c =================================================================== RCS file: /projects/cvsroot/python/dist/src/Python/ceval.c,v retrieving revision 2.169 diff -c -r2.169 ceval.c *** ceval.c 2000/03/28 23:49:16 2.169 --- ceval.c 2000/03/29 05:39:00 *************** *** 1636,1641 **** --- 1636,1649 ---- break; } nstar = PySequence_Length(stararg); + if (nstar < 0) { + if (!PyErr_Occurred) + PyErr_SetString( + PyExc_TypeError, + "len() of unsized object"); + x = NULL; + break; + } } if (nk > 0) { if (kwdict == NULL) {
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4