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.

Author JosephArmbruster
Recipients JosephArmbruster
Date 2007-12-20.03:39:39
SpamBayes Score 0.075685106
Marked as misclassified No
Message-id <1198121982.55.0.188898496542.issue1666@psf.upfronthosting.co.za>
In-reply-to
Content
I was wondering what would happen, so I tried this out for the heck of
it with:

Python 3.0a2 (py3k:59572M, Dec 19 2007, 15:54:07) [MSC v.1500 32 bit
(Intel)]
on win32

class a(int):
   def __new__(cls,number):
     return int.__new__(cls,number)
for x in range(0,a(5)):
  print(x)


This resulted in a:
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "a.py", line 5, in <module>
     for x in range(0,a(5)):
SystemError: ..\Objects\longobject.c:400: bad argument to internal
function
[41030 refs]

It looks like the rangeobject performs a FitsInLong test on each of
the parameters to range, which uses the function
_PyLong_FitsInLong(PyObject *vv) within longobject.c.  In tern, this
performs a typecheck:  #define PyLong_CheckExact(op) (Py_TYPE(op) ==
&PyLong_Type) that fails.
History
Date User Action Args
2007-12-20 03:39:43JosephArmbrustersetspambayes_score: 0.0756851 -> 0.075685106
recipients: + JosephArmbruster
2007-12-20 03:39:42JosephArmbrustersetspambayes_score: 0.0756851 -> 0.0756851
messageid: <1198121982.55.0.188898496542.issue1666@psf.upfronthosting.co.za>
2007-12-20 03:39:42JosephArmbrusterlinkissue1666 messages
2007-12-20 03:39:40JosephArmbrustercreate