Serhiy Storchaka added the comment:

PyUnicode_FromFormat() crashes in debug build if the argument for %U is not a 
unicode string.

I thought about using %S. This would correspond possible Python implementation 
(`'%s=%r' % (key, value)`). But in that case we should increase refcounts of 
key and value (and maybe even pto->kw) since custom __str__ of the key can 
remove the value from the dict and make the value variable the hanging 
reference.

I would prefer never failing __repr__, but other core developers have other 
opinion. Currently partial.__repr__ raises an exception on deep recursion and 
when the repr of any argument raises an exception.

Current Michael's patch LGTM, but if his want to suggest the solution with %S 
it would LGTM too.

----------
nosy: +serhiy.storchaka

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

Reply via email to