Le jeu. 16 mai 2019 à 23:46, Nathaniel Smith <n...@pobox.com> a écrit : > A clever hook might want the actual object, so it can pretty-print it, > or open an interactive debugger and let it you examine it, or > something. Morally this is similar to calling repr(obj), but it > doesn't literally call repr(obj).
Good point. By the way, I started to use tracemalloc.get_object_traceback(obj) to display where the object comes from more and more often :-D It helps me at least in debugging. So yeah, I would prefer to pass directly the object to the hook. For example, I'm using it with the "source" parameter of a ResourceWarning: https://pythondev.readthedocs.io/debug_tools.html#resourcewarning But also when a buffer underflow or overflow is detected by debug hooks on Python memory allocators: https://pythondev.readthedocs.io/debug_tools.html#pythonmalloc-debug It might also help me sometimes to be able to call tracemalloc.get_object_traceback(obj) from a custom unraisablehook(). Victor -- Night gathers, and now my watch begins. It shall not end until my death. _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com