Opened 3 weeks ago
Last modified 3 weeks ago
#37102 assigned Bug
CountsDict.__init__() passes *kwargs instead of **kwargs to super().__init__()
| Reported by: | 王鑫 | Owned by: | SnippyCodes |
|---|---|---|---|
| Component: | Utilities | Version: | 6.0 |
| Severity: | Normal | Keywords: | |
| Cc: | 王鑫 | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
The CountsDict class in django/utils/html.py has a bug in its init method:
class CountsDict(dict): def __init__(self, *args, word, **kwargs): super().__init__(*args, *kwargs) # BUG: should be **kwargs self.word = wordThe call uses *kwargs (positional unpacking) instead of kwargs (keyword unpacking). Currently this never triggers because CountsDict is only called with
word=middle, but it would fail if any keyword arguments were passed.
The fix is to change *kwargs to kwargs on line 281.
Change History (8)
comment:1 by , 3 weeks ago
| Description: | modified (diff) |
|---|
comment:2 by , 3 weeks ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:3 by , 3 weeks ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
follow-up: 6 comment:4 by , 3 weeks ago
| Owner: | changed from to |
|---|
follow-up: 7 comment:5 by , 3 weeks ago
| Has patch: | set |
|---|
comment:6 by , 3 weeks ago
| Owner: | removed |
|---|---|
| Status: | assigned → new |
Replying to Tim Graham:
The report already provided a PR which was automatically closed since the ticket wasn't yet accepted.
The reporter provided about 6 PRs, some of which I had to manually close because they deleted the reference to the ticket and mixed in unrelated typo fixes in an effort to evade the quality bot. I suggest discouraging the original owner from reassuming ownership. We don't tolerate aggressive AI agents.
comment:7 by , 3 weeks ago
Replying to Fergal McCollam:
Thanks for the PR, you can assign to yourself if you wish, but take note that the provided tests do not fail when run against main, so they aren't sufficient for a regression test. (You need to pass keyword args besides word.)
comment:8 by , 3 weeks ago
| Owner: | set to |
|---|---|
| Status: | new → assigned |
The report already provided a PR which was automatically closed since the ticket wasn't yet accepted.