python / python/cpython

`quopri` uses conditional `binascii` import, when it is always available

Aperta
#133,896 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@sobolevn ci sta già lavorando.

Dal 11/5/2025.

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

Descrizione

Feature or enhancement

This module is quite old, it uses a conditional import of binascii since times when it was possible to not have it when zlib was missing: https://github.com/python/cpython/blob/13cb8ca3da75d6fe2a1114e58c24ca681fee411f/Lib/quopri.py#L12-L17

However, right now it is always available under all python implementations (like RustPython and PyPy).

Image

So, we can simplify the implementation and remove a lot of duplicated code, example: https://github.com/python/cpython/blob/13cb8ca3da75d6fe2a1114e58c24ca681fee411f/Lib/quopri.py#L51-L99

There are also several helper functions with public names, which are not in __all__ which will be unused after this. We can keep them and deprecate their use.

Since binascii is always available, python implementation is never used anyway.

So, the main pro:

  • We can remove some dead code

There are several cons to my proposal:

  • There are no real user reported problems
  • The module is old and stable
  • It does not require a lot of maintaince

I will open a draft PR, so people can see the amount of changes and decide better with that.

Should we do this?

Linked PRs
  • gh-133897

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.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.