- 
                Notifications
    
You must be signed in to change notification settings  - Fork 82
 
mypy: fix all assignment #368
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
base: main
Are you sure you want to change the base?
Conversation
246817b    to
    e14b212      
    Compare
  
    e14b212    to
    ca326ca      
    Compare
  
    | if value and self.repeat.get(attr) is not None: | ||
| value = getattr(object, attr, 0) + 1 | ||
| setattr(object, attr, value) | ||
| self.option_order.append((opt, value)) | 
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.
See discussion in https://github.com/pypa/distutils/pull/343/files#r2440199822
| assert isinstance(cc, str) | ||
| assert isinstance(cxx, str) | ||
| assert isinstance(cflags, str) | ||
| assert isinstance(ccshared, str) | ||
| assert isinstance(ldshared, str) | ||
| assert isinstance(ldcxxshared, str) | ||
| assert isinstance(shlib_suffix, str) | ||
| assert isinstance(ar_flags, str) | ||
| ar = os.environ.get('AR', ar) | ||
| assert isinstance(ar, str) | 
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.
I'm not sure these changes are stable. I'm worried there are edge cases that would begin to fail with this change. Let's be confident that this change doesn't break anything (and consider using casts to retain the current behavior if appropriate).
I'm not sure these assertions will always pass. There have been some bugs around these being undefined in unusual environments. Maybe it makes sense to catch these conditions early. Do we have good reason to believe that non-string values returned here would never be viable (would be breaking anyway)?
ca326ca    to
    d4fdab6      
    Compare
  
    | 
               | 
          ||
| # Medium-easy stuff: same syntax/semantics, different names. | ||
| ext.runtime_library_dirs = build_info.get('rpath') | ||
| ext.runtime_library_dirs = build_info.get('rpath') or [] | 
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.
Runtime change: avoid assigning None to runtime_library_dirs (I didn't fully investigate whether that should even be possible at runtime or just an artefact of code that is too dynamic to be type-safe)
No description provided.