Skip to content

Conversation

@pjonsson
Copy link
Contributor

@pjonsson pjonsson commented Nov 12, 2025

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 the StreamMixer
makes 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.

#
# 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():
Copy link
Contributor Author

@pjonsson pjonsson Nov 13, 2025

Choose a reason for hiding this comment

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

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.

@kdeldycke
Copy link
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
@pjonsson pjonsson force-pushed the namedtextiowrapper-no-close branch from 1768022 to 0813e7b Compare November 20, 2025 13:51
@pjonsson
Copy link
Contributor Author

pjonsson commented Dec 5, 2025

Someone commented about their success with this in my fork: pjonsson@0813e7b#commitcomment-172085876

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.

3 participants