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 jayanth
Recipients jayanth, ronaldoussoren
Date 2011-11-15.22:04:49
SpamBayes Score 1.1699369e-09
Marked as misclassified No
Message-id <1321394690.57.0.254973831289.issue13410@psf.upfronthosting.co.za>
In-reply-to
Content
With file xx.py:

class Foo(object):
    def __init__(self, x):
        self.x = x
    def __long__(self):
        return long(self.x)
    def __float__(self):
        return float(self.x)
y = Foo(22)
print '%d' % y
print '%d' % y


Interactive mode:

$ python -V
Python 2.6.7
$ python -i xx.py
22
22
>>>
TypeError: int() argument must be a string or a number, not 'Foo'
>>> '%d' % y
'22'
>>> '%d' % y
TypeError: int() argument must be a string or a number, not 'Foo'
>>> '%d' % y
'22'
>>> '%d' % y
TypeError: int() argument must be a string or a number, not 'Foo'

It alternates between printing '22' and print a TypeError message.  Expected it to be consistent.

Also, the first carraige-return (with no input) results in an error message.  Did not expect an error message.  In fact, typing pretty much anything (e.g. an undefined variable or raise(Exception())) results in the same error message.

On Mac OS X Darwin Kernel Version 10.8.0
Python 2.6.7 (r267:88850, Jul  6 2011, 13:57:37) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

Thanks.
History
Date User Action Args
2011-11-15 22:04:50jayanthsetrecipients: + jayanth, ronaldoussoren
2011-11-15 22:04:50jayanthsetmessageid: <1321394690.57.0.254973831289.issue13410@psf.upfronthosting.co.za>
2011-11-15 22:04:49jayanthlinkissue13410 messages
2011-11-15 22:04:49jayanthcreate