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

Method get_truncated_repr

Tools/gdb/libpython.py:1304–1317  ·  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

1302 interp_frame = interp_frame.previous()
1303
1304 def get_truncated_repr(self, maxlen):
1305 '''
1306 Get a repr-like string for the data, but truncate it at "maxlen" bytes
1307 (ending the object graph traversal as soon as you do)
1308 '''
1309 out = TruncatedStringIO(maxlen)
1310 try:
1311 self.write_repr(out, set())
1312 except StringTruncated:
1313 # Truncation occurred:
1314 return out.getvalue() + '...(truncated)'
1315
1316 # No truncation occurred:
1317 return out.getvalue()
1318
1319class PySetObjectPtr(PyObjectPtr):
1320 _typename = 'PySetObject'

Callers 4

to_stringMethod · 0.45
invokeMethod · 0.45
invokeMethod · 0.45

Calls 4

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

Tested by

no test coverage detected