Fix AttributeError in convert_osc when winterm is None - #417
Open
worksbyfriday wants to merge 1 commit into
Open
Fix AttributeError in convert_osc when winterm is None#417worksbyfriday wants to merge 1 commit into
worksbyfriday wants to merge 1 commit into
Conversation
On non-Windows platforms (where winterm is None), calling write() with OSC title-setting sequences crashes with AttributeError: 'NoneType' object has no attribute 'set_title' when strip=True and convert=False. Add a guard consistent with the existing pattern used in get_win32_calls() and call_win32(). Fixes tartley#407
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.
Summary
Fixes #407.
On non-Windows platforms,
wintermisNone. Whenwrite()receives text containing OSC title-setting sequences (e.g.,\033]0;title\a) andstrip=True,convert_osc()unconditionally callswinterm.set_title(), which crashes with:Reproduction:
Fix
Added a
self.convert and wintermguard before callingwinterm.set_title(), consistent with the existing pattern used inget_win32_calls()(line 132) andcall_win32().Test
Added
test_osc_codes_without_wintermthat verifies OSC sequences don't crash whenwintermisNone.