[issue20517] Support errors with two filenames for errno exceptions

2014-03-13 Thread Larry Hastings
Larry Hastings added the comment: Yeah, I admit I don't understand what problem that code was solving. But it looked Very Deliberate so I preserved the behavior. -- ___ Python tracker

[issue20517] Support errors with two filenames for errno exceptions

2014-03-13 Thread R. David Murray
R. David Murray added the comment: (Ether that, or it is a long-standing bug.) -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue20517] Support errors with two filenames for errno exceptions

2014-03-13 Thread R. David Murray
R. David Murray added the comment: I was going to wonder if the args thing was a bug, but I see that actually it continues the backward-compatibility tradition already established (python3.3): >>> x = OSError(2, 'No such file or directory', 'abc') >>> str(x) "[Errno 2] No such file or directory

[issue20517] Support errors with two filenames for errno exceptions

2014-03-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: OK then. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.py

[issue20517] Support errors with two filenames for errno exceptions

2014-03-13 Thread R. David Murray
R. David Murray added the comment: In 3.3: >>> x = OSError(2, 'No such file or directory', 'foo', 0, 'bar') >>> str(x) "(2, 'No such file or directory', 'foo', 0, 'bar')" So, I don't see this as a realistic backwards compatibility problem worthy of a porting note. -- nosy: +r.david.mu

[issue20517] Support errors with two filenames for errno exceptions

2014-02-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think it is worth to mention this in Doc/whatsnew/3.4.rst, as this is a little incompatible change. Python 3.3: >>> x = OSError(2, 'No such file or directory', 'foo', 0, 'bar') >>> x.args (2, 'No such file or directory', 'foo', 0, 'bar') Python 3.4: >>>

[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread Larry Hastings
Larry Hastings added the comment: Buildbots are basically happy with it. It's checked in. This was the last checkin before 3.4.0rc1 was tagged! -- resolution: -> fixed status: open -> closed ___ Python tracker

[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread Roundup Robot
Roundup Robot added the comment: New changeset 6343bdbb7085 by Larry Hastings in branch 'default': Issue #20517: Removed unnecessary new (short-lived) functions from PyErr. http://hg.python.org/cpython/rev/6343bdbb7085 -- ___ Python tracker

[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread STINNER Victor
STINNER Victor added the comment: I applied larry.oserror.remove.with.filenames.etc.1.diff on default: On Windows, the code compiles fine and test_os pass. -- ___ Python tracker __

[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread Larry Hastings
Larry Hastings added the comment: Talked it over with Victor in IRC. I agree it's best to only add the WithFilenameObjects functions, as best practice requires using the original PyObject * passed in when creating the OSError. The attached patch removes all the new WithFilenames and WithUnico

[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread STINNER Victor
STINNER Victor added the comment: "And you should avoid passing raw bytes string to build an error message, you probably has the Python object version of the filename somewhere in your code." Oh, I remember the reason why char* must not be used to build an OSError: on Windows, you should never

[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread STINNER Victor
STINNER Victor added the comment: The family of "PyErr_SetExcFrom..." functions was used when there were various kind of exceptions: select.error, mmap.error, OSError, IOError, socket.error, etc. The "PEP 3151: Reworking the OS and IO exception hierarchy" has been implemented in Python 3.3. I'

[issue20517] Support errors with two filenames for errno exceptions

2014-02-10 Thread STINNER Victor
STINNER Victor added the comment: Why did you add so many versions of the same functions? Only PyErr_SetExcFromWindowsErrWithFilenameObjects() and PyErr_SetFromErrnoWithFilenameObjects() are used. The Py_UNICODE type is deprecated, you should not add new functions using it in Python 3.4. +Py

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Larry Hastings
Larry Hastings added the comment: It's in! And the buildbots look healthy. -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed ___ Python tracker _

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 081a9d8ba3c7 by Larry Hastings in branch 'default': Issue #20517: Functions in the os module that accept two filenames http://hg.python.org/cpython/rev/081a9d8ba3c7 -- nosy: +python-dev ___ Python tracker

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Larry Hastings
Larry Hastings added the comment: Okay. I have revived the Py_UNICODE functions I removed in patch #3. The patch now works fine on my Ubuntu 13.10 64-bit box, and at least compiled on a Windows buildbot. It's now building on nine buildbots. Assuming the buildbots look good, can I check this

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread STINNER Victor
STINNER Victor added the comment: Support of bytes filenames has ben deprecated on Windows, Unicode is really the native type. -- ___ Python tracker ___ _

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Larry Hastings
Larry Hastings added the comment: One more tweak from Serhiy. -- Added file: http://bugs.python.org/file34015/larry.oserror.add.filename2.5.diff ___ Python tracker ___ __

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Larry Hastings
Larry Hastings added the comment: New patch incorporating Serhiy's suggestions. Thanks, Serhiy! Did more testing with the buildbots. Windows Server 2008 32-bit and 64-bit were both fine. So were ARMv7, OpenIndiana 64-bit, Gentoo 32-bit, FreeBSD 10 64-bit, and PowerLinux PPC 64-bit. (This w

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm not sure that PyErr_SetFromWindowsErrWithFilenames() and PyErr_SetExcFromWindowsErrWithFilenames() will be useful. "const char*" filenames are not recommended on Windows. Victor can say more. -- nosy: +haypo _

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Larry Hastings
Larry Hastings added the comment: Attached is patch #3. This one has been tested on Linux, Windows 7 64-bit, and Snow Leopard 64-bit. Windows Server 2008 32-bit and 64-bit are running now, looking good so far. Changes: * The order of arguments for OSError is now: (errno, string, filename

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Georg Brandl
Georg Brandl added the comment: I agree. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Perhaps they should be. Note that all functions that accept Py_UNICODE are not a part of stable API. In any case I don't think we should add *new* functions with deprecated API. -- ___ Python tracker

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Larry Hastings
Larry Hastings added the comment: But the PyErr_ functions that accept Py_UNICODE aren't marked deprecated. http://docs.python.org/3.4/c-api/exceptions.html#unicode-exception-objects -- ___ Python tracker

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: http://docs.python.org/3/c-api/unicode.html#deprecated-py-unicode-apis -- ___ Python tracker ___ _

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Larry Hastings
Larry Hastings added the comment: There aren't any deprecation warnings in the code. -- ___ Python tracker ___ ___ Python-bugs-list ma

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Are *WithUnicodeFilenames() functions needed? Py_UNICODE API considered as deprecated and there is no need to support compatibility with older versions. -- ___ Python tracker __

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Larry Hastings
Larry Hastings added the comment: Added a test checking that the error messages show up properly. -- assignee: -> larry stage: needs patch -> patch review Added file: http://bugs.python.org/file34005/larry.oserror.add.filename2.2.diff ___ Python trac

[issue20517] Support errors with two filenames for errno exceptions

2014-02-09 Thread Larry Hastings
Larry Hastings added the comment: Here's a first cut at a patch. With this applied Python passes the whole test suite. I was surprised at how ticklish the OSError object was about adding a fifth member, with this weird "exception tuples can only have two members" policy. But test_exceptions

[issue20517] Support errors with two filenames for errno exceptions

2014-02-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > This issue has been on my radar for a while (originally #16074). But I > wasn't paying strong attention to it. Nobody in that issue came up with a > solution I liked. Finally when you posted your patch I said "ugh, can't we > do better" and had to think ab

[issue20517] Support errors with two filenames for errno exceptions

2014-02-06 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue20517] Support errors with two filenames for errno exceptions

2014-02-06 Thread Larry Hastings
Larry Hastings added the comment: Serhiy: I'm not sure if it's the language barrier, but that came across kind of mean. It's not that I can do whatever I want as release manager, but that I have the say in whether something is a "bug fix" or a "new feature", which is how we decide whether or

[issue20517] Support errors with two filenames for errno exceptions

2014-02-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: As release manager Larry has the right to add a new feature after feature freeze. -- ___ Python tracker ___ _

[issue20517] Support errors with two filenames for errno exceptions

2014-02-05 Thread Vajrasky Kok
Vajrasky Kok added the comment: "But there are some errors that really need two filenames, like copy(), symlink(), and rename()." I think *need* is too strong word in this case. I agree that two filenames is better than none. But I don't see anything wrong from omitting filenames in error mes

[issue20517] Support errors with two filenames for errno exceptions

2014-02-04 Thread Larry Hastings
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