Message231400
It would be inconsitent to provide filename only if exec is called e.g.:
>>> import subprocess
subprocess.call("not used", cwd="nonexistent")
FileNotFoundError: [Errno 2] No such file or directory: 'nonexistent'
The error message shows the filename (cwd) despite exec not being
called therefore it would be logical to provide non-None `filename`
attribute here too.
If we ignore the backward compatibility issue I've mentioned in msg231297
then the current code:
if errno_num == errno.ENOENT:
if child_exec_never_called:
# The error must be from chdir(cwd).
err_msg += ': ' + repr(cwd)
else:
err_msg += ': ' + repr(orig_executable)
raise child_exception_type(errno_num, err_msg)
could be replaced with:
if errno_num == errno.ENOENT:
if child_exec_never_called:
# The error must be from chdir(cwd).
filename = cwd
else:
filename = orig_executable
raise child_exception_type(errno_num, err_msg, filename)
raise child_exception_type(errno_num, err_msg)
[1] https://hg.python.org/cpython/file/23ab1197df0b/Lib/subprocess.py#l1443 |
|
Date |
User |
Action |
Args |
2014-11-19 22:38:02 | akira | set | recipients:
+ akira, gregory.p.smith, ronaldoussoren, vstinner, tshepang, berker.peksag, charpov, travis.thieman |
2014-11-19 22:38:01 | akira | set | messageid: <1416436681.92.0.835942451086.issue22536@psf.upfronthosting.co.za> |
2014-11-19 22:38:01 | akira | link | issue22536 messages |
2014-11-19 22:38:01 | akira | create | |
|