[Python-checkins] cpython (2.7): fix error message for invalid curve name

benjamin.peterson python-checkins at python.org
Thu Aug 21 04:37:10 CEST 2014


http://hg.python.org/cpython/rev/dea18d1104b6
changeset:   92171:dea18d1104b6
branch:      2.7
parent:      92169:ec2efc094d62
user:        Benjamin Peterson <benjamin at python.org>
date:        Wed Aug 20 21:37:01 2014 -0500
summary:
  fix error message for invalid curve name

files:
  Modules/_ssl.c |  6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)


diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2855,8 +2855,12 @@
     }
     nid = OBJ_sn2nid(name_bytes);
     if (nid == 0) {
+        PyObject *r = PyObject_Repr(name);
+        if (!r)
+            return NULL;
         PyErr_Format(PyExc_ValueError,
-                     "unknown elliptic curve name %R", name);
+                     "unknown elliptic curve name %s", PyString_AS_STRING(r));
+        Py_DECREF(r);
         return NULL;
     }
     key = EC_KEY_new_by_curve_name(nid);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list