[New-bugs-announce] [issue9041] raised exception is misleading

Pauli Rikula report at bugs.python.org
Mon Jun 21 14:23:33 CEST 2010


New submission from Pauli Rikula <pauli.rikula at gmail.com>:

Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>> ctypes.c_double(-10L)
c_double(-10.0)
>>> ctypes.c_double(-16158503035655503650357438344334975980222051334857742016065172713762327569433945446598600705761456731844358980460949009747059779575245460547544076193224141560315438683650498045875098875194826053398028819192033784138396109321309878080919047169238085235290822926018152521443787945770532904303776199561965192761047051351577287005728952652821735984108986866610276357675617870244379434256980638641483535093292326373531858799166625357628570460558031263448272521936380684506350754039141397287742159767011772534248723062567540713722795836229745796676103584020939467516975660579180998612463422664938089473950280866877864444041L)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError:  float expected instead of long instance

.. vs:

>>> float(-16158503035655503650357438344334975980222051334857742016065172713762327569433945446598600705761456731844358980460949009747059779575245460547544076193224141560315438683650498045875098875194826053398028819192033784138396109321309878080919047169238085235290822926018152521443787945770532904303776199561965192761047051351577287005728952652821735984108986866610276357675617870244379434256980638641483535093292326373531858799166625357628570460558031263448272521936380684506350754039141397287742159767011772534248723062567540713722795836229745796676103584020939467516975660579180998612463422664938089473950280866877864444041L)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: long int too large to convert to float

----------
assignee: theller
components: ctypes
messages: 108265
nosy: kumma, theller
priority: normal
severity: normal
status: open
title: raised exception is misleading
type: behavior
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9041>
_______________________________________


More information about the New-bugs-announce mailing list