New submission from Antti Haapala: This is an annoying heisenbug; it seems that some objects cannot be formatted until you explicitly do obj.__format__. For example `object.__reduce__` behaves like this:
Python 2.7.10 (default, Oct 14 2015, 16:09:02) [GCC 5.2.1 20151010] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> format(object.__reduce__) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Type method_descriptor doesn't define __format__ >>> format(object.__reduce__) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Type method_descriptor doesn't define __format__ >>> object.__reduce__.__format__ <built-in method __format__ of method_descriptor object at 0x7f67563ed0e0> >>> format(object.__reduce__) "<method '__reduce__' of 'object' objects>" I can replicate this in 2.7.9, .10 and .11 on Ubuntu and Debian, though it works on Windows Python, works in 2.6.6, and Pythons 3 wherever I've tried, but I've heard this also failing on Python 3. ---------- title: __reduce__ format -> format(object.__reduce__) fails intermittently _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26906> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com