Eric V. Smith <e...@trueblade.com> added the comment:

With an unpatched 2.7, this fails for me:

diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -289,6 +289,17 @@
             else:
                 raise TestFailed, '"%*d"%(maxsize, -127) should fail'
 
+    def test_issue13410(self):
+        class Foo(object):
+            def __init__(self, x):
+                self.x = x
+            def __long__(self):
+                return long(self.x)
+            def __float__(self):
+                return float(self.x)
+        '%d' % Foo(22)
+
 def test_main():
     test_support.run_unittest(FormatTest)
 

$ ./python Lib/test/regrtest.py test_format
test_format
test test_format crashed -- <type 'exceptions.TypeError'>: int() argument must 
be a string or a number, not 'Foo'
1 test failed:
    test_format

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13410>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to