Fix bad-dunder-name false positives for __prepare__, __mro_entries__, __buffer__, __release_buffer__ and __replace__ #11793
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 181 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.311
Real PR Conversation Timeline
1 comments
"Review active on #11793"
general
weight: 0.35
chrikrah
Type of Changes
| | Type |
| --- | ---------------------- |
| ✓ | :bug: Bug fix |
| | :sparkles: New feature |
| | :hammer: Refactoring |
| | :scroll: Docs |
Description
bad-dunder-namereported five valid data model methods because they were missing fromEXTRA_DUNDER_METHODSinpylint/constants.py(same kind of gap as #8613 and #10435):__prepare__(PEP 3115) and__mro_entries__(PEP 560): added to the(0, 0)list, since they exist on every supported Python version.__buffer__/__release_buffer__(PEP 688): added under(3, 12).__replace__(used bycopy.replace()): added under(3, 13).Because they are version-gated, the 3.12/3.13 names are still reported when
py-versionis older, matching how_add_alias_/_add_value_alias_are handled.I put them in
EXTRA_DUNDER_METHODSrather thanDUNDER_METHODSso this change does not also start emittingunnecessary-dunder-callfor explicit calls to them; that could be a separate follow-up if wanted.Tests: two new functional tests in
tests/functional/ext/bad_dunder/:bad_dunder_name_py313(py-version=3.13): all five methods are accepted.bad_dunder_name_py311(py-version=3.11):__prepare__/__mro_entries__are accepted, while__buffer__,__release_buffer__and__replace__are still reported.Both fail without the change and pass with it.
Closes #11791