Fix critical IndentationError preventing script execution#371
Merged
Conversation
Remove unreachable dead code after return statement that was causing: IndentationError: expected an indented block after 'for' statement on line 940 The code after 'return False' at line 936 was unreachable and contained an empty for loop, which is a syntax error in Python. Fixes the syntax error preventing script execution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Merging to
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical IndentationError that prevented the script from executing. The error was caused by dead code (lines 938-940) that was unreachable within the except block of the validate_hostname() function. These lines appeared after a return False statement and included an empty for loop, which Python flagged as a syntax error.
Changes:
- Removed 4 lines of unreachable dead code from
validate_hostname()function - Fixed
IndentationErrorthat prevented module import - No functional changes (removed code was never executed)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The script has a critical syntax error that prevents it from running at all:
This was introduced in a previous commit and completely blocks script execution.
Root Cause
Lines 938-940 in the
validate_hostname()function contained unreachable dead code after areturn Falsestatement:The empty
forloop on line 940 triggers an IndentationError because Python expects an indented block after theforstatement.Solution
Goal and rationale: Fix the critical syntax error that prevents the script from running. This is a blocking bug that must be resolved immediately before any other work can proceed.
Approach: Remove the unreachable dead code (lines 938-940) that appears after a
return Falsestatement. This code was never executed and the emptyforloop caused a syntax error.Impact:
Validation:
python3 -m py_compile main.pynow passes (was failing before)Future work: Once this is merged, the script will be functional again and other pending issues can be addressed. This unblocks:
This is a critical bugfix that unblocks all script functionality.