Skip to content

Conversation

@blhsing
Copy link
Contributor

@blhsing blhsing commented May 23, 2025

self.flush()
except RecursionError: # See issue 36272
raise
except BrokenPipeError:
Copy link
Member

@picnixz picnixz May 23, 2025

Choose a reason for hiding this comment

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

You can add a "See issue XXXX" as above for the RecursionError maybe. However, shouldn't we give the possibility to handle the error? maybe BrokenPipeError is coming from somewhere else? Here, you're redirecting sys.stdout but what if it's because of self.stream? (I don't know which is why I ask)

except BrokenPipeError:
devnull = os.open(os.devnull, os.O_WRONLY)
os.dup2(devnull, sys.stdout.fileno())
sys.exit(1)
Copy link
Member

Choose a reason for hiding this comment

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

Huh, why are we exiting the process?

raise
except BrokenPipeError:
devnull = os.open(os.devnull, os.O_WRONLY)
os.dup2(devnull, sys.stdout.fileno())
Copy link
Member

Choose a reason for hiding this comment

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

Won't this have weird side-effects? Any future stdout writes won't show up.

@vsajip
Copy link
Member

vsajip commented May 24, 2025

See also my comments on the issue.

@vsajip
Copy link
Member

vsajip commented May 26, 2025

Closing as per comments on the issue.

@vsajip vsajip closed this May 26, 2025
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.

4 participants