python / python/cpython

Confusing documentation for the `n` parameter of `Threading.Condition.notify(n)`

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

まだ誰も着手していません。

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

説明

Documentation

I'm confused by this documentation of Threading.Condition.notify(), specifically the n parameter.

[...]

This method wakes up at most n of the threads waiting for the condition variable; it is a no-op if no threads are waiting.

The current implementation wakes up exactly n threads, if at least n threads are waiting. However, it’s not safe to rely on this behavior. A future, optimized implementation may occasionally wake up more than n threads.

[...]

(Boldface added by me.)

So is the contract that it will wake up ≤n threads, or ≥n threads? Is there any guarantee at all?

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

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

はじめの一歩

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

調査の方向性

リンクされている Python 3.12 の threading.Condition.notify() ドキュメントから始め、n パラメーターの説明全体を読んでください。記載されている上限と現在の実装の関係を、何らかの保証が意図されているかどうかも含めて明確にしてください。完了とは、ドキュメントによって契約が曖昧なままにならなくなることです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

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

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