Message289546
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. |
|
Date |
User |
Action |
Args |
2017-03-13 18:46:13 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, josh.r, MSeifert |
2017-03-13 18:46:13 | serhiy.storchaka | set | messageid: <1489430773.45.0.693270841967.issue29800@psf.upfronthosting.co.za> |
2017-03-13 18:46:13 | serhiy.storchaka | link | issue29800 messages |
2017-03-13 18:46:13 | serhiy.storchaka | create | |
|