Resolution of SF bug # 446645 changes the semantics for __dict__ when

deleting it or getting an attribute before any have been set.
Previously, __dict__ could be None or {}, but now it must be a
dictionary (can never be None), and del'ing it is illegal.

Code changes to be made soon.
This commit is contained in:
Barry Warsaw 2001-08-14 17:52:06 +00:00
parent 5b87828901
commit d4979cd62a
1 changed files with 4 additions and 4 deletions

View File

@ -55,10 +55,10 @@ Proposal
approaches in subsequent versions of Python. approaches in subsequent versions of Python.
A function object's __dict__ can also be set, but only to a A function object's __dict__ can also be set, but only to a
dictionary object or None (e.g. setting __dict__ to UserDict dictionary object. Deleting a function's __dict__, or setting it
raises a TypeError). Deleting a function's __dict__ attribute is to anything other than a concrete dictionary object results in a
equivalent to setting it to None. If no function attributes have TypeError. If no function attributes have ever been set, the
ever been set, the function's __dict__ will be None. function's __dict__ will be empty.
Examples Examples