NamedTextIOWrapper: stop closing buffer#3139
Open
pjonsson wants to merge 1 commit intopallets:stablefrom
Open
Conversation
6438cd6 to
d03a84f
Compare
pjonsson
commented
Nov 13, 2025
| # | ||
| # Test needs to be run as "pytest --log-cli-level 30 tests/test_testing_logging.py" | ||
| # to test the intended functionality. | ||
| def test_runner_logger(): |
Contributor
Author
There was a problem hiding this comment.
I need help with how to get this test file to also be run with pytest --log-cli-level 30 tests/test_testing_logging.py automatically.
Edit: my thought was to try to prevent future regressions by adding this test and running it with the right --log-cli-level parameter to pytest, but just having the test in the test suite is also an improvement over the current state since it makes it easier to run the test by hand.
d03a84f to
1768022
Compare
Collaborator
|
FYI, these changes does not fix the issues uncovered from #3151. |
The NamedTextIOWrapper is closing the buffers that are owned by the StreamMixer, so implement a close() method that prevents it from doing that. Refs pallets#824 Refs pallets#2993
1768022 to
0813e7b
Compare
Contributor
Author
|
Someone commented about their success with this in my fork: pjonsson@0813e7b#commitcomment-172085876 |
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.
The NamedTextIOWrapper is closing the buffers
that are owned by the StreamMixer, so
implement a close() method that prevents
it from doing that.
Refs #824
Refs #2993
Previous PR for the same issue: #2991
Just removing the
__del__on theStreamMixermakes the test in #2993 fail for me when using
the free-threaded Python 3.14 in uv. The test
starts passing again when adding the no-op
close()on_NamedTextIOWrapper.