Skip to content

Conversation

@WSXYT
Copy link
Collaborator

@WSXYT WSXYT commented Jan 11, 2026

开始打包

Copilot AI review requested due to automatic review settings January 11, 2026 14:49
@lzy98276 lzy98276 merged commit 3139292 into SECTL:master Jan 11, 2026
8 of 10 checks passed
Copy link
Contributor

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 adds null checks for sys.stdout and sys.stderr before flushing them, which is necessary when packaging Python applications for distribution. In packaged GUI applications, these standard streams can be None, and attempting to flush them would cause an AttributeError.

Changes:

  • Added defensive null checks before flushing standard output and error streams in two exit paths

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +205 to +208
if sys.stdout:
sys.stdout.flush()
if sys.stderr:
sys.stderr.flush()
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

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

The condition if sys.stdout: may not be sufficient for packaged applications. In some environments, sys.stdout might be a non-None object that doesn't support the flush operation, or could be a redirected stream. Consider using a try-except block around the flush operations instead, which would be more robust and handle edge cases where the stream exists but flush() fails.

Copilot uses AI. Check for mistakes.
Comment on lines +260 to +263
if sys.stdout:
sys.stdout.flush()
if sys.stderr:
sys.stderr.flush()
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

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

The condition if sys.stdout: may not be sufficient for packaged applications. In some environments, sys.stdout might be a non-None object that doesn't support the flush operation, or could be a redirected stream. Consider using a try-except block around the flush operations instead, which would be more robust and handle edge cases where the stream exists but flush() fails.

Copilot uses AI. Check for mistakes.
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.

2 participants