cool-RR / PySnooper

Never use print for debugging again
MIT License
16.31k stars 954 forks source link

Add support for infinite depth tracing and fix pytest warning #235

Open elijahqi opened 1 year ago

elijahqi commented 1 year ago

Description:

This pull request introduces two improvements to the codebase:

  1. Infinite depth support: Added support for infinite depth function call tracing by allowing the depth parameter to be set to float('inf'). This enables tracing of recursive functions without a predefined depth limit. A new test case, test_infinite_depth_support.py, has been added to verify the correct behavior of this feature.
  2. Fix pytest warning: Modified the current_thread.getName() call to current_thread.name to avoid pytest warnings. Updated the thread_info variable assignment accordingly:
    
    thread_info = "{ident}-{name} ".format(
    ident=current_thread.ident, name=current_thread.name)

3. Optimization for large depth values: Updated the frame tracing code to prevent tracing of imported libraries when a large depth value is provided. This helps avoid unnecessary tracing and improves performance.

Please review the changes and let me know if you have any questions or suggestions.
cool-RR commented 1 year ago

Thank you, but please separate the 3 issues into 3 separate PRs. You could either do them in parallel, or wait to finish with one before continuing the other, whichever is more convenient for you. Then I'll review.

elijahqi commented 1 year ago

Ok, Thanks, will do that!