Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-113407: Fix import of unittest.mock when CPython is built without docstrings#113408
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 ourterms of service andprivacy 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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
cjw296 left a comment
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?
serhiy-storchaka commentedDec 23, 2023
Building a python distribution without docstrings is a supported feature. Currently the mock module is broken in this configuration, and it affects many tests. |
cjw296 commentedDec 24, 2023
I didn't say it wasn't, I asked why would you want to build a python distribution without docstrings. |
serhiy-storchaka commentedDec 24, 2023
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 the3.12 branch. |
…thout docstrings (pythonGH-113408)(cherry picked from commit0c57454)Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Uh oh!
There was an error while loading.Please reload this page.