typing.get_origin behaves differently between standard collections and typing collections
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 36k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Bug report
typing.get_origin behaves differently between standard collections, and typing collections
more specifically
get_origin(dict) is None, while get_origin(Dict) is <class 'dict'>
the same holds for other collections as well
This is true from python3.9 where support for standard collections was added
to my understanding dict should be able to be a drop-in replacement for Dict, which is not true in case relying on get_origin
I suggest updating get_origin to return the relevant class for builtin collections as opposed to None which returns today
note, this might mean a breaking change, as pointed out here, but id does make Dict and dict behave more similarly
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 damit, typing.get_origin für dict, Dict und die anderen im Bericht beschriebenen Sammlungspaare nachzubilden. Lies die bestehende get_origin-Implementierung und ihre Tests und sieh dir anschließend die Diskussion über das Risiko einer inkompatiblen Änderung an. Als erledigt gilt die Aufgabe, wenn das beabsichtigte Verhalten vereinbart ist und die relevanten Sammlung Fälle konsistent abgedeckt sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- developer-experience
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100