mirror of
https://github.com/python/cpython.git
synced 2026-01-05 23:12:38 +00:00
operators for which a default implementation exist now work, both in dynamic classes and in static classes, overridden or not. This affects __repr__, __str__, __hash__, __contains__, __nonzero__, __cmp__, and the rich comparisons (__lt__ etc.). For dynamic classes, this meant copying a lot of code from classobject! (XXX There are still some holes, because the comparison code in object.c uses PyInstance_Check(), meaning new-style classes don't get the same dispensation. This needs more thinking.) - Add object.__hash__, object.__repr__, object.__str__. The __str__ dispatcher now calls the __repr__ dispatcher, as it should. - For static classes, the tp_compare, tp_richcompare and tp_hash slots are now inherited together, or not at all. (XXX I fear there are still some situations where you can inherit __hash__ when you shouldn't, but mostly it's OK now, and I think there's no way we can get that 100% right.) |
||
|---|---|---|
| .. | ||
| .cvsignore | ||
| abstract.c | ||
| bufferobject.c | ||
| cellobject.c | ||
| classobject.c | ||
| cobject.c | ||
| complexobject.c | ||
| descrobject.c | ||
| dictobject.c | ||
| fileobject.c | ||
| floatobject.c | ||
| frameobject.c | ||
| funcobject.c | ||
| intobject.c | ||
| iterobject.c | ||
| listobject.c | ||
| longobject.c | ||
| methodobject.c | ||
| moduleobject.c | ||
| object.c | ||
| obmalloc.c | ||
| rangeobject.c | ||
| sliceobject.c | ||
| stringobject.c | ||
| tupleobject.c | ||
| typeobject.c | ||
| unicodectype.c | ||
| unicodeobject.c | ||
| unicodetype_db.h | ||
| xxobject.c | ||