diff options
author | Brett Cannon <bcannon@gmail.com> | 2005-04-26 03:45:26 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2005-04-26 03:45:26 (GMT) |
commit | c3647ac93e2a38762de8a23b1d94a6380e9ad468 (patch) | |
tree | a7e00a7e8f70ee226fdeb3d229b9734d5b17a344 /Misc | |
parent | d7c795e72966f7c72b94b919f3539be66495e6c3 (diff) | |
download | cpython-c3647ac93e2a38762de8a23b1d94a6380e9ad468.zip cpython-c3647ac93e2a38762de8a23b1d94a6380e9ad468.tar.gz cpython-c3647ac93e2a38762de8a23b1d94a6380e9ad468.tar.bz2 |
Make subclasses of int, long, complex, float, and unicode perform type
conversion using the proper magic slot (e.g., __int__()). Also move conversion
code out of PyNumber_*() functions in the C API into the nb_* function.
Applied patch #1109424. Thanks Walter Doewald.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -12,6 +12,14 @@ What's New in Python 2.5 alpha 1? Core and builtins ----------------- +- patch #1109424: int, long, float, complex, and unicode now check for the + proper magic slot for type conversions when subclassed. Previously the + magic slot was ignored during conversion. Semantics now match the way + subclasses of str always behaved. int/long/float, conversion of an instance + to the base class has been moved the prroper nb_* magic slot and out of + PyNumber_*(). + Thanks Walter Dörwald. + - Descriptors defined in C with a PyGetSetDef structure, where the setter is NULL, now raise an AttributeError when attempting to set or delete the attribute. Previously a TypeError was raised, but this was inconsistent |