@@ -422,20 +422,25 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
422422 PyAPI_FUNC (int ) PyObject_Length(PyObject *o);
423423#define PyObject_Length PyObject_Size
424424
425- PyAPI_FUNC (int ) _PyObject_LengthCue (PyObject *o);
425+ PyAPI_FUNC (int ) _PyObject_LengthHint (PyObject *o);
426426
427427 /*
428428 Return the size of object o. If the object, o, provides
429429 both sequence and mapping protocols, the sequence size is
430430 returned. On error, -1 is returned. If the object provides
431- a _length_cue() method, its value is returned. This is the
431+ a __length_hint__() method, its value is returned. This is an
432+ internal undocumented API provided for performance reasons;
433+ for compatibility, don't use it outside the core. This is the
432434 equivalent to the Python expression:
433435 try:
434436 return len(o)
435437 except (AttributeError, TypeError):
436- if hasattr(o, '_length_cue'):
437- return o._length_cue()
438- raise
438+ exc_type, exc_value, exc_tb = sys.exc_info()
439+ try:
440+ return o.__length_hint__()
441+ except:
442+ pass
443+ raise exc_type, exc_value, exc_tb
439444 */
440445
441446 PyAPI_FUNC (PyObject *) PyObject_GetItem(PyObject *o, PyObject *key);
0 commit comments