[Patches] [ python-Patches-1109424 ] type conversion methods and subclasses

SourceForge.net noreply at sourceforge.net
Tue Apr 26 05:46:42 CEST 2005


Patches item #1109424, was opened at 2005-01-25 14:04
Message generated for change (Comment added) made by bcannon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1109424&group_id=5470

Category: Core (C code)
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Walter Dörwald (doerwalter)
Assigned to: Brett Cannon (bcannon)
Summary: type conversion methods and subclasses

Initial Comment:
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.


----------------------------------------------------------------------

>Comment By: Brett Cannon (bcannon)
Date: 2005-04-25 20:46

Message:
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

----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2005-02-24 18:57

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1109424&group_id=5470


More information about the Patches mailing list