- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3k
          feat: report @deprecated() on non-overloaded class constructors
          #20104
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            bzoracler
  wants to merge
  16
  commits into
  python:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
bzoracler:fix-20103
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
      
        
          +563
        
        
          −11
        
        
          
        
      
    
  
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            16 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      0332484
              
                feat: report `@deprecated()` on non-overloaded class constructors
              
              
                bzoracler d497f37
              
                Add simple subclass tests
              
              
                bzoracler 53622b1
              
                fix error message typo
              
              
                bzoracler 39cd5f9
              
                Merge branch 'python:master' into fix-20103
              
              
                bzoracler a473e52
              
                Save an unnecessary instance check
              
              
                bzoracler 8f08c60
              
                Use the constructor definition chosen by mypy rather than walking 2 MROs
              
              
                bzoracler b0ffd6b
              
                Warn deprecated constructor calls from old-style type aliases
              
              
                bzoracler c954f78
              
                fix unexpanded type check error
              
              
                bzoracler 00897ab
              
                fix unexpanded type check error
              
              
                bzoracler 3b7b986
              
                augment basic deprecation tests with override checks
              
              
                bzoracler 4b42ea6
              
                add specific tests for deprecated overloaded class constructors
              
              
                bzoracler 9e49aa1
              
                add test for accessing methods via `self` and `cls`
              
              
                bzoracler 4be62c6
              
                add tests for accessing class constructor methods directly
              
              
                bzoracler 79d0cb0
              
                implement reporting on `type[ClassWithDeprecatedConstructor]()`
              
              
                bzoracler 5302af3
              
                add incremental test for calling deprecated constructors
              
              
                bzoracler d595948
              
                add tests for unioned type calls to deprecated constructors
              
              
                bzoracler File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      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
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  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.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callee_is_overload_itemin this method doesn't actually activate any code paths. Its addition is for logical consistency and future-proofing any more cases handled here:mypy/mypy/checkexpr.py
Lines 1403 to 1415 in 054f721
The test for future-proofing is this one:
mypy/test-data/unit/check-deprecated.test
Line 834 in 79d0cb0