Skip to content

Restore parenthesized except clause in ImportrrScheduler.run - #68

Closed
curfew-marathon wants to merge 1 commit into
mainfrom
fix/except-clause-python2-syntax
Closed

curfew-marathon wants to merge 1 commit into
mainfrom
fix/except-clause-python2-syntax

Conversation

@curfew-marathon

@curfew-marathon curfew-marathon commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • PR Add type hints, pin Docker/Python version, raise coverage floor #67 accidentally dropped the parentheses around except (KeyboardInterrupt, SystemExit):, leaving except KeyboardInterrupt, SystemExit:.
  • That line only parses because PEP 758 (Python 3.14+) allows unparenthesized exception tuples. It works on this project's pinned Python 3.15, but is a SyntaxError on any Python 3 version before 3.14, and reads identically to invalid Python 2 syntax.
  • Restores the explicit tuple form so the behavior is unchanged but the code is portable and unambiguous.

Test plan

  • Confirmed the broken line still parses and behaves correctly under local Python 3.14.7 (relying on PEP 758), explaining why CI didn't catch it.
  • Did not run the full pytest --cov suite or ruff/mypy locally (tools not available in this environment); this is a one-line revert to the prior, already-tested syntax.

Summary by CodeRabbit

  • No user-facing changes
    • This update does not change application features or behavior. It includes a small internal code adjustment to how shutdown-related interruptions are handled.

PR #67 dropped the parentheses around except (KeyboardInterrupt, SystemExit),
leaving except KeyboardInterrupt, SystemExit. That only parses because PEP
758 (Python 3.14+) permits unparenthesized exception tuples, so it happens to
work on this project's pinned Python 3.15, but it is a SyntaxError on any
earlier Python 3 interpreter and is indistinguishable from invalid Python 2
syntax at a glance. Restoring the tuple form keeps the behavior unchanged
while making it portable and unambiguous.
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Walkthrough

The ImportrrScheduler.start handler now catches KeyboardInterrupt and SystemExit together with a parenthesized exception tuple.

Changes: Scheduler exception handling

Layer / File(s) Summary
Group shutdown exceptions
src/importrr/launch.py
The start handler groups KeyboardInterrupt and SystemExit in a valid exception tuple. Both use the existing shutdown log path.

Priority: Not assessed

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Moderate · up to 8d3c0

The PR preserves older-Python compatibility but currently cannot pass the required Ruff formatting check; configure Ruff or add a narrow exemption before merging.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@curfew-marathon

Copy link
Copy Markdown
Owner Author

Closing without merging: ruff format --check actively enforces the unparenthesized except (KeyboardInterrupt, SystemExit) form as canonical for target-version = py315 (PEP 758), so this change fights the project's own formatter. Confirmed CI (ruff format --check) rejects the parenthesized form. Main's existing syntax is correct and intentional given the pinned Python 3.15 target; no fix needed.

@curfew-marathon
curfew-marathon deleted the fix/except-clause-python2-syntax branch October 25, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant