gh-135410: Fix test_memoryio refleak buildbots#135430
Closed
Uh oh!
There was an error while loading. Please reload this page.
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 problem is that we were testing both
_pyio.StringIOand_io.StringIO. The former, in_pyio, isn't really thread-safe (but it doesn't crash, and that's what we care about). I'm not sure why it only revealed itself on the refleak buildbots, but it's probably something about the threads being slower.Anyways, I'm fixing this by only testing the C implementation of
StringIO. Making the Python version thread-safe is a separate project that we shouldn't deal with here. I also changed theassertIsNoneto anifthat actually raises the exception, so we get a better traceback when dealing with failures.StringIOmethods in threads on free-threading debug build #135410