-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
[3.11] gh-87846: test_io: Ignore OpenWrapper in test___all__ #126478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The deprecated `OpenWrapper` is added to the module on demand in `__getattr__`, so it might or might not show up in `dir(io)` depending on whether e.g. `test_openwrapper` was run. Add it to `not_exported` so that check__all__ ignores it when it exists. The test consistently failed on some refleaks buildbots (but not when the test is re-run, so it was only marked as a warning). Locally, it can be reproduced by running `test_openwrapper` and `test__all__`, twice: ./python -m test test_io test_io -m '*test_[o_][p_][ea][nl][wl]*' -v
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I'm fine to backport since this is a change in tests |
After this was merged, all the 3.11 refleaks buildbots turned red. But, that's an improvement! There's a pre-existing refleak that was hidden like this:
I'll find and write/backport a fix. (update: see #111942) |
…e_encoding There's an issue with the 3.11 backport commit e2421a3 The chane for the main branch was: ```diff + Py_INCREF(errors); ... Py_SETREF(self->encoding, encoding); - Py_SETREF(self->errors, Py_NewRef(errors)); + Py_SETREF(self->errors, errors); ``` but in 3.11 this became: ```diff + Py_INCREF(errors); ... Py_INCREF(errors); Py_SETREF(self->encoding, encoding); Py_SETREF(self->errors, errors); ``` i.e. there's an extra incref, but it looks -- at least to Git -- like the change that removes `Py_NewRef` was already applied. This was not caught because `test_io` refleaks tests were ineffective on 3.11 (see python#126478 (comment)). Remove the extraneous incref.
FWTW, 3.10 is unaffected: it doesn't have #111370. |
@pablogsal, are you interested in fixing 3.11 buildbots that consistently warn, rather than fail?
test_io
fails iftest_openwrapper
runs beforetest___all__
. This consistently happens on some refleaks buildbots, for example Windows or Fedora, but it's only marked as a warning: when onlytest___all__
is re-run in a fresh process, it succeeds.Locally, this can be reproduced by running
test_openwrapper
andtest__all__
, twice (since in a single run,test_openwrapper
comes aftertest___all__
). I don't know of a more elegant way than:The reason is that the deprecated
OpenWrapper
is added to the module on demand in__getattr__
, after which it shows up indir(io)
.Add it to
not_exported
so thatcheck__all__
ignores it when it exists.