Skip to content

Fix critical IndentationError preventing script execution#371

Merged
abhimehro merged 1 commit intomainfrom
fix-indentation-error-main-072dd2e384d372f3
Feb 19, 2026
Merged

Fix critical IndentationError preventing script execution#371
abhimehro merged 1 commit intomainfrom
fix-indentation-error-main-072dd2e384d372f3

Conversation

@github-actions
Copy link

Problem

The script has a critical syntax error that prevents it from running at all:

IndentationError: expected an indented block after 'for' statement on line 940

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 a return False statement:

            return False

            if not addr_info:      # ← unreachable
                return False       # ← unreachable  
            for res in addr_info:  # ← empty for loop = syntax error

The empty for loop on line 940 triggers an IndentationError because Python expects an indented block after the for statement.

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 False statement. This code was never executed and the empty for loop caused a syntax error.

Impact:

  • Before: Script cannot run at all - immediate syntax error on import
  • After: Script runs normally
  • Files changed: main.py (removed 4 lines of unreachable code)

Validation:

  • python3 -m py_compile main.py now passes (was failing before)
  • ✅ Script can be imported without syntax errors
  • ✅ No functional changes - only removed unreachable dead code

Future work: Once this is merged, the script will be functional again and other pending issues can be addressed. This unblocks:

  • All test execution
  • PR reviews that require running the code
  • Any development work requiring script imports

This is a critical bugfix that unblocks all script functionality.

AI generated by Daily Backlog Burner

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>
@trunk-io
Copy link

trunk-io bot commented Feb 19, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

@abhimehro abhimehro marked this pull request as ready for review February 19, 2026 23:41
Copilot AI review requested due to automatic review settings February 19, 2026 23:41
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 IndentationError that prevented module import
  • No functional changes (removed code was never executed)

@abhimehro abhimehro merged commit e8e6e25 into main Feb 19, 2026
12 checks passed
@abhimehro abhimehro deleted the fix-indentation-error-main-072dd2e384d372f3 branch February 19, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants