python / python/cpython

Revive binascii.Incomplete?

Aperta
#148,108 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

3.15 extension-modules type-feature
Lingua principale
Python
Stelle
77.2k
Fork
35.9k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

Feature or enhancement

binascii.Incomplete was only used in BinHex 4 (HQX) decoder. After removing that decoder in #89248, binascii.Incomplete became orphaned. It could be removed too.

We can reuse it for decoding errors that can potentially be fixed by reading more data. Not all incomplete data errors can be detected, in some codecs incomplete data can be valid.

For compatibility, binascii.Incomplete should be made a subclass of binascii.Error.

We perhaps will need to add also the final parameter (True by default). If it is false, then binascii.Incomplete will be raised if the last group of data is ambiguous, if the result of decoding concatenated data can be different from concatenation of independently decoded chunks.

I am not sure that this feature will be very useful, but without it we cannot reliably decode chunked data if it was split not on boundaries between groups. Although having only this feature the incremental decoder will be vulnerable to quadratic complexity issue. For example, reading line by line and decoding Base64 data split on 76 column lines except the first line containing 75 alphabetic characters will have quadratic complexity.

Linked PRs
  • gh-148109

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

La issue riguarda binascii.Incomplete, il decoder BinHex/HQX rimosso e la decodifica Base64 a blocchi. Inizia esaminando i punti di ingresso del decoder binascii e il lavoro correlato gh-148109; chiarisci se l’eccezione debba essere rimossa o riutilizzata, la sua derivazione da Error e la semantica finale. Il lavoro è completato quando l’ambito è concordato e sono presenti test per input incompleti e concatenati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
backend
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.