Skip to content

Commit 12fad0c

Browse files
committed
Ooops, add implementation :-D
1 parent 1ea37c9 commit 12fad0c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎Objects/unicodeobject.c‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,9 +2971,15 @@ unicode_fromformat_arg(_PyUnicodeWriter *writer,
29712971
case 'R':
29722972
{
29732973
PyObject *obj = va_arg(*vargs, PyObject *);
2974-
PyObject *repr;
29752974
assert(obj);
2976-
repr = PyObject_Repr(obj);
2975+
PyObject *repr;
2976+
if (flags & F_ALT) {
2977+
reprfunc repr_func = PyUnicode_Type.tp_repr;
2978+
repr = repr_func(obj);
2979+
}
2980+
else {
2981+
repr = PyObject_Repr(obj);
2982+
}
29772983
if (!repr)
29782984
return NULL;
29792985
if (unicode_fromformat_write_str(writer, repr, width, precision, flags) == -1) {

0 commit comments

Comments
 (0)