• Barry Warsaw's avatar
    dict_update(): Generalize this method so {}.update() accepts any · 41ad6354
    Barry Warsaw authored
    "mapping" object, specifically one that supports PyMapping_Keys() and
    PyObject_GetItem().  This allows you to say e.g. {}.update(UserDict())
    
    We keep the special case for concrete dict objects, although that
    seems moderately questionable.  OTOH, the code exists and works, so
    why change that?
    
    .update()'s docstring already claims that D.update(E) implies calling
    E.keys() so it's appropriate not to transform AttributeErrors in
    PyMapping_Keys() to TypeErrors.
    
    Patch eyeballed by Tim.
    41ad6354
dictobject.c 48.6 KB