This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author larry
Recipients georg.brandl, larry, richard, serhiy.storchaka
Date 2014-02-05.03:43:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1391571790.8.0.840627368503.issue20517@psf.upfronthosting.co.za>
In-reply-to
Content
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}\"
History
Date User Action Args
2014-02-05 03:43:10larrysetrecipients: + larry, richard, georg.brandl, serhiy.storchaka
2014-02-05 03:43:10larrysetmessageid: <1391571790.8.0.840627368503.issue20517@psf.upfronthosting.co.za>
2014-02-05 03:43:10larrylinkissue20517 messages
2014-02-05 03:43:10larrycreate