mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
support: temp_dir() and change_cwd() uses repr() in error message
Serhiy Storshaka pointed me that str(path) can emit a BytesWarning: use repr(path) instead.
This commit is contained in:
parent
620580f280
commit
3722f1f483
2 changed files with 5 additions and 5 deletions
|
@ -958,7 +958,7 @@ def temp_dir(path=None, quiet=False):
|
|||
if not quiet:
|
||||
raise
|
||||
warnings.warn(f'tests may fail, unable to create '
|
||||
f'temporary directory {path}: {exc}',
|
||||
f'temporary directory {path!r}: {exc}',
|
||||
RuntimeWarning, stacklevel=3)
|
||||
try:
|
||||
yield path
|
||||
|
@ -986,7 +986,7 @@ def change_cwd(path, quiet=False):
|
|||
if not quiet:
|
||||
raise
|
||||
warnings.warn(f'tests may fail, unable to change the current working '
|
||||
f'directory to {path}: {exc}',
|
||||
f'directory to {path!r}: {exc}',
|
||||
RuntimeWarning, stacklevel=3)
|
||||
try:
|
||||
yield os.getcwd()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue