Optionally flag known mypyc compatibility issues in mypy
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
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.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der Durchsicht des Beispiels mypyc#973 und der vorhandenen Diagnosen von mypy für Monkey-Patching. Lege den Umfang eines optionalen Fehlercodes für Überschreibungen von Unterklassen integrierter Typen, die Unterklassenbildung von kompilierten Klassen und relevantes Monkey-Patching fest, einschließlich etwaiger Hinweise oder Dokumentationslinks. Als abgeschlossen gilt die Arbeit, wenn die ausgewählten Inkompatibilitäten erkannt werden, ohne mypyc zu benötigen, und das Verhalten durch Tests abgedeckt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- compilers
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100