mirror of https://github.com/python/cpython
0395fdd3a9
del'ing func.func_dict. I took the opportunity to also clean up some other nits with the code, namely core dumps when del'ing func_defaults and KeyError instead of AttributeError when del'ing a non-existant function attribute. Specifically, func_memberlist: Move func_dict and __dict__ into here instead of special casing them in the setattro and getattro methods. I don't remember why I took them out of here before I first uploaded the PEP 232 patch. :/ func_getattro(): No need to special case __dict__/func_dict since their now in the func_memberlist and PyMember_Get() should Do The Right Thing (i.e. transforms NULL values into Py_None). func_setattro(): Document the intended behavior of del'ing or setting to None one of the special func_* attributes. I.e.: func_code - can only be set to a code object. It can't be del'd or set to None. func_defaults - can be del'd. Can only be set to None or a tuple. func_dict - can be del'd. Can only be set to None or a dictionary. Fix core dumps and incorrect exceptions as described above. Also, if we're del'ing an arbitrary function attribute but func_dict is NULL, don't create func_dict before discovering that we'll get an AttributeError anyway. |
||
---|---|---|
.. | ||
.cvsignore | ||
Makefile.in | ||
abstract.c | ||
bufferobject.c | ||
classobject.c | ||
cobject.c | ||
complexobject.c | ||
dictobject.c | ||
fileobject.c | ||
floatobject.c | ||
frameobject.c | ||
funcobject.c | ||
intobject.c | ||
listobject.c | ||
longobject.c | ||
methodobject.c | ||
moduleobject.c | ||
object.c | ||
rangeobject.c | ||
sliceobject.c | ||
stringobject.c | ||
tupleobject.c | ||
typeobject.c | ||
unicodectype.c | ||
unicodeobject.c | ||
unicodetype_db.h | ||
xxobject.c |