-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
gh-113407: Fix import of unittest.mock when CPython is built without docstrings #113408
gh-113407: Fix import of unittest.mock when CPython is built without docstrings #113408
Conversation
serhiy-storchaka
commented
Dec 22, 2023
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Importing unittest.mock fails when CPython is built without docstrings #113407
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.
I'm worried about what needs these to be there in the first place breaking.
I'm also curious: why would you want to build a python distribution without docstrings?
if _CODE_SIG: | ||
code_mock = NonCallableMock(spec_set=_CODE_ATTRS) | ||
code_mock.__dict__["_spec_class"] = CodeType | ||
code_mock.__dict__["_spec_signature"] = _CODE_SIG |
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.
What functionality is lost by having _spec_class
and _spec_signature
missing here?
These were evidently there for a reason, but if no tests are failing without them that suggest they might be superfluous and could be dropped completely, or, more likely, that there's tests coverage that needs adding.
The backport has 100% line coverage checking as part of its CI, so I'm a little surprised.
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.
Was not it a pure optimization in #83076? This PR simply disables it if the signature is not available and makes the code to go the old way.
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.
Yeah, I guess if there's no signature available then there's no code signature available.
Where do we go to see the test suite running (and passing after this PR!) with docstrings disabled?
Building a python distribution without docstrings is a supported feature. Currently the mock module is broken in this configuration, and it affects many tests. |
I didn't say it wasn't, I asked why would you want to build a python distribution without docstrings. |
I have no other reasons except supporting Python bug-free in all configurations. We do no have buildbots for all possible combinations of configuration options, so we depend on manual testing here. Time from time we test and fix builds in nonstandard configurations, but last time it was years ago. There was an old issue #81682 with an outdated PR, and it is the reason why I do this right now. |
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
GH-113454 is a backport of this pull request to the 3.12 branch. |
…thout docstrings (pythonGH-113408) (cherry picked from commit 0c57454) Co-authored-by: Serhiy Storchaka <[email protected]>
…ithout docstrings (GH-113408) (GH-113454) (cherry picked from commit 0c57454) Co-authored-by: Serhiy Storchaka <[email protected]>