libgit2 / libgit2/pygit2

Signature email requires ASCII on Python 2 but requires Unicode only "str" on Python 3

Offen
#932 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
1.7k
Forks
408
Ø Merge
2 T. 57 Min.
Gemergte PRs (30 T.)
7

Beschreibung

Signature_init in signature.c currently uses the s format string for parsing the email argument. This is inconsistent between Python 2 and 3. On Python 2, it accepts either text (unicode) or bytes (str) and implicitly encodes text using the default system encoding, which is ascii by default (and it seems like changing it is kind of weird and not really recommended by most people). Python 3, it only accepts text (str), and it's implicitly encodes it using UTF-8.

The name argument for Signature_init just uses O and accepts either text or bytes. It appears to implicitly encode text using UTF-8 and leaves bytes as-is. I would expect the email argument to work the same way.

So there's currently no way to pass in bytes on Python 3 and no way to pass in non-ASCII text on Python 2.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne in signature.c bei Signature_init und untersuche, wie das email-Argument im Vergleich zum name-Argument geparst wird. Überprüfe das Verhalten unter Python 2 und Python 3; abgeschlossen bedeutet, dass email unter Python 3 Bytes und unter Python 2 Nicht-ASCII-Text konsistent mit name akzeptiert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, python
Bereich
api
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.