| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
Sorry, something went wrong.
|
Please add a test. I notice the diff is quite different than #21398 so I'm not sure what's going on here :/ |
Sorry, something went wrong.
| else: | ||
| dv = getattr(template, options_key, None) | ||
| if dv is None: | ||
| if dv is None and not hasattr(template, options_key): |
There was a problem hiding this comment.
| if dv is None and not hasattr(template, options_key): | |
| if not hasattr(template, options_key): |
I feel like this is simpler?
Sorry, something went wrong.
The config parser was skipping options whose default value is None (e.g. 'output'), even when the attribute exists on the Options class. This was due to the condition 'dv is None' being used to skip unknown options, but some valid options intentionally have None defaults. The fix changes the condition to skip only options that don't exist on the template Options object (using hasattr), allowing options like 'output' to be set in config files. Fixes python#21376
|
I replaced this with #21465 after cleaning up the branch history and adding the requested test. The new PR is based directly on current master and only changes mypy/config_parser.py plus mypy/test/test_config_parser.py. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
The config parser was skipping options whose default value is None (e.g. 'output'), even when the attribute exists on the Options class.
This was due to the condition 'dv is None' being used to skip unknown options, but some valid options intentionally have None defaults.
The fix changes the condition to skip only options that don't exist on the template Options object (using hasattr), allowing options like 'output' to be set in config files.
Fixes #21376