non-blocking reads of binary and text streams handle no-data differently
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Bug report
Bug description:
proc = subprocess.Popen(
['bash', '-c', 'sleep 10; echo hello'],
stdout=subprocess.PIPE,
text=True
)
os.set_blocking(proc.stdout.fileno(), False)
print(repr(proc.stdout.read(8192)))
Refer to issue #57531 for discussion on what should happen in general, but I'm filing this to point out that when text=True the output is an empty string (indistinguishable from EOF, which is a problem), and when text=False the result is None (while an empty string is produced only on EOF).
They should probably behave consistently, and also EOF should be distinguishable from no-data-yet; making the binary behaviour preferable.
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem subprocess.Popen-Beispiel in diesem Issue und vergleiche die Ergebnisse nicht blockierender Lesevorgänge für text=True und text=False unter CPython 3.13/Linux. Lies Issue #57531 zum vorgeschlagenen allgemeinen Verhalten; abgeschlossen ist die Aufgabe, wenn „no-data-yet“ und EOF unterscheidbar sind und sich binäre und Text-Streams konsistent verhalten.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100