[issue11145] '%o' % user-defined instance

Serhiy Storchaka report at bugs.python.org
Mon Nov 17 20:35:06 CET 2014


Serhiy Storchaka added the comment:

Good catch! Here is a patch which fixes this issue too.

> (1) stop calling the user-defined functions and behave similarly to most other built-in types;

This is done in 3.x.

> (2) stop trying to mutate that poor string in-place and always just create a new one.

The patch can be simplified by removing 6 lines. But this will slow down integer formatting by few (about 2-7) percents in worst case. Not a big deal.

----------
Added file: http://bugs.python.org/file37215/issue11145_3.patch

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


More information about the Python-bugs-list mailing list