Optionally flag known mypyc compatibility issues in mypy
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Feature
Mypyc is incompatible in some ways with CPython semantics (mypyc/mypyc#973 is a recent example). Add an optional error code to mypy that detects some of these incompatible features in code even when not using mypyc. We can also explain how to work around the issues in notes, or include links to documentation.
Here are some issues we could flag:
- Overriding methods in subclasses of built-in types such as
intorstrthat mypyc can't use. - Subclassing compiled classes that don't support interpreted subclasses. This would require knowledge of which modules will be compiled.
- Monkey patching native functions or methods. This is usually flagged already by mypy, but we could perhaps detect this in additional cases, add a note about mypyc when relevant, and use a separate error code.
Pitch
Code that isn't compiled with mypyc can trigger incompatible behavior or exceptions when interacting with mypyc-compiled modules, and this is confusing. These messages would make it easier to avoid using things that may cause issues with mypyc, if part of a project is compiled with mypyc.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the mypyc#973 example and mypy's existing diagnostics for monkey patching. Define the scope of an optional error code for built-in subclass overrides, compiled-class subclassing, and relevant monkey patching, including any notes or documentation links. Done means the selected incompatibilities are detected without requiring mypyc and the behavior is covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100