[Python-checkins] r88228 - in python/branches/py3k: Lib/test/test_ssl.py Misc/NEWS Modules/_ssl.c

victor.stinner python-checkins at python.org
Sat Jan 29 12:31:20 CET 2011


Author: victor.stinner
Date: Sat Jan 29 12:31:20 2011
New Revision: 88228

Log:
Issue #10989: Fix a crash on SSLContext.load_verify_locations(None, True).

Patch reviewed by Antoine Pitrou, okayed by Georg Brandl.

Modified:
   python/branches/py3k/Lib/test/test_ssl.py
   python/branches/py3k/Misc/NEWS
   python/branches/py3k/Modules/_ssl.c

Modified: python/branches/py3k/Lib/test/test_ssl.py
==============================================================================
--- python/branches/py3k/Lib/test/test_ssl.py	(original)
+++ python/branches/py3k/Lib/test/test_ssl.py	Sat Jan 29 12:31:20 2011
@@ -394,6 +394,9 @@
         ctx.load_verify_locations(CERTFILE, CAPATH)
         ctx.load_verify_locations(CERTFILE, capath=BYTES_CAPATH)
 
+        # Issue #10989: crash if the second argument type is invalid
+        self.assertRaises(TypeError, ctx.load_verify_locations, None, True)
+
     @skip_if_broken_ubuntu_ssl
     def test_session_stats(self):
         for proto in PROTOCOLS:

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sat Jan 29 12:31:20 2011
@@ -16,6 +16,8 @@
 Library
 -------
 
+- Issue #10989: Fix a crash on SSLContext.load_verify_locations(None, True).
+
 - Issue #11020: Command-line pyclbr was broken because of missing 2-to-3
   conversion.
 

Modified: python/branches/py3k/Modules/_ssl.c
==============================================================================
--- python/branches/py3k/Modules/_ssl.c	(original)
+++ python/branches/py3k/Modules/_ssl.c	Sat Jan 29 12:31:20 2011
@@ -1683,7 +1683,7 @@
         return NULL;
     }
     if (capath && !PyUnicode_FSConverter(capath, &capath_bytes)) {
-        Py_DECREF(cafile_bytes);
+        Py_XDECREF(cafile_bytes);
         PyErr_SetString(PyExc_TypeError,
                         "capath should be a valid filesystem path");
         return NULL;


More information about the Python-checkins mailing list