Skip to content

Remove unnecessary finally statement#555

Merged
andfoy merged 1 commit intoandfoy:mainfrom
zedzhen:patch-1
Jan 29, 2026
Merged

Remove unnecessary finally statement#555
andfoy merged 1 commit intoandfoy:mainfrom
zedzhen:patch-1

Conversation

@zedzhen
Copy link
Contributor

@zedzhen zedzhen commented Jan 27, 2026

Fix #554
In this case, we don't need finally at all.

            if pty.iseof():
                try:
                    client.send(b'')
                except socket.error:
                    pass
                break

If there is no exception, the break will be executed.
Else if the exception is socket.error or child, then the break will be executed.
Else if the exception is Exception or a child, it will be caught by except Exception as e: and a break will be executed there.
Else function is stop now.

Thus, the behavior is equivalent to the old one.

@andfoy
Copy link
Owner

andfoy commented Jan 29, 2026

Thanks for the cleanup @zedzhen!

@andfoy andfoy merged commit b926298 into andfoy:main Jan 29, 2026
8 checks passed
@andfoy andfoy changed the title Fix #554 Remove unnecessary finally statement Jan 30, 2026
@andfoy andfoy added this to the v3.0.3 milestone Feb 4, 2026
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.

SyntaxWarning in Python 3.14+ (PEP 765)

2 participants