Redundant quotes in `subprocess.TimeoutExpired` message
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:
Bug description:
While looking into https://github.com/python/cpython/pull/151486, I noticed a similar issue in subprocess.TimeoutExpired.__str__.
subprocess.TimeoutExpired.__str__ manually wraps cmd in single quotes while formatting the exception message.
This produces confusing output when cmd is a list, because the list representation already contains quotes around its string elements.
import subprocess
import sys
cmd = [sys.executable, "-c", "import time; time.sleep(10)"]
subprocess.run(cmd, timeout=0.01)
Current output:
Traceback (most recent call last):
...
subprocess.TimeoutExpired: Command '['...python...', '-c', 'import time; time.sleep(10)']' timed out after 0.01 seconds
Expected output:
Traceback (most recent call last):
...
subprocess.TimeoutExpired: Command ['...python...', '-c', 'import time; time.sleep(10)'] timed out after 0.01 seconds
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
- gh-152559
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 bei subprocess.TimeoutExpired.str und untersuche die vorhandenen subprocess-Ausnahmetests. Reproduziere das Timeout-Beispiel, passe die erwartete Meldung so an, dass die Befehlsdarstellung nicht redundant eingeschlossen wird, und überprüfe, dass die relevanten subprocess-Tests bestehen; der verknüpfte PR gh-152559 zeigt an, dass die Arbeit bereits im Gange ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 35/100