Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor fix to uninstall_recursionlimit_wrappers()
  • Loading branch information
taleinat committed Jun 11, 2019
commit 9ddd699600d23116e2577acdb2ce9dac6ea0fe8b
4 changes: 2 additions & 2 deletions Lib/idlelib/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ def getrecursionlimit():
def uninstall_recursionlimit_wrappers():
"""Uninstall the recursion limit wrappers from the sys module."""
Copy link
Copy Markdown
Member

@terryjreedy terryjreedy Jul 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is (only) needed for tests. Add line "# Needed for tests." so function is never deleted as 'unused'. (I have made similar notes for other test-only code.)
<Done.>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would it be deleted if it is used in test code? Even if it were deleted, the tests would immediately break!

Also, there's no telling who might find other uses for this in the future.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me start over. I initially wasted time looking for where this was used in run.py. I like to mark test code (code we/IDLE only use as such). So I moved the comment, reworded, into the docstring and added a note that users could also use this. (Yeah, one of use might want to do so sometime.) I think that this is an improvement.

if (
getattr(sys.setrecursionlimit, '__wrapped__') and
getattr(sys.getrecursionlimit, '__wrapped__')
getattr(sys.setrecursionlimit, '__wrapped__', None) and
getattr(sys.getrecursionlimit, '__wrapped__', None)
):
sys.setrecursionlimit = sys.setrecursionlimit.__wrapped__
sys.getrecursionlimit = sys.getrecursionlimit.__wrapped__
Expand Down