You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
doctest fails to collect tests from a C function that has been wrapped #117692
doctest.DocTestFinder is now failing to collect examples from functions that are defined in C and then wrapped. It still works just fine with functions that are defined in C but that are not wrapped.
A fix has been merged, and backported to 3.12. Unfortunately, I think it probably can't be backported to 3.11 due to 3.11 now being in security-only mode; I'll let @pablogsal reopen if he thinks this warrants an exception
@pablogsal The regression introduced in #115440 was released in the final bugfix of Python 3.11, meaning this bug will remain present indefinitely on that version of Python. I'm unsure if that's happened before, but it means that bugs like jaraco/path#231 have no proper fix until Python 3.11 is sunset. I can't even think of a good workaround, short of disabling doctests on all Python versions or finding some way to disable doctests in pytest for a specific Python version. Do you know if it's happened before that a regression has been introduced in the last bugfix release for a minor version?
I think this bug deserves consideration for an extra bugfix patch release (maybe a selective one against 3.11.9 with only this bugfix).
I think this bug deserves consideration for an extra bugfix patch release (maybe a selective one against 3.11.9 with only this bugfix).
That would certainly be very helpful to me. I maintain several domain-specific scientific Python packages with doctests affected by this, and I have had to skip the doctests for Python 3.11, which makes me nervous given that I still claim that I support that version.
I think it makes sense and I am happy to back port and batch this into the next security update of 3.11.
Works for me.
The problem with only rolling the fix into a security-only release is that the installers (and others) don't get updated with security updates, so users of the installers will be perpetually stuck with the bug. I worry that things like GitHub CI on Windows may just use the latest installer and thus may not pick up the fix. I guess we can see how many environments that leaves without a solution. Hopefully the intersection of that with projects that rely on doctests is exceedingly small.
I think this bug deserves consideration for an extra bugfix patch release (maybe a selective one against 3.11.9 with only this bugfix).
I think it makes sense and I am happy to back port and batch this into the next security update of 3.11.
@pablogsal I was making the case for making another non-security-only release with this fix, so that the most recent packaged release will include the bugfix, even if it's 3.11.9.1 or 3.11.9+1 or similar). I realize this falls out of the standard operating procedure for Python releases, but without some special handling, this bug will exist essentially in perpetuity in the Python 3.9 line. Since the issue was introduced in the latest non-security release, I think that deserves another non-security release to address the regression.
Activity
sobolevn commentedon Apr 9, 2024
Shorter repro on
main:sobolevn commentedon Apr 9, 2024
Looks like I might have an idea on how to fix it! Thanks a lot for the report! 👍
pythongh-117692: Fix `AttributeError` in `DocTestFinder` on wrapped `…
Temporarily pin Python patch version for tests
gh-117692: Fix `AttributeError` in `DocTestFinder` on wrapped `builti…
pythongh-117692: Fix `AttributeError` in `DocTestFinder` on wrapped `…
[3.12] gh-117692: Fix `AttributeError` in `DocTestFinder` on wrapped …
AlexWaygood commentedon Apr 10, 2024
A fix has been merged, and backported to 3.12. Unfortunately, I think it probably can't be backported to 3.11 due to 3.11 now being in security-only mode; I'll let @pablogsal reopen if he thinks this warrants an exception
pythongh-117692: Fix `AttributeError` in `DocTestFinder` on wrapped `…
jaraco commentedon Jul 27, 2024
@pablogsal The regression introduced in #115440 was released in the final bugfix of Python 3.11, meaning this bug will remain present indefinitely on that version of Python. I'm unsure if that's happened before, but it means that bugs like jaraco/path#231 have no proper fix until Python 3.11 is sunset. I can't even think of a good workaround, short of disabling doctests on all Python versions or finding some way to disable doctests in pytest for a specific Python version. Do you know if it's happened before that a regression has been introduced in the last bugfix release for a minor version?
I think this bug deserves consideration for an extra bugfix patch release (maybe a selective one against 3.11.9 with only this bugfix).
Disable doctests on Python 3.11.9+ but not 3.12.
lpsinger commentedon Aug 12, 2024
That would certainly be very helpful to me. I maintain several domain-specific scientific Python packages with doctests affected by this, and I have had to skip the doctests for Python 3.11, which makes me nervous given that I still claim that I support that version.
pablogsal commentedon Aug 13, 2024
I think it makes sense and I am happy to back port and batch this into the next security update of 3.11.
jaraco commentedon Aug 13, 2024
Works for me.
The problem with only rolling the fix into a security-only release is that the installers (and others) don't get updated with security updates, so users of the installers will be perpetually stuck with the bug. I worry that things like GitHub CI on Windows may just use the latest installer and thus may not pick up the fix. I guess we can see how many environments that leaves without a solution. Hopefully the intersection of that with projects that rely on doctests is exceedingly small.
lpsinger commentedon Aug 14, 2024
That would be fine with me. My affected packages don't even build on Windows!
lpsinger commentedon Dec 5, 2024
Any update on backporting this?
jaraco commentedon Dec 28, 2024
@pablogsal I was making the case for making another non-security-only release with this fix, so that the most recent packaged release will include the bugfix, even if it's 3.11.9.1 or 3.11.9+1 or similar). I realize this falls out of the standard operating procedure for Python releases, but without some special handling, this bug will exist essentially in perpetuity in the Python 3.9 line. Since the issue was introduced in the latest non-security release, I think that deserves another non-security release to address the regression.