ionelmc / python-hunter

Hunter is a flexible code tracing toolkit.
https://python-hunter.readthedocs.io/
BSD 2-Clause "Simplified" License
796 stars 46 forks source link

How to avoid object memory reference in output? #58

Closed guettli closed 5 years ago

guettli commented 5 years ago

I have bug which only appears on one system, not on other systems.

I want to trace a script and compare the output.

I run it once in the buggy environment, and once in the working environment.

There are two times 40k lines output. I use a diff-tool (meld) to compare both traces.

It works ... mostly.

Unfortunately there a lot of lines like this: __init__(self=<foolib.FooClass object at 0x7fc6dc14b600>)

The diff tool marks these lines as different.

How to make hunter stop printing the memory address (0x7fc6dc14b600)?

It would be very nice if this would be solveable without changing the code. I use the PYTHONHUNTER environment variable to enable tracing.

ionelmc commented 5 years ago

Well if you need something right now then either (monkey)patch rudimentary_repr in utils.py or sed the address out of the output.

I'll consider allowing users using their own repr functions in a future version.

guettli commented 5 years ago

I'll consider allowing users using their own repr functions in a future version.

This would be great.

guettli commented 5 years ago

thank you very much for adding this.

ionelmc commented 5 years ago

Hunter 3.0 is released.