diff Python/fileutils.c @ 74129:33dea851f918

Issue #13626: Add support for SSL Diffie-Hellman key exchange, through the SSLContext.load_dh_params() method and the ssl.OP_SINGLE_DH_USE option.
author Antoine Pitrou <solipsis@pitrou.net>
date Thu, 22 Dec 2011 10:03:38 +0100
parents a882aa30a713
children c80d9a0bd5a0
line wrap: on
line diff
--- a/Python/fileutils.c	Thu Dec 22 09:46:44 2011 +0200
+++ b/Python/fileutils.c	Thu Dec 22 10:03:38 2011 +0100
@@ -310,6 +310,12 @@
     wchar_t wmode[10];
     int usize;
 
+    if (!PyUnicode_Check(path)) {
+        PyErr_Format(PyExc_TypeError,
+                     "str file path expected under Windows, got %R",
+                     Py_TYPE(path));
+        return NULL;
+    }
     wpath = PyUnicode_AsUnicode(path);
     if (wpath == NULL)
         return NULL;