This allows you to attach a record stringification function to ANY type, whether native Python, external library, extension C type or even internal Python. This is to allow recording of types RevDeBug does not know anything about. When the object representation is needed the object
.func() method will be called with
self as the object and should return a string. Exceptions in this function are suppressed. Also, when writing this simple function for stringifying an object please do not to start a new thread, process, or execute another program from within it. Also please avoid interactions with locks, semaphores and or thread-safe queues or other objects. This is all because this function is called from a critical section with thread switching disabled to avoid buffer corruption while serializing, so anything that waits for something from another thread will block indefinitely.