Return an unlimited-size safe repr-string for the given object. As with saferepr, failing __repr__ functions of user instances will be represented with a short exception info. This function is a wrapper around simple repr. Note: a cleaner solution would be to alter ``saferepr``thi
(obj: object, use_ascii: bool = True)
| 137 | |
| 138 | |
| 139 | def saferepr_unlimited(obj: object, use_ascii: bool = True) -> str: |
| 140 | """Return an unlimited-size safe repr-string for the given object. |
| 141 | |
| 142 | As with saferepr, failing __repr__ functions of user instances |
| 143 | will be represented with a short exception info. |
| 144 | |
| 145 | This function is a wrapper around simple repr. |
| 146 | |
| 147 | Note: a cleaner solution would be to alter ``saferepr``this way |
| 148 | when maxsize=None, but that might affect some other code. |
| 149 | """ |
| 150 | try: |
| 151 | if use_ascii: |
| 152 | return ascii(obj) |
| 153 | return repr(obj) |
| 154 | except Exception as exc: |
| 155 | return _format_repr_exception(exc, obj) |