MCPcopy Index your code
hub / github.com/python/cpython / get_truncated_repr

Method get_truncated_repr

Tools/gdb/libpython.py:224–237  ·  view source on GitHub ↗

Get a repr-like string for the data, but truncate it at "maxlen" bytes (ending the object graph traversal as soon as you do)

(self, maxlen)

Source from the content-addressed store, hash-verified

222 field_obj.write_repr(out, visited)
223
224 def get_truncated_repr(self, maxlen):
225 '''
226 Get a repr-like string for the data, but truncate it at "maxlen" bytes
227 (ending the object graph traversal as soon as you do)
228 '''
229 out = TruncatedStringIO(maxlen)
230 try:
231 self.write_repr(out, set())
232 except StringTruncated:
233 # Truncation occurred:
234 return out.getvalue() + '...(truncated)'
235
236 # No truncation occurred:
237 return out.getvalue()
238
239 def type(self):
240 return PyTypeObjectPtr(self.field('ob_type'))

Callers

nothing calls this directly

Calls 4

write_reprMethod · 0.95
getvalueMethod · 0.95
TruncatedStringIOClass · 0.85
setFunction · 0.85

Tested by

no test coverage detected