python / python/cpython

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

オープン
#133,896 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

@sobolevn がすでに取り組んでいます。

2025年5月11日 から。

stdlib type-feature
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。