Skip to content

prevent writing from being continued if UVStream is already being flagged as closing#85

Merged
Vizonex merged 4 commits intomainfrom
stdin-bug
Oct 18, 2025
Merged

prevent writing from being continued if UVStream is already being flagged as closing#85
Vizonex merged 4 commits intomainfrom
stdin-bug

Conversation

@Vizonex
Copy link
Owner

@Vizonex Vizonex commented Oct 18, 2025

What do these changes do?

This new change helps us match more of uvloop's real functionallity like stopping a write(...) when a stream or transport is flagged as closing allowing us to easily capture invalid write(...) when close has already taken effect.

Are there changes in behavior for the user?

        if system.PLATFORM_IS_WINDOWS:
            # Winloop Comment: Winloop gets itself into trouble if this is
            # is not checked immediately, it's too costly to call the python function 
            # bring in the flag instead to indicate colusre.
            # SEE: https://github.com/Vizonex/Winloop/issues/84 
            if self._closing:
                raise RuntimeError("Cannot call write() when UVStream is closing")

Uvloop and Winloop should now be fine-tuned with all major writing utilities (That goes for sockets as well)

Is it a substantial burden for the maintainers to support this?

Nope.

Related issue number

Fixes #84

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

@Vizonex
Copy link
Owner Author

Vizonex commented Oct 18, 2025

@gschaffner I'll upload a new release once this is over. All tests have passed and I have added a system to match uvloop although I think this bug was a mistake on the windows operating system's part and not ours.

@Vizonex Vizonex merged commit 6711379 into main Oct 18, 2025
27 of 28 checks passed
@Vizonex Vizonex deleted the stdin-bug branch October 18, 2025 18:16
if system.PLATFORM_IS_WINDOWS:
# Winloop Comment: Winloop gets itself into trouble if this is
# is not checked immediately, it's too costly to call the python function
# bring in the flag instead to indicate colusre.
Copy link

Choose a reason for hiding this comment

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

- colusre
+ closure

Copy link
Owner Author

Choose a reason for hiding this comment

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

@maj113 Should be fixed now, thanks for the contribution.

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.

Process.stdin.[write&drain] succeeds after the pipe is closed

2 participants