]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 68139 via svnmerge from
authorGeorg Brandl <georg@python.org>
Sat, 3 Jan 2009 23:54:46 +0000 (23:54 +0000)
committerGeorg Brandl <georg@python.org>
Sat, 3 Jan 2009 23:54:46 +0000 (23:54 +0000)
svn+ssh://svn.python.org/python/branches/py3k

................
  r68139 | hirokazu.yamamoto | 2009-01-01 17:03:45 +0100 (Thu, 01 Jan 2009) | 10 lines

  Merged revisions 68134 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r68134 | hirokazu.yamamoto | 2009-01-02 00:45:39 +0900 | 2 lines

    Issue #4797: IOError.filename was not set when _fileio.FileIO failed to open
    file with `str' filename on Windows.
  ........
................

Misc/NEWS
Modules/_fileio.c

index c4af5968989ec1ff3467606048427f4960b40034..aacf519007c793131f34d00ec760f1edc2e03d30 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -20,11 +20,12 @@ Core and Builtins
   print elapsed times, not only when some objects are uncollectable /
   unreachable. Original patch by Neil Schemenauer.
 
-- Issue #3439: Add a bit_length method to int.
-
 - Issue #4747: When the terminal does not use utf-8, executing a script with
   non-ascii characters in its name could fail with a "SyntaxError: None" error.
 
+- Issue #4797: IOError.filename was not set when _fileio.FileIO failed to open
+  file with `str' filename on Windows.
+
 - Issue #3680: Reference cycles created through a dict, set or deque iterator
   did not get collected.
 
index c36a5de1c96c260c4b8e2588dc38daf9038ab4b8..8579e4e60bdb0568e0e36519bffe974a89e7ea5d 100644 (file)
@@ -284,10 +284,11 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
                Py_END_ALLOW_THREADS
                if (self->fd < 0) {
 #ifdef MS_WINDOWS
-                       PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename);
-#else
-                       PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
+                       if (widename != NULL)
+                               PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename);
+                       else
 #endif
+                               PyErr_SetFromErrnoWithFilename(PyExc_IOError, name);
                        goto error;
                }
                if(dircheck(self, name) < 0)