[ python-Bugs-966618 ] float_subtype_new() bug

SourceForge.net noreply at sourceforge.net
Fri Jun 4 11:39:13 EDT 2004


Bugs item #966618, was opened at 2004-06-04 15:39
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=966618&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Armin Rigo (arigo)
Assigned to: Nobody/Anonymous (nobody)
Summary: float_subtype_new() bug

Initial Comment:
A rather obsure bug in the subclassing code:

>>> class A:
...   def __float__(self): return 'hello'
...
>>> float(A())
'hello'

>>> class f(float): pass
...
>>> f(A())
-5.7590155905901735e-56

In debug mode, the assert() in float_subtype_new() fails instead.  In non-debug mode, the value we get is the result of typecasting the PyStringObject* to a PyFloatObject*.

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

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



More information about the Python-bugs-list mailing list