New submission from Larry Hastings:

There are a bunch of functions provided by Python, e.g. 
PyErr_SetFromErrnoWithFilenameObject(), that allow specifying a filename 
associated with the error.  But there are some errors that really need two 
filenames, like copy(), symlink(), and rename().  The error could be on only 
one file, but some errors could apply to either or both, and errno's error 
doesn't always provide enough context to tell which it would be.

I propose that we add new APIs that allow specifying a second filename.  We 
take all the *WithFilename* APIs and add the *WithFilenames* equivalent (e.g. 
PyErr_SetFromErrnoWithFilenameObjects()).  Internally, oserror_parse_args() 
would now parse an extra "filename2" entry in the tuple, just after the 
"filename" entry (but before the possible "winerror" entry).

Currently when formatting an error with a filename, the format string looks like
    [Errno {errno}] {errstring}: {filename}
I propose that for two filenames it look like
    [Errno {errno}] {errstring}: \"{filename}\" -> \"{filename2}\"

----------
messages: 210290
nosy: georg.brandl, larry, richard, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Support errors with two filenames for errno exceptions
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20517>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to