This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: type conversion methods and subclasses
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, doerwalter
Priority: normal Keywords: patch

Created on 2005-01-25 22:04 by doerwalter, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
diff.txt doerwalter, 2005-01-25 22:04
Messages (3)
msg47615 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2005-01-25 22:04
This patch fixes the classes int, long, float and
unicode so that type conversion methods (i.e. __int__,
__long__, __float__, __unicode__) are used for type
conversion in subclasses of int/long/float/unicode.
(See the following thread on python-dev for more info:
http://mail.python.org/pipermail/python-dev/2005-January/051175.html)

It also fixes the bug reported by Nick Coghlan here:
http://mail.python.org/pipermail/python-dev/2005-January/051196.html.

For int/long/float converting the instance of the
subclasses to the base class has been moved from
PyNumber_(Int|Long|Float) to the apropriate slot
nb_int, nb_long, nb_float of int/long/float.
msg47616 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2005-02-25 02:57
Logged In: YES 
user_id=357491

OK, BDFL pronounced on this saying the semantic change was fine.  I will 
have a look at the patch when I can and get it in.  Won't touch 2.4 since it 
is a semantic change, though.
msg47617 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2005-04-26 03:46
Logged In: YES 
user_id=357491

OK, checked in.  Thanks, Walter.

Checking in Objects/abstract.c;
/cvsroot/python/python/dist/src/Objects/abstract.c,v  <-- 
abstract.c
new revision: 2.136; previous revision: 2.135
done
Checking in Objects/floatobject.c;
/cvsroot/python/python/dist/src/Objects/floatobject.c,v  <--
 floatobject.c
new revision: 2.135; previous revision: 2.134
done
Checking in Objects/intobject.c;
/cvsroot/python/python/dist/src/Objects/intobject.c,v  <-- 
intobject.c
new revision: 2.114; previous revision: 2.113
done
Checking in Objects/longobject.c;
/cvsroot/python/python/dist/src/Objects/longobject.c,v  <--
 longobject.c
new revision: 1.167; previous revision: 1.166
done
Checking in Objects/object.c;
/cvsroot/python/python/dist/src/Objects/object.c,v  <-- 
object.c
new revision: 2.226; previous revision: 2.225
done
Checking in Lib/test/test_builtin.py;
/cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v 
<--  test_builtin.py
new revision: 1.41; previous revision: 1.40
done
Checking in Lib/test/test_complex.py;
/cvsroot/python/python/dist/src/Lib/test/test_complex.py,v 
<--  test_complex.py
new revision: 1.16; previous revision: 1.15
done
Checking in Lib/test/test_str.py;
/cvsroot/python/python/dist/src/Lib/test/test_str.py,v  <--
 test_str.py
new revision: 1.5; previous revision: 1.4
done
Checking in Lib/test/test_unicode.py;
/cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v 
<--  test_unicode.py
new revision: 1.94; previous revision: 1.93
done
Checking in Misc/NEWS;
/cvsroot/python/python/dist/src/Misc/NEWS,v  <--  NEWS
new revision: 1.1290; previous revision: 1.1289
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41485
2005-01-25 22:04:50doerwaltercreate