Repository navigation
fix: skip missing-super-call when parent method lacks runtime implementation - #5469
Closed
Aayushyaash wants to merge 2 commits into
Closed
Aayushyaash wants to merge 2 commits into
Aayushyaash wants to merge 2 commits into
Conversation
Contributor
|
This pull request has been imported. If you are a Meta employee, you can view this in D128830191. (Because this pull request was imported automatically, there will not be any future comments.) |
|
Diff from mypy_primer, showing the effect of this PR on open source code: ============================================================
SUMMARY
============================================================
Total: +0 new errors, -28 fixed errors
By preset: +0/-0 (default), +0/-0 (strict)
Projects with changes (10):
pip: +0 -3
psycopg: +0 -2
mkdocs: +0 -3
rotki: +0 -5
pytest: +0 -3
jax: +0 -2
scikit-learn: +0 -4
hydra-zen: +0 -1
dedupe: +0 -2
xarray: +0 -3
============================================================
FULL DIFF DETAILS
------------------------------------------------------------
pip (https://github.com/pypa/pip)
- ERROR src/pip/_internal/build_env/noop.py:17:9-17: Method `NoOpBuildEnvironment.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/pip/_internal/build_env/venv.py:33:9-17: Method `VenvBuildEnvironment.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/pip/_internal/build_env/virtual.py:37:9-17: Method `VirtualBuildEnvironment.__init__` does not call the method of the same name in a parent class [missing-super-call]
psycopg (https://github.com/psycopg/psycopg)
- ERROR psycopg/psycopg/adapt.py:38:9-17: Method `Dumper.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR psycopg/psycopg/adapt.py:128:9-17: Method `Loader.__init__` does not call the method of the same name in a parent class [missing-super-call]
mkdocs (https://github.com/mkdocs/mkdocs)
- ERROR mkdocs/structure/nav.py:49:9-17: Method `Section.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR mkdocs/structure/nav.py:98:9-17: Method `Link.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR mkdocs/structure/pages.py:36:9-17: Method `Page.__init__` does not call the method of the same name in a parent class [missing-super-call]
rotki (https://github.com/rotki/rotki)
- ERROR rotkehlchen/chain/ethereum/modules/eth2/eth2.py:76:9-17: Method `Eth2.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR rotkehlchen/chain/ethereum/modules/liquity/trove.py:77:9-17: Method `Liquity.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR rotkehlchen/chain/ethereum/modules/makerdao/dsr.py:41:9-17: Method `MakerdaoDsr.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR rotkehlchen/chain/ethereum/modules/makerdao/vaults.py:136:9-17: Method `MakerdaoVaults.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR rotkehlchen/chain/ethereum/modules/pickle_finance/main.py:43:9-17: Method `PickleFinance.__init__` does not call the method of the same name in a parent class [missing-super-call]
pytest (https://github.com/pytest-dev/pytest)
- ERROR src/_pytest/capture.py:340:9-17: Method `NoCapture.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/_pytest/capture.py:363:9-17: Method `SysCaptureBase.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR src/_pytest/capture.py:465:9-17: Method `FDCaptureBase.__init__` does not call the method of the same name in a parent class [missing-super-call]
jax (https://github.com/google/jax)
- ERROR jax/_src/pallas/mosaic/interpret/vector_clock.py:37:7-15: Method `NpVectorClock.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR jax/_src/pallas/mosaic_gpu/interpret/shared_memory.py:430:7-15: Method `GpuClockBundle.__init__` does not call the method of the same name in a parent class [missing-super-call]
scikit-learn (https://github.com/scikit-learn/scikit-learn)
- ERROR sklearn/compose/_column_transformer.py:281:9-17: Method `ColumnTransformer.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR sklearn/ensemble/_base.py:216:9-17: Method `_BaseHeterogeneousEnsemble.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR sklearn/pipeline.py:219:9-17: Method `Pipeline.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR sklearn/pipeline.py:1711:9-17: Method `FeatureUnion.__init__` does not call the method of the same name in a parent class [missing-super-call]
hydra-zen (https://github.com/mit-ll-responsible-ai/hydra-zen)
- ERROR src/hydra_zen/typing/_implementations.py:147:9-17: Method `BuildsWithSig.__init__` does not call the method of the same name in a parent class [missing-super-call]
dedupe (https://github.com/dedupeio/dedupe)
- ERROR dedupe/levenshtein.py:12:9-17: Method `LevenshteinIndex.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR dedupe/tfidf.py:15:9-17: Method `TfIdfIndex.__init__` does not call the method of the same name in a parent class [missing-super-call]
xarray (https://github.com/pydata/xarray)
- ERROR xarray/indexes/nd_point_index.py:80:9-17: Method `ScipyKDTreeAdapter.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR xarray/namedarray/daskmanager.py:32:9-17: Method `DaskManager.__init__` does not call the method of the same name in a parent class [missing-super-call]
- ERROR xarray/tests/test_parallelcompat.py:69:9-17: Method `DummyChunkManager.__init__` does not call the method of the same name in a parent class [missing-super-call] |
Contributor
|
Thanks! |
stroxler
approved these changes
Oct 31, 2026
stroxler
left a comment
Contributor
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
Contributor
|
This pull request has been merged in 6d6dd07. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a subclass overrides a constructor-like method (
__init__,__new__, or__init_subclass__) whose parent method has no runtime implementation, such as an@abstractmethodor aProtocolmethod with an empty or placeholder body (...,pass, orraise NotImplementedError), Pyrefly can report a false-positivemissing-super-callerror.Previously, omitting
super()triggeredmissing-super-call, while explicitly callingsuper()could triggermissing-attributeorabstract-method-call. This occurred becauseget_super_attribute()rejects access to parent methods without runtime implementations throughsuper_method_needs_impl_reason()(updated in #5216 to returnNoAccessReason::SuperMethodNeedsImplementation).This PR updates
check_missing_super_call_for_field()to checkself.super_method_needs_impl_reason(&want_field)and skip thesuper()requirement when the resolved parent method has no runtime implementation. In multiple inheritance scenarios, the check continues across subsequent bases to ensure that concrete parent constructors are still called.Fixes #5430
Test Plan
Added regression tests in
pyrefly/lib/test/class_overrides.rscovering:...body without callingsuper().NotImplementedErrorwithout callingsuper().Protocolparent method without callingsuper().super()for the concrete parent is still reported.Validation: