• Barry Warsaw's avatar
    dict_update(): Generalize this method so {}.update() accepts any · 66a0d1d9
    Barry Warsaw yazdı
    "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.
    66a0d1d9
dictobject.c 48.6 KB