What should the type of super() be?

Open
#2,956 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
devtools

Research direction

Reproduce the mypy 0.501 error using the code in zerver/storage.py, focusing on the type: ignore on the super(AddHeaderMixin, self) line and the following super_ret attribute access. Trace how mypy applies that suppression, and consider the issue resolved when the reported error is correctly suppressed without requiring another ignore on super_ret.

Written by the indexing model from the issue text.

Description

feature priority-2-low

I found this new error that seems to have escaped a type: ignore when trying out the mypy 0.501:

zerver/storage.py:47: error: "super" has no attribute "post_process"

The code in question is https://github.com/zulip/zulip/blob/master/zerver/storage.py, the relevant block is the super_ret line below:

        super_class = super(AddHeaderMixin, self) # type: ignore # https://github.com/JukkaL/mypy/issues/857      
        if hasattr(super_class, 'post_process'):                                                                  
            super_ret = super_class.post_process(paths, dry_run, **kwargs)                                        
        else:                                                                                                     
            super_ret = []                                                                                        

I'll just add another type: ignore on the super_ret line for now, but I think it's a bug that mypy didn't suppress that.

Dominant language
Python
Stars
20.6k
Forks
3.3k
Avg merge
1d 18h
Merged PRs (30d)
54

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python/mypy

All issues in python/mypy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.