Skip to content

Commit

Permalink
Change assertion into the loop invariant
Browse files Browse the repository at this point in the history
  • Loading branch information
Bajron committed Jan 30, 2024
1 parent d6c0b96 commit 6e0f2ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dotenv/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@ def _is_interactive():
frame = sys._getframe()
current_file = __file__

while frame.f_code.co_filename == current_file or not os.path.exists(
frame.f_code.co_filename
while frame.f_back is not None and (
frame.f_code.co_filename == current_file
or not os.path.exists(frame.f_code.co_filename)
):
assert frame.f_back is not None
frame = frame.f_back
frame_filename = frame.f_code.co_filename
path = os.path.dirname(os.path.abspath(frame_filename))
Expand Down

0 comments on commit 6e0f2ae

Please sign in to comment.