Remove overlapping slots and fix broken slots inheritance - #6547
Conversation
|
Would be great if you could add this test to the linter step in CI. Then we can avoid introducing new overlaps in future. |
|
@Dreamsorcerer You mean in - name: Run linters
run: |
make mypy
make slotscheck # after adding slotscheck to MakefileAlternatively I can add the hook to the |
That looks fine to me. Not sure it needs to go in the Makefile. But, I'd make it a separate step (and probably rename that existing step to 'Run Mypy'). I meant lint job earlier, rather than linter step.. |
Can do. I'm curious though: what's the reasoning behind what goes in pre-commit vs GitHub workflow? |
Codecov Report
@@ Coverage Diff @@
## master #6547 +/- ##
=======================================
Coverage 93.36% 93.36%
=======================================
Files 104 104
Lines 30506 30509 +3
Branches 3068 3069 +1
=======================================
+ Hits 28482 28485 +3
Misses 1850 1850
Partials 174 174
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Probably a question for someone else. I'd assume that pre-commit is being run as a git hook, so it makes sense to have primarily fast checks which are likely to catch mistakes. If it only catches an error for 1 in 500 PRs or something, it's probably best not delaying a developer's commit. But, not sure if that's what has been done so far, I didn't set up anything in pre-commit and don't really mind which way it goes in. |
Indeed, problems with slots probably won't occur in most PRs. I'll add it to the GH workflow for now. |
|
Thanks! |
|
@Dreamsorcerer @ariebovenberg does anybody remember why this never got backported to stable branches? |
Backport to 3.15: 💔 cherry-picking failed — conflicts found❌ Failed to cleanly apply 65de218 on top of patchback/backports/3.15/65de218c6297284663eeae5c07e9146ef1e4485e/pr-6547 Backporting merged PR #6547 into master
🤖 @patchback |
| # Some extra requirements are needed to ensure all modules | ||
| # can be scanned by slotscheck. | ||
| pip install -r requirements/base.txt -c requirements/constraints.txt | ||
| slotscheck -v -m aiohttp |
There was a problem hiding this comment.
@Dreamsorcerer I think we need to figure this out: #13466
What do these changes do?
There were a few
__slots__related mistakes:Fixing the second error was more problematic than it seems. The straightforward solution of adding
__slots__ = ('_cookies', )was not possible, because this triggered aTypeError: multiple bases have instance lay-out conflictinHTTPExceptionsince non-emptly slots cannot be combined with anExceptioncase class:There are several possible solutions:
CookieMixin, since it's an abstract class. This is the currently implemented solution.__slots__inStreamResponsewill be mostly ineffective.__slots__fromStreamResponse. They aren't saving memory or preventing__dict__from being created.Are there changes in behavior for the user?
StreamResponsewill no longer have a__dict__, so arbitrary attributes cannot be set. This is not documented, so likely not a problemRelated issue number
No issue. This is a small change.
Checklist
Unit tests for the changes existn/a (see questions below)Documentation reflects the changesn/aCONTRIBUTORS.txtCHANGESfolder<issue_id>.<type>for example (588.bugfix)issue_idchange it to the pr id after creating the pr.feature: Signifying a new feature..bugfix: Signifying a bug fix..doc: Signifying a documentation improvement..removal: Signifying a deprecation or removal of public API..misc: A ticket has been closed, but it is not of interest to users.Questions