python / python/cpython

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

Ouverte
#133,896 2 commentaires 0 réactions 1 personne assignée Voir sur GitHub

@sobolevn y travaille déjà.

Depuis le 11/5/2025.

stdlib type-feature
Langage dominant
Python
Étoiles
77.2k
Forks
35.9k
Métriques de merge des PR
Métriques de PR en attente

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.